Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(peg/find-all ~(capture (range "09" ))
"hi 0 bye 1" )
# => @[3 9] (os/lstat "t.janet" )
# @{:size 249 :permissions "rw-r--r--" :nlink 1 :blocks 8 :dev 16777221 :accessed 1606236760 :modified 1606236759 :uid 501 :mode :file :blocksize 4096 :changed 1606236759 :inode 14801850 :rdev 0 :int-permissions 420 :gid 501}
(get (os/lstat "t.janet" ) :size ) # 249 (sorted-by > @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(sorted-by < @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(sorted-by = @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(math/hypot 1 1 ) # => 1.41421
(math/sqrt 2 ) # => 1.41421
(last [1 1 2 3 5 8 ])
# => 8
# nested iteration
(loop [a :in [100 200 300 ]
b :in [1 2 3 ]]
(print (+ a b )))
# 101
# 102
# 103
# 201
# 202
# 203
# 301
# 302
# 303 (varglobal "smile" false )
# => nil
smile
# => false
(set smile true )
# => smile
smile
# => true
(dyn 'smile )
# => @{:ref @[true]}
(def a @[])
(array/insert a 1 :a ) # error: index out of range
(array/insert a -2 :a ) # error: index out of range
(in :yo 0 )
# => 121
(dyn :pretty-format )
# => "%.20Q" (def request {:params {:id 1 }}) # => {:params {:id 1}}
(get-in request [:params :id ]) # => 1
(get-in request [:params :name ]) # => nil
(get-in request [:params :name ] "N/A" ) # => "N/A" (def record @{:recipient @{:name "Bob" :age 60 } :sender @{:name "Alice" :age 21 }})
(put-in
record
[:sender :age ]
26 )
# @{:recipient @{:name "Bob" :age 60} :sender @{:name "Alice" :age 26}}
(put-in
record
[:recipient ]
@{:name "Carl" })
# @{:recipient @{:name "Carl"} :sender @{:name "Alice" :age 26}} (def h ["a" "b" :c ]) # => ("a" "b" :c)
(find (fn [a ] (= "a" a )) h ) # => "a" (var a 2 )
a # => 2
(dec a ) # => 1
a # => 2
(-- a ) # => 1
a # => 1
(tuple 1 2.3 :a "foo" true nil [] {} (fn []))
# => (1 2.3 :a "foo" true nil () {} <function 0x7FB2A3D030B0>)