convert value to given type
Parameters
to type :type :block
value :any
Attributes
format | :string | use given format (for dates or floating-point numbers) |
unit | :string, :literal | use given unit (for quantities) |
intrepid | | convert to bytecode without error-line tracking |
hsl | | convert HSL block to color |
hsv | | convert HSV block to color |
Returns
Examples
copy
to :integer "2020"
to :integer `A`
to :char 65
to :integer 4.3
to :floating 4
to :complex [1 2]
to :complex @[2.3 neg 4.5]
to :boolean 0
to :boolean 1
to :boolean "true"
to :literal "symbol"
copy
to :string 2020
to :string 'symbol
to :string :word
to :string .format:"dd/MM/yy" now
to :string .format:".2f" 123.12345
copy
to :block "one two three"
do to :block "print 123"
copy
to :date 0
print now
to :integer now
to :date .format:"dd/MM/yyyy" "22/03/2021"
copy
to [:string] [1 2 3 4]
to [:char] "hello"
copy
define :person [name surname age][]
to :person ["John" "Doe" 35]
copy
to :color [255 0 10]
to :color .hsl [255 0.2 0.4]
Related