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
:any
Examples
copy
to :integer "2020" ; 2020
to :integer `A` ; 65
to :char 65 ; `A`
to :integer 4.3 ; 4
to :floating 4 ; 4.0
to :complex [1 2] ; 1.0+2.0i
; make sure you're using the `array` (`@`) converter here, since `neg` must be evaluated first
to :complex @[2.3 neg 4.5] ; 2.3-4.5i
to :rational [1 2] ; 1/2
to :rational @[neg 3 5] ; -3/5
to :boolean 0 ; false
to :boolean 1 ; true
to :boolean "true" ; true
to :literal "symbol" ; 'symbol
copy
to :string 2020 ; "2020"
to :string 'symbol ; "symbol"
to :string :word ; "word"
to :string .format:"dd/MM/yy" now
; 22/03/21
to :string .format:".2f" 123.12345
; 123.12
copy
to :block "one two three" ; [one two three]
do to :block "print 123" ; 123
copy
to :date 0 ; => 1970-01-01T01:00:00+01:00
print now ; 2021-05-22T07:39:10+02:00
to :integer now ; => 1621661950
to :date .format:"dd/MM/yyyy" "22/03/2021"
; 2021-03-22T00:00:00+01:00
copy
to [:string] [1 2 3 4]
; ["1" "2" "3" "4"]
to [:char] "hello"
; [`h` `e` `l` `l` `o`]