Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(map odd? [1 2 3 4 ]) # => @[true false true false]
(comment
# the content actually has to parse as janet
# this is ok
(+ 1 1 )
# => 2
# if there is something with missing delimiters though...
)(cmp [1 2 ] [1 2 3 ])
# => -1
# Map over multiple structures -- Stops after the shortest is exhausted.
(map (fn [& args ] ;args ) [1 ] [1 2 ] [1 2 3 ])
# => @[(1 1 1)] (def ds @[@{:a 1 :b 2 }
@{:a 8 :b 9 }])
(defn thrice [x ] (* x 3 ))
(update-in ds [0 :b ] thrice )
# `ds` is now
@[@{:a 1 :b 6 }
@{:a 8 :b 9 }](os/time ) # => 1593837535 (map length [ 'a :a "a" [97 ] @[97 ] {0 97 } @{0 97 } ])
# => @[ 1 1 1 1 1 1 1 ]
(tabseq [i :in (range 97 100 )]
i (string/from-bytes i ))
# =>
@{97 "a"
98 "b"
99 "c" }
(trace + )
# <function +>
((trace + ) 5 3 )
# trace (+ 5 3)
# 8
(defn knorkulate [a b ]
((trace + ) a ((trace * ) b b )))
# <function knorkulate>
(knorkulate 2 34 )
# trace (* 34 34)
# trace (+ 2 1156)
# 1158 (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 ]
(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" (def new-bytes 512 )
(var new-buffer (buffer/new new-bytes ))
# --> @"" # :as sets a /
(import /deeper/inside :prefix "" :export true )
# @{_ @{:value <cycle 0>} cat @{:private false}}
(import /deeper/inside :as "" :export true )
# @{/cat @{:private false} _ @{:value <cycle 0>} cat @{:private false}}
(abstract? (file/temp )) # => true
(abstract? (int/s64 1 )) # => true
(map abstract? [ nil true 97 'a :a "a" ])
# => @[false false false false false false]
(map abstract? [ [97 ] @[97 ] {0 97 } @{0 97 } ])
# => @[false false false false]
(map abstract? [ even? loop file/open (fn []) ])
# => @[false false false false]
(map abstract? [ (file/temp ) (fiber/new (fn [])) ])
# => @[true false]
(peg/find-all ':d "Battery temperature: 40 °C" )
# => @[21 22] indices containing digits
# :d (range "09")
# peg grammars are contained in a table @{} (mutable) located in boot.janet source file.