Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(drop-while |(> 3 $ ) [0 1 2 3 4 5 6 7 8 ])
# => (3 4 5 6 7 8) (cmp 1.0 2 )
# => -1
(array/pop @[]) # => nil # If your tooling or the compiler doesn't believe a symbol will be bound e.g.:
(def a b ) # if b e.g. gets bound by some macro or pushed directly to the env
# You can wrap it with compwhen on a bool:
(var- bla false )
(compwhen bla
(def a b ))
# Whatever defines b should then set bla to true
# From: https://codeberg.org/veqq/declarative-dsls/src/branch/master/src/declarative-dsls/logic.janet (+ 1 2 3 ) # => 6
(sum [1 2 3 ]) # => 6 (get-in [[4 5 ] [6 7 ]] [0 ] 42 ) # => (4 5)
(get-in [[4 5 ] [6 7 ]] [0 1 ] 42 ) # => 5
(get-in [[4 5 ] [6 7 ]] [-1 ] 42 ) # => 42
(get-in [[4 5 ] [6 7 ]] [9 9 9 ] 42 ) # => 42
(some even? [1 3 5 7 11 18 ])
# =>
true
(seq [v :in (coro
(yield :hi )
(yield :bye ))]
v )
# => @[:hi :bye] (var enabled false )
(toggle enabled )
(print enabled )
# => true (string "hello" nil true 42 :bar ) # => "helloniltrue42bar"
(string :a :b :c ) # => "abc"
(let [c (ev/chan 1 )
before (ev/count c )]
(ev/give c :hi )
[before (ev/count c )])
# =>
'(0 1 )(def arr (array :a [:b :c ] :d ))
# => @[:a (:b :c) :d]
(0 arr )
# => :a
(1 arr )
# => (:b :c)
# out-of-bounds access causes an error
(try
(3 arr )
([err ] err ))
# => "expected integer key for array in range [0, 3), got 3"
# you may use `get` to avoid the error
(get arr 3 )
# => nil (def b @"" )
(def v (* 1000 (math/random )))
# => 487.181 your number can differ
(xprinf b "Value reached level %f" v )
# => nil
b
# => @"Value reached level 487.181188" (band 7 11 ) # => 3
# 0111 (7)
# and 1011 (11)
# --------
# 0011 (3)
(flatten-into @[1 2 3 ] @[[4 5 6 ] @[7 8 9 ] @[10 11 12 ]]) # => @[1 2 3 4 5 6 7 8 9 10 11 12]