LingoF is a Functional Programming Framework for Lingo.
Basically it allows you to use Functions as Values.

This Framework allows the Lingo developer to exploit all benefits from Functional Programming techniques to reach a higher abstraction level.

Director MX 2004 incorporated Javascript and it’s an interesting option to write scripts for Director using FP techniques, but there are many programmers that still prefer Lingo as Director language due to different reasons (previous knowledge, not enough documentation and available samples in JS, etc).

LingoF presents a Lingo extension as an alternative to Javascript to write code in a more functional way or to add some functional techniques mixed with Procedural/OOP code.

The framework is fully implemented in Lingo, no xtra required. It allows to define function values from Lingo expressions, Lambda expressions and Handlers.

Take a look at this code:

f = fun("x,y : y mod x = 0")
put f[2][5]
-- 0
put f[2][6]
-- 1
$ = LingoF().Open(#Lists)
put $.filter [ f[2] ]  [ [1,2,3,4,5,6,7,8] ]
-- [2, 4, 6, 8]

put $.filter [ f[3] ]  [ [1,2,3,4,5,6,7,8] ]
-- [3, 6]

The above code is written in Lingo. You just need to have all LingoF scripts somewhere in your Movie.
Different LingoF features can be recognized:

- Lingo Expressions

f = fun("x,y : y mod x = 0")

- Function Modules

$ = LingoF().Open(#Lists)

- Currying

... f[2] ...

Leave a Reply

Security Code: