Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(* 3 4 5 ) # => 60
(product [3 4 5 ]) # => 60 (last "hello" )
# => 111
(os/time ) # => 1593838384
(os/date ) # => {:month 6 :dst false :year-day 185 :seconds 8 :minutes 53 :week-day 6 :year 2020 :hours 4 :month-day 3}
(os/mktime (os/date )) # => 1593838390
(math/round 1.1 ) # => 1
(map math/round [1.49 1.50 1.51 ]) # => @[1 2 2]
(as-> [1 2 3 ] _
(map inc _ )
(sum _ )
(- _ 10 )
(< _ 0 ))
# -> true
# same as
(< (- (sum (map inc [1 2 3 ])) 10 ) 0 )(invert :yo )
# => @{111 1 121 0} (def buf-bytes 12 )
(var new-buffer (buffer/new buf-bytes )) #--> @""
(buffer/push new-buffer "hello, world" ) #--> @"hello, world" (let [x 10 ]
(unless (= x 10 )
(print "x is not 10!" )
)
)
# => nil
(let [x 5 ]
(unless (= x 10 )
(print "x is not 10!" )
)
)
# => "x is not 10!" (var x 1 )
(+= x 2 3 4 )
# x = 10 (def t @{:a 1 :b 2 :c @[1 2 3 ]})
(def ct (table/clone t ))
(put ct :a 3 ) # => @{:c @[1 2 3] :a 3 :b 2}
(pp t ) # => @{:c @[1 2 3] :a 1 :b 2}
(update ct :c array/concat 4 ) # => @{:c @[1 2 3 4] :a 3 :b 2}
(pp t ) # => @{:c @[1 2 3 4] :a 3 :b 2}
# array under key :c is shared between tables!
(seq [i :range [0 3 ]
j :range [0 3 ]
:let [c (string/format "%c" (+ 97 i ))]
:when (and (even? i ) (even? j ))]
[(keyword c ) j ])
# => '@[(:a 0) (:a 2) (:c 0) (:c 2)] (map dictionary? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false false false false false false true true ]
(map struct? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false false false false false false true false ]
(map table? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false false false false false false false true ] (print
(prompt :a
(for i 0 1000000000000
(print (string "i=" i ))
(if (= i 2 )
(return :a 10 )))))
# output:
# i=0
# i=1
# i=2
# 10 # janet 1.10.1
(array/peek @[]) # => nil
(array/peek @[1 ]) # => 1
(array/peek @[1 2 ]) # => 2
(array/peek [1 2 ]) # error: expected array, got tuple
(array/peek (array [1 2 ])) # => (1 2)
(array/peek (array ;[1 2 ])) # => 2
(def a @[])
(array/push a 1 ) # => @[1]
a # => @[1]
(array/push a 2 ) # => @[1 2]
a # => @[1 2]