@lambdulus/core v0.0.8
This is Core module of project Lambdulus
Documentation of some features (will be growing with time)
SLI - Single Letter Identifiers
Lambdulus allows shorthand syntax for quicker typing. It looks for example like this:
(λ x y z . y z x).
This is known as MultiLambda. This convention is purely syntactic sugar. It is simplification for:
(λ x . (λ y . (λ z . (y z x) ))).
Hovewer this example can be written in even shorter way. With SLI enabled we can write it like:
(λxyz.yzx)
It means the same thing - this whitespace-omitting practice originated from the times teachers and students of PPA used to write on white-boards.
On the white-board there is no simple way to properly write whitespaces - so we used to omit them altogether.
SLI - Rules:
identifier in SLI mode can be :
- single alphabetic character like:
aorbin following expression:+ a b - it can also be single character followed be single numeric literal like
c2 - it can be sequence of alphabetic characters - like
abcthen it is understood likea b c - it can also be sequence of alphanumeric characters -
in that case each numeric character must be preceeded by at least one alphabetic character
and there must not be more than one numeric character standing immediately next to other -
example of valid expression:
A1BB2C3DDD- it is understood as:A1 B B2 C3 D D D
Hovewer, Lambdulus also implements Macros - known abstractions. They are typically named with all upper-case letters. Like:
ZEROorPREVand so on. These are also available in SLI mode.To succesfully use multi-char Macros in SLI mode they must be followed by whitespace. For example:
ZERO 0is valid SLI expression utilising MacroZERO.On the other hand expression
ZEROZERO 0is not understood asZERO ZERO 0but asZ E R O Z E R O 0.Same goes for expressions as
ZERO1ZERO2 0. It is understood asZ E R O1 Z E R O2 0.Finally expressions as
ZERO12ZERO 0would be understood asZ E R O12 Z E R O 0- which is syntacticaly incorrect - because of two numeric characters following letter O. This will result in syntax error.- single alphabetic character like: