From d7fbde238c596c3f7cbc5471a0efb32481bdf6b8 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Wed, 23 Jan 2013 01:56:25 +0100 Subject: Thinner scope handling when necessary Functions without own scope don't unneccesary save the current scope. This makes < > possible. Also: dearray implemented --- examples/working-compiler/arraycat.test | 1 + examples/working-compiler/concat.test | 1 + examples/working-compiler/each.test | 1 + examples/working-compiler/fib.test | 1 + examples/working-compiler/fold.test | 1 + examples/working-compiler/hash-set.test | 1 + examples/working-compiler/scope.test | 1 + examples/working/each.ey | 4 +++- examples/working/fold.ey | 8 +++++--- examples/working/hash-set.ey | 8 ++++---- 10 files changed, 19 insertions(+), 8 deletions(-) create mode 120000 examples/working-compiler/arraycat.test create mode 120000 examples/working-compiler/concat.test create mode 120000 examples/working-compiler/each.test create mode 120000 examples/working-compiler/fib.test create mode 120000 examples/working-compiler/fold.test create mode 120000 examples/working-compiler/hash-set.test create mode 120000 examples/working-compiler/scope.test (limited to 'examples') diff --git a/examples/working-compiler/arraycat.test b/examples/working-compiler/arraycat.test new file mode 120000 index 0000000..250dcdd --- /dev/null +++ b/examples/working-compiler/arraycat.test @@ -0,0 +1 @@ +../working/arraycat.ey \ No newline at end of file diff --git a/examples/working-compiler/concat.test b/examples/working-compiler/concat.test new file mode 120000 index 0000000..b65356c --- /dev/null +++ b/examples/working-compiler/concat.test @@ -0,0 +1 @@ +../working/concat.ey \ No newline at end of file diff --git a/examples/working-compiler/each.test b/examples/working-compiler/each.test new file mode 120000 index 0000000..95ed5d2 --- /dev/null +++ b/examples/working-compiler/each.test @@ -0,0 +1 @@ +../working/each.ey \ No newline at end of file diff --git a/examples/working-compiler/fib.test b/examples/working-compiler/fib.test new file mode 120000 index 0000000..f4d924e --- /dev/null +++ b/examples/working-compiler/fib.test @@ -0,0 +1 @@ +../working/fib.ey \ No newline at end of file diff --git a/examples/working-compiler/fold.test b/examples/working-compiler/fold.test new file mode 120000 index 0000000..13cc7fd --- /dev/null +++ b/examples/working-compiler/fold.test @@ -0,0 +1 @@ +../working/fold.ey \ No newline at end of file diff --git a/examples/working-compiler/hash-set.test b/examples/working-compiler/hash-set.test new file mode 120000 index 0000000..0efdd80 --- /dev/null +++ b/examples/working-compiler/hash-set.test @@ -0,0 +1 @@ +../working/hash-set.ey \ No newline at end of file diff --git a/examples/working-compiler/scope.test b/examples/working-compiler/scope.test new file mode 120000 index 0000000..3fc0fb0 --- /dev/null +++ b/examples/working-compiler/scope.test @@ -0,0 +1 @@ +../working/scope.ey \ No newline at end of file diff --git a/examples/working/each.ey b/examples/working/each.ey index 0e59bc9..54b0323 100644 --- a/examples/working/each.ey +++ b/examples/working/each.ey @@ -1 +1,3 @@ -[ 1 2 3 ] { =i i dump } each +|defv "==" deff + +[ 1 2 3 ] { ==i i dump } each diff --git a/examples/working/fold.ey b/examples/working/fold.ey index 9ae19d5..d3b20ce 100644 --- a/examples/working/fold.ey +++ b/examples/working/fold.ey @@ -1,4 +1,6 @@ -{ =f =a a len =l +|defv "==" deff + +{ ==f ==a a len ==l l { 0 a * 1 l 1 sub range { a * f * } each @@ -6,9 +8,9 @@ ? * } /fold deff -{ =f _ len =l l dearray l 1 sub f rep } /foldshort deff +{ ==f _ len ==l l dearray l 1 sub f rep } /foldshort deff -{ =f { f fold } } /enfold deff +{ ==f { f fold } } /enfold deff [ 1 2 3 ] _ |add fold dump diff --git a/examples/working/hash-set.ey b/examples/working/hash-set.ey index 495c27f..046e42b 100644 --- a/examples/working/hash-set.ey +++ b/examples/working/hash-set.ey @@ -1,4 +1,4 @@ -< { defv }' /put deff > =hashSet +< { defv }' /put deff > /hashSet defv 1 /one hashSet .put 2 /two hashSet .put @@ -8,12 +8,12 @@ hashSet .two dump hashSet keys dump { - < { defv }' /put deff > =hashSetB + < { defv }' /put deff > /hashSetB defv 1 /one hashSetB .put 2 /two hashSetB .put hashSetB .one dump hashSetB .two dump - hashSetB keys dump -} * + hashSetB +} * keys dump -- cgit v1.2.3