Category:Lambdatalk
This programming language may be used to instruct a computer to perform a task.
See Also: |
|
---|
The {lambda way} project is a web application built on two engines:
1) {lambda tank}, a tiny wiki built as a thin overlay on top of any web browser,
2) {lambda talk}, a purely functional language unifying authoring, styling and scripting in a single and coherent s-expression based syntax.
A) {lambda talk} in few words
1) Expressions are written in a prefix notation using curly braces.
2) Away from curly braces words are just words.
2+3 is equal to {+ 2 3} -> 2+3 is equal to 5
• 3) Functions are created with lambda and named with def.
{def foo {lambda {:a :b} :a+:b is equal to {+ :a :b}}} -> foo {foo 2 3} -> 2+3 is equal to 5
B) {lambda talk}'s foundations
{lambda talk} is freely inspired by the λ-calculus. At the lowest level a {lambda talk} expression is exclusively made of words, abstractions and applications:
expression is [word|abstraction|application]* where 1) word is [^\s{}]* -> word 2) abstraction is {lambda {words} expression} -> word 3) application is {expression expression} -> words
1) a word is any character except spaces and curly braces, and is not evaluated out of curly braces,
2) an abstraction is a special form (called a function) selecting words (called arguments) in an expression (called the body), and is evaluated to a word referencing an anonymous function added to a single dictionary, initially empty,
3) an application is a simple form calling an abstraction to replace selected words by some other words (called values), and is evaluated to words.
The evaluation stops when all expressions have been replaced by words.
Implementation
{lambda talk} is not implemented following the standard process, code -> tokens -> tree -> eval. The code is a string from beginning to end. At each keyboard input, the code is processed by a single function, do_eval(), which returns words sent to the browser for the final evaluation and display.
var do_eval = function( code ) { code = pre_processing( code ); code = eval_lambdas( code ); // {lambda {args} body} code = eval_defs( code ); // {def name body} code = eval_forms( code ); // {a {b {c ...}}} code = post_processing( code ); return code };
Using a single regular expression the eval_forms() function loops over the code string, skips the words out of curly braces, matches nested forms {first rest} from inside out, and replaces them by words. The repeated substitutions inside the code string overcomes limitations of regular language. It's a kind of Turing machine.
The eval_lambdas() function uses arguments as Regular Expressions to successively replace occurences found in the function's body by the given values. Lambdas have the following properties:
- lambdas are first class functions, they can be called as functions' arguments and returned from functions,
- lambdas are pure black boxes, they don't create closures and are context free, inner lambdas don't see outer functions' arguments, there are no lexical scoping, no free variables,
- lambdas accept de facto partial function application: called with a number of values lesser than its arity, a lambda memorizes the given values and returns a new lambda waiting for the rest.
B) {lambda talk} full
In its complete state, {lambda talk} comes with more special forms, [lambda, def, if, let, quote, macro, require, script, style], and a dictionary containing about 200 primitives built on Javascript Math object, the DOM, HTML tags and CSS rules and more, pairs, lists, arrays, ...
As a dwarf standing on their shoulders, {lambda talk} takes benefit from the extraordinary power of modern web browsers. It does not re-invent the wheel and simply adds a coherent and unique language on existing tools.
The {lambda way} project adds on browsers a thin overlay, {lambda tank}, proposing a small "Interactive Development Environment" without any external dependencies and thereby easy to download and install on any web account provider running PHP.
From any web browser, on any system, complex and dynamic web pages can be created, enriched, structured and tested in real time on the web.
A full presentation of {lambda talk} can be seen in:
- http://lambdaway.free.fr/ - http://lambdaway.free.fr/workshop/?view=about - http://lambdaway.free.fr/workshop/?view=oxford_slides - and several other pages of the workshop.
Pages in category "Lambdatalk"
The following 200 pages are in this category, out of 265 total.
(previous page) (next page)A
- A+B
- Accumulator factory
- Ackermann function
- Additive primes
- Address of a variable
- AKS test for primes
- Align columns
- Anonymous recursion
- Anti-primes
- Append numbers at same position in strings
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Archimedean spiral
- Arithmetic-geometric mean
- Arithmetic/Complex
- Arithmetic/Integer
- Array concatenation
- Array length
- Arrays
- Associative array/Creation
- Averages/Arithmetic mean
- Averages/Median
- Averages/Root mean square
B
C
- Caesar cipher
- Calculating the value of e
- Call a function
- Call a function in a shared library
- Camel case and snake case
- Catalan numbers
- Catamorphism
- Church numerals
- Circles of given radius through two points
- Closures/Value capture
- Combinations
- Comments
- Common list elements
- Compare a list of strings
- Compare length of two strings
- Compound data type
- Conditional structures
- Constrained random points on a circle
- Continued fraction
- Conway's Game of Life
- Copy a string
- Count occurrences of a substring
- Create an HTML table
- CSV to HTML translation
- Currying
- Curve that touches three points
- Curzon numbers
D
E
F
- Factorial
- Factorions
- Factors of an integer
- Fast Fourier transform
- Feigenbaum constant calculation
- Fibonacci sequence
- Filter
- Find the intersection of two lines
- Find words whose first and last three letters are equal
- First-class functions
- FizzBuzz
- Flatten a list
- Formatted numeric output
- Forward difference
- Four bit adder
- Fractal tree
- Function composition
- Function definition
G
H
I
L
- Left factorials
- Letter frequency
- Logical operations
- Long multiplication
- Longest common substring
- Longest string challenge
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Increment loop index within loop body
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While