JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

short-fn

core-api


    macro
    boot.janet on line 2346, column 1

    (short-fn arg &opt name)

    Shorthand for `fn`. Arguments are given as `$n`, where `n` is the 
    0-indexed argument of the function. `$` is also an alias for the 
    first (index 0) argument. The `$&` symbol will make the anonymous 
    function variadic if it appears in the body of the function, and 
    can be combined with positional arguments.


1 exampleSign in to add an example
Loading...
(map  (fn [x] (< x 10))    [8 9 10 11])  # => @[true true false false]
(map  (short-fn (< $ 10))  [8 9 10 11])  # => @[true true false false]
(map  |(< $ 10)            [8 9 10 11])  # => @[true true false false]
cellularmitosisPlayground