macro
boot.janet on line 1250, column 1
(->> x & forms)
Threading macro. Inserts x as the last value in the first form in
`forms`, and inserts the modified first form into the second form
in the same manner, and so on. Useful for expressing pipelines of
data.
# wrap short-fn / |
(->> 10
(|(/ $ 2)))
# =>
5
# also wrap fn
(->> 10
((fn [n] (/ n 2))))
# =>
5
(->> "X"
(string "a" "b")
(string "c" "d")
(string "e" "f")) # => "efcdabX"
(->>
(string/split " " "this is an example yes, an example")
(filter (complement empty?))
(frequencies))
# -> @{"is" 1 "example" 2 "yes," 1 "an" 2 "this" 1}
# same as:
(frequencies
(filter
(complement empty?)
(string/split " " "this is an example yes, an example")))
(-> 1 (< 2)) # -> true
(->> 1 (< 2)) # -> false