Implement Meta Lambda Calculus (MLC)
- Dominant language
- Haskell
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## apply
```
# apply combinator create one local variable/function/definition
#\x \f f x @ &
@ apply \x \f f x
@ ! apply
@ & apply
@ |> apply
```
```scheme
& (lambda) ( \ function
do something
)
```
```
! (lambda1) \ function1 \
! (lambda2) \ function2 \
```
---
## Lambdas and Let
```
someLambda1 (\ param1 someLambda2 (\ param2 someLambda3 (\ param3 param1 param2 param3)))
```
```
someLambda1 (\ param1
someLambda2 (\ param2
someLambda3 (\ param3
param1 param2 param3
)
)
)
```
```
someLambda1 \ param1 \
someLambda2 \ param2 \
someLambda3 \ param3 \
param1 param2 param3
```
so maybe:
```
someLambda1 @ name1
\ param1 body1 @ name1
```
or:
```
someLambda1 : name1
\ param1 body1 : name1
```
Maybe it is too crazy?
---
* `@` - define and special word
* `#` - comment
* `:` - block
* `;` - many instruction in one line
---
* define-macro
* define-combinator
* define-syntax-rule
* define-syntax
* https://justinethier.github.io/husk-scheme//2012/12/10/Understanding-Macros.html
* https://3e8.org/pub/pdf-t1/macros_that_work.pdf
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.5184
* http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.5184&rep=rep1&type=pdf
* For this project:
* Add Meta Lambda Calculus is superset for Lazy K
* Add `guard` expression
* Add `case` expression
* Add Symbolic Lambda Calculus is superset for Lazy K
* Translate MLC to SLC
* Add `let` expression
* For other project:
* Build dynamic typed version
* Build static typed version
* Compile SLC to eager version (Brilliant Language)
* Add `do` expression (`seq` expression?).
* Add `match` expression.
## About expression
* `abs` (`\` symbol) is abstraction.
* `if` (`?` symbol).
* `guard` (`|` symbol) is *or line*. It is sugar for `if`.
* `guard K` (`|K` symbol, guard constants). It Is hack.
* `guard is` (`|=` symbol, guard equals, case).
* `guard in` (guard belongs to, case list).
* `let` (`&` symbol) is *and line*. It is sugar for `abs`. Real sugar. Maybe we need macros?
## Example expressions
```
: function ! param1 ! param2 result
: variable ? condition expression1 expression2
; guard is predicate
| guard1 result1
| guard2 result2
default result
expression
; It is sugar for:
? (guard1 expression) result1
? (guard2 expression) result2
result
; it is possible do define `|` as function
: | ! guard ! body ! tail ! expression ? (guard expression) body (tail expression)
: default ! body ! expression body; It is true
& id1 init1
& id2 init2
expression
; It is sugar for:
! variable1 ! variable2 expression init1 init2
```
## Issue with breaking line
* Can we break lines?
* How we should break lines?
* Special character on end line or brackets?
* Braces?
* Indentation?
* Tabs?
## Example break lines
```
: function \
\ param1
\ param2
result
: variable \
? condition
result1
result2
: variable \
| guard1 result1
| guard2 result2
default result
expression
: variable \
? (guard1 expression) result1
? (guard2 expression) result2
result
: variable \
& id1 init1
& id2 init2
result
: variable \
\ id1
\ id2
result
init1
init2
```
```
a b c; => (a b) c ; => default order
a ` b c; => a (b c) => reverted order
! s v o; => v s o; => object order
o s v; => pipe order
o s v; => stack order
```
Contributor guide
Assessment
This issue has not been assessed yet.