JanetDocsI'm feeling luckyGithub sign in

->



    macro
    boot.janet on line 1048, column 1

    (-> x & forms)
    
    Threading macro. Inserts x as the second 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.


3 examplesSign in to add an example
Loading...
(->  1 (< 2))   # -> true
(->> 1 (< 2))   # -> false
cellularmitosis
(-> 1 (+ 2) (+ 3))  # -> 6
cellularmitosis
(defn inc [x] (+ x 1))
(defn inv [x] (* x -1))
(defn sq  [x] (* x x))

(-> 2 inc)             # -> 3
(-> 2 inc inc)         # -> 4
(-> 2 inc inc inv)     # -> -4
(-> 2 inc inc inv sq)  # -> 16
cellularmitosis