reverse pattern binding order
This commit is contained in:
parent
98305cd6d0
commit
99ce2f75ee
|
@ -15,11 +15,11 @@ It's not meant for real-world use but for educational purposes on writing an int
|
||||||
|
|
||||||
`examples/helloworld.lamb`:
|
`examples/helloworld.lamb`:
|
||||||
|
|
||||||
hello(object) -> object + "!".
|
|
||||||
hello() -> "hello, " + hello("world").
|
hello() -> "hello, " + hello("world").
|
||||||
|
hello(object) -> object + "!".
|
||||||
|
|
||||||
putstrln(hello()).
|
putstrln(hello()).
|
||||||
|
|
||||||
** License **
|
**License**
|
||||||
|
|
||||||
Licensed under the terms of the zlib license. See `LICENSE` for details.
|
Licensed under the terms of the zlib license. See `LICENSE` for details.
|
|
@ -1,4 +1,4 @@
|
||||||
hello(object) -> object + "!".
|
|
||||||
hello() -> "hello, " + hello("world").
|
hello() -> "hello, " + hello("world").
|
||||||
|
hello(object) -> object + "!".
|
||||||
|
|
||||||
putstrln(hello()).
|
putstrln(hello()).
|
|
@ -108,7 +108,7 @@ eval (Defun name fn) = do
|
||||||
Just oldfn -> -- add pattern to old fn
|
Just oldfn -> -- add pattern to old fn
|
||||||
let FnV oldpats = oldfn
|
let FnV oldpats = oldfn
|
||||||
Lambda [(pat, body)] = fn
|
Lambda [(pat, body)] = fn
|
||||||
newfn = FnV ((pat, body):oldpats) in
|
newfn = FnV (oldpats ++ [(pat, body)]) in
|
||||||
put (s, bind env name newfn) >> return newfn
|
put (s, bind env name newfn) >> return newfn
|
||||||
|
|
||||||
eval (Def name v') = do
|
eval (Def name v') = do
|
||||||
|
|
Loading…
Reference in New Issue