Falcon (programming Language) - Paradigms - Functional

Functional

Falcon has an evaluation engine called Sigma-reductor, which allows programmers to write completely functional programs without the need to use any procedural construct, not differently from what is seen in Lisp. The intermixed programming style allows use of different paradigms (such as OOP or procedural approaches) in functional sequences, or to use functional evaluations during the course of otherwise procedural programs.

Functional sequences are represented by standard language arrays; this means that sequences can be created, inspected and changed dynamically by the program itself, either across different evaluations or during the course of a Sigma-reduction evaluation. The following example does that by changing a special variable reference, called late binding in a list loop.

seq = dolist( function(p); seq.value = p; eval(seq); end, )

Standard arrays can be called as functions if their first member is itself a callable item, as in the following example.

f = f( "Real data to print" )

One-level functional sequences (as in the above example) can be conceptually treated as cached calls, and once assigned to a variable, they are morphologically equivalent to a function symbol.

The functional paradigm includes an out-of-band item marker. Items can receive an oob flag marker which can be tested through language operators and functions and indicate a special meaning for values traveling in functional sequences. For example, many functional loops, as floop and times, can perform loop restarts or can be interrupted by returning either an out-of-band 1 or 0 from any of the involved functions. The map function, transforming all the values in an array through a mapping function, will ignore the returned value (discarding it) if it's an out-of-band nil; in this way, it is possible to perform map-and-filter operations in place.

Read more about this topic:  Falcon (programming Language), Paradigms

Famous quotes containing the word functional:

    Stay-at-home mothers, . . . their self-esteem constantly assaulted, . . . are ever more fervently concerned that their offspring turn out better so they won’t have to stoop to say “I told you so.” Working mothers, . . . their self-esteem corroded by guilt, . . . are praying their kids turn out functional so they can stop being defensive and apologetic and instead assert “See? I did do it all.”
    Melinda M. Marshall (20th century)

    Well designed, fully functional infant. Provides someone to live for as well as another mouth to feed. Produces cooing, gurgling and other adorable sounds. May cause similar behavior in nearby adults. Cries when hungry, sleepy or just because. Hand Wash with warm water and mild soap, then pat dry with soft cloth and talc. Internal mechanisms are self-cleaning... Two Genders: Male. Female. Five Colors: White. Black. Yellow. Red. Camouflage.
    Alfred Gingold, U.S. humorist. Items From Our Catalogue, “Baby,” Avon Books (1982)

    Indigenous to Minnesota, and almost completely ignored by its people, are the stark, unornamented, functional clusters of concrete—Minnesota’s grain elevators. These may be said to express unconsciously all the principles of modernism, being built for use only, with little regard for the tenets of esthetic design.
    —Federal Writers’ Project Of The Wor, U.S. public relief program (1935-1943)