@lambdulus/core
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

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: a or b in 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 abc then it is understood like a 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: ZERO or PREV and 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 0 is valid SLI expression utilising Macro ZERO.

    On the other hand expression ZEROZERO 0 is not understood as ZERO ZERO 0 but as Z E R O Z E R O 0.

    Same goes for expressions as ZERO1ZERO2 0. It is understood as Z E R O1 Z E R O2 0.

    Finally expressions as ZERO12ZERO 0 would be understood as Z 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.

Package Sidebar

Install

npm i @lambdulus/core

Weekly Downloads

10

Version

0.0.8

License

MIT

Unpacked Size

243 kB

Total Files

145

Last publish

Collaborators

  • lambdulus