Skip to content
another javascript functional library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


<!doctype html>
<html lang="en">
        <title>LambdaScript 2.0</title>
        <meta charset="UTF-8">
        <h1>LambdaScript ${pom.version}</h1>

            LambaScript is intended to be a practical functional
            library rather than elegant, beautiful or minimal one.

        <p>Version 2 is not backward compatible with version 1.0:</p>
            <li>don't build NullIterator when argument is null or undefined</li>
            <li>type(object) == 'array' renamed to isArray()</li>
            <li>toArray now is a function, not a method of Iterable</li>
            <li>consistent naming</li>
            <li>using jasmine for testing</li>


&lt;script language="text/javascript" src="lambdascript.js"&gt;&lt;/script&gt;

&lt;script language="text/javascript"&gt;

    map([1, 2, 3], lambda('a*a')) // [1, 4, 9]

    // filter 
    filter([-3, 4, 5, -6, -42], lambda('a>0')) // [4, 5] 

    // reduce
    function sum() {
       return reduce(arguments, lambda('a+b'));

    sum(1,2,3)  // 6

    // factorial
    function fact(n) {
      return reduce(range(n), lambda('a*b'));

    fact(5) // 120

    // curry
    var mul = lambda('a*b');
    var mul_by2 = curry(mul, 2);
    var mul_by3 = curry(mul, 3);
    mul_by2(21) // 42
    mul_by3(14) // 42

    // range
    range(3)           // [1, 2, 3] 
    range(5, 7)       // [5, 6, 7]
    range(1, 10, 2) // [1, 3, 5, 7, 9]

        <h2>Build documentation</h2>
        In order to build documentation:
$ mvn jsdoctk:jsdoc

        <h2>See also</h2>
                <a href="">On Javascript
                    by Crockford</a>
                <a href="">High
                    Order JavaScript</a>
            <li>clojure, in particular
                <a href="">core API</a>
                <a href="">Dollar</a>
                <a href="">Functional Javascript</a>
                <a href="">underscore</a></li>
                <a href="">LambdaScript</a>


        <p>My personal wishlist:</p>

            <li>custom parameters names such as lambda("x,y: x + y") or just detect them</li>
            <li>parameterless lambda
                (see <a href="">Erlang
                    string lambdas</a>)</li>
            <li>pipe(function1, function2, ...) (like -> macro in clojure)</li>
            <li>map(fn, iterable1, iterable2, ...iterableN)</li>
            <li>repeat(fn, n) // repeat a function n times</li>
            <li>union(iterable1, iterable2, ...iterableN)</li>
            <li>intersect(iterable1, iterable2 ... iterableN)</li>
            <li>concat(iterable1, iterable2, ...iterableN)</li>
            <li>join(iterable, [sep])</li>
            <li>interpose(iterable1, value)</li>
You can’t perform that action at this time.