Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(find |(= 2 $ ) {:a 1 :b 2 :c 3 })
# => 2
(get @"Hello" 1 )
# => 101
(find |(= 101 $ ) @"Hello" )
# => 101
(find |(> $ 3 ) {:a 1 :b 2 :c 3 })
# => nil (def a @[1 6 ]) # => @[1 6]
(array/insert a 1 (splice [2 3 ])) # => @[1 2 3 6]
(array/insert a 3 ;[4 5 ]) # => @[1 2 3 4 5 6]
#!/usr/bin/env janet
# echo stdin to stdout.
(file/write stdout (file/read stdin :all ))
(string/format "%f" (os/clock )) # => "1627746483.991000" (any? "" )
# => nil
(any? "Hello" )
# => 72
(any? @"Hello" )
# => 72
(any? @[])
# => nil
(any? [])
# => nil
(any? {})
# => nil
(any? @{})
# => nil
(any? @[1 2 3 4 ])
# => 1
(any? @{:a 2 :b 3 })
# => 2
(map math/abs [-2.9 -2.1 2.1 2.9 ]) # => @[ 2.9 2.1 2.1 2.9 ]
(map math/floor [-2.9 -2.1 2.1 2.9 ]) # => @[ -3 -3 2 2 ]
(map math/ceil [-2.9 -2.1 2.1 2.9 ]) # => @[ -2 -2 3 3 ]
(map math/round [-2.9 -2.1 2.1 2.9 ]) # => @[ -3 -2 2 3 ]
(map math/trunc [-2.9 -2.1 2.1 2.9 ]) # => @[ -2 -2 2 2 ]
(for i 0 5
(print i ))
# 0
# 1
# 2
# 3
# 4
# => nil (let [tbl @{:a 1 }]
(merge-into tbl {:b 2 })
tbl )
# => @{:a 1 :b 2}
# real-world example: https://git.sr.ht/~subsetpark/bagatto/tree/19aea03fe23fe5486890912df7dc4a936ce617a3/item/main.janet#L23
(cmp 0.0 0 )
# => 0
(some odd? [2 4 6 8 10 ])
# =>
nil
# note that 'not' works as an implementation of 'falsey?'
(map not [ nil false true 0 1 'a :a "a" [] {} (fn []) ])
# => @[ true true false false false false false false false false false ]
(map truthy? [ nil false true 0 1 'a :a "a" [] {} (fn []) ])
# => @[ false false true true true true true true true true true ]
(drop-until |(> $ 8 )
[1 1 2 3 4 5 8 13 21 ])
# => '(13 21)
(inc 42 ) # => 43
(map inc [1 2 3 ]) # => @[2 3 4]
(keyword/slice "some crazy keyword" 11 -1 )
# returns :keyword (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 ]