JanetDocsI'm feeling luckyGithub sign in

comp



    function
    boot.janet on line 652, column 1

    (comp & functions)
    
    Takes multiple functions and returns a function that is the
    composition of those functions.


1 exampleSign in to add an example
Loading...
(defn square [x] (* x x))
(defn square-then-dec [x] ((comp dec square) x))
(defn dec-then-square [x] ((comp square dec) x))
(square-then-dec 3)  # => 8
(dec-then-square 3)  # => 4
cellularmitosis