-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(!! lib syn) Use brackets-based cPaws
We're ahead-of-spec here (and therefore spec-incompliant, I suppose, heh.) This doesn't bother me, as a change from braces to brackets is basically a given at this point. It'll probably be snuck into the next release of the specification.
- Loading branch information
1 parent
f639de0
commit 58fa5d8
Showing
11 changed files
with
113 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/usr/bin/env paws.js --no-start | ||
implementation void() | ||
implementation void[] | ||
|
||
-- Let's try an unnecessarily complex approach to printing something. We'll save it into the data- | ||
graph, and then read it back out to print it: | ||
|
||
( infrastructure execution stage() | ||
(infrastructure affix() (locals)) Hi! ) | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] [locals]] Hi! ] | ||
|
||
( infrastructure execution stage() | ||
(implementation console inspect) (infrastructure unaffix() (locals)) ) | ||
[ infrastructure execution stage[] | ||
[implementation console inspect] [infrastructure unaffix[] [locals]] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#!/usr/bin/env paws.js --no-start | ||
implementation void() | ||
implementation void[] | ||
|
||
-- It's useful to store state, right? Here we'll create a new name for something, by storing it in | ||
an assignment-pair on `locals`. | ||
|
||
( infrastructure execution stage() | ||
(infrastructure affix() (locals)) | ||
(infrastructure empty()) ) | ||
( infrastructure execution stage() | ||
(infrastructure own() (locals)) | ||
(infrastructure length() (locals)) ) | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] [locals]] | ||
[infrastructure empty[]] ] | ||
[ infrastructure execution stage[] | ||
[infrastructure own[] [locals]] | ||
[infrastructure length[] [locals]] ] | ||
|
||
( infrastructure execution stage() | ||
(infrastructure affix() | ||
(infrastructure get() (locals) (infrastructure length() (locals)))) | ||
# ) | ||
( infrastructure execution stage() | ||
(infrastructure affix() | ||
(infrastructure get() (locals) (infrastructure length() (locals)))) | ||
(infrastructure) ) | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] | ||
[infrastructure get[] [locals] [infrastructure length[] [locals]]]] | ||
# ] | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] | ||
[infrastructure get[] [locals] [infrastructure length[] [locals]]]] | ||
[infrastructure] ] | ||
|
||
( # execution stage() | ||
(implementation console print) Go!.PAWS! ) | ||
[ # execution stage[] | ||
[implementation console print] Go!.PAWS! ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,93 @@ | ||
#!/usr/bin/env paws.js --no-start | ||
implementation void() | ||
implementation void[] | ||
|
||
-- Let's combine some of our examples so far, and put them towards the task of creating a new | ||
procedure of code that we can call by its name. | ||
|
||
|
||
-- First, we'll provide a short-name to reference `infrastructure`, to abbreviate our code, | ||
( infrastructure execution stage() | ||
(infrastructure affix() (locals) ) | ||
(infrastructure empty() ) ) | ||
( infrastructure execution stage() | ||
(infrastructure own() (locals) ) | ||
(infrastructure length() (locals) ) ) | ||
|
||
( infrastructure execution stage() | ||
(infrastructure affix() | ||
(infrastructure get() (locals) (infrastructure length() (locals))) ) | ||
# ) | ||
( infrastructure execution stage() | ||
(infrastructure affix() | ||
(infrastructure get() (locals) (infrastructure length() (locals))) ) | ||
(infrastructure) ) | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] [locals] ] | ||
[infrastructure empty[] ] ] | ||
[ infrastructure execution stage[] | ||
[infrastructure own[] [locals] ] | ||
[infrastructure length[] [locals] ] ] | ||
|
||
[ infrastructure execution stage[] | ||
[infrastructure affix[] | ||
[infrastructure get[] [locals] [infrastructure length[] [locals]]] ] | ||
# ] | ||
[ infrastructure execution stage[] | ||
[infrastructure affix[] | ||
[infrastructure get[] [locals] [infrastructure length[] [locals]]] ] | ||
[infrastructure] ] | ||
|
||
|
||
-- Next, we store our actual routine in the `locals`. | ||
( # execution stage() (# affix() (locals)) (# empty()) ) | ||
( # execution stage() (# own() (locals)) (# length() (locals)) ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
my.routine ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
{ implementation console print Phew,that.worked. } ) | ||
[ # execution stage[] [# affix[] [locals]] [# empty[]] ] | ||
[ # execution stage[] [# own[] [locals]] [# length[] [locals]] ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
my.routine ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
{ implementation console print Phew,that.worked. } ] | ||
|
||
|
||
-- Next, we want to access the `my.routine locals`, but we can't get that by combining, because | ||
the combination-receiver for `execution`s would *stage* it. Instead, we're going to extract the | ||
`thing` receiver, and manually invoke it with a receiver-parameters object. | ||
|
||
-- So here, we construct a parameters object to get a reference to `locals` out of the receiver: | ||
( # execution stage() (# affix() (locals)) (# empty()) ) | ||
( # execution stage() (# own() (locals)) (# length() (locals)) ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
parameters ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
(# empty()) ) | ||
|
||
( # execution stage() (# set() (parameters) 1)() ) | ||
( # execution stage() (# set() (parameters) 2)(my.routine) ) | ||
( # execution stage() (# set() (parameters) 3)locals ) | ||
[ # execution stage[] [# affix[] [locals]] [# empty[]] ] | ||
[ # execution stage[] [# own[] [locals]] [# length[] [locals]] ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
parameters ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
[# empty[]] ] | ||
|
||
[ # execution stage[] [# set[] [parameters] 1][] ] | ||
[ # execution stage[] [# set[] [parameters] 2][my.routine] ] | ||
[ # execution stage[] [# set[] [parameters] 3]locals ] | ||
|
||
|
||
-- Now we get an arbitrary `thing`'s receiver, and invoke it with our parameters. | ||
( # execution stage() (# affix() (locals)) (# empty()) ) | ||
( # execution stage() (# own() (locals)) (# length() (locals)) ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
my.locals ) | ||
( # execution stage() | ||
(# affix() (# get() (locals) (# length() (locals))) ) | ||
(# receiver() (# empty()) | ||
(parameters) ) ) | ||
[ # execution stage[] [# affix[] [locals]] [# empty[]] ] | ||
[ # execution stage[] [# own[] [locals]] [# length[] [locals]] ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
my.locals ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [locals] [# length[] [locals]]] ] | ||
[# receiver[] [# empty[]] | ||
[parameters] ] ] | ||
|
||
|
||
-- Finally, the reason for all that madness: we need to get `implementation` and `infrastructure` | ||
into our routine's `locals`, since they're only injected into our environment at this root level. | ||
( # execution stage() (# affix() (my.locals)) (# empty()) ) | ||
( # execution stage() (# own() (my.locals)) (# length() (my.locals)) ) | ||
( # execution stage() | ||
(# affix() (# get() (my.locals) (# length() (my.locals))) ) | ||
infrastructure ) | ||
( # execution stage() | ||
(# affix() (# get() (my.locals) (# length() (my.locals))) ) | ||
(infrastructure) ) | ||
[ # execution stage[] [# affix[] [my.locals]] [# empty[]] ] | ||
[ # execution stage[] [# own[] [my.locals]] [# length[] [my.locals]] ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [my.locals] [# length[] [my.locals]]] ] | ||
infrastructure ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [my.locals] [# length[] [my.locals]]] ] | ||
[infrastructure] ] | ||
|
||
( # execution stage() (# affix() (my.locals)) (# empty()) ) | ||
( # execution stage() (# own() (my.locals)) (# length() (my.locals)) ) | ||
( # execution stage() | ||
(# affix() (# get() (my.locals) (# length() (my.locals))) ) | ||
implementation ) | ||
( # execution stage() | ||
(# affix() (# get() (my.locals) (# length() (my.locals))) ) | ||
(implementation) ) | ||
[ # execution stage[] [# affix[] [my.locals]] [# empty[]] ] | ||
[ # execution stage[] [# own[] [my.locals]] [# length[] [my.locals]] ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [my.locals] [# length[] [my.locals]]] ] | ||
implementation ] | ||
[ # execution stage[] | ||
[# affix[] [# get[] [my.locals] [# length[] [my.locals]]] ] | ||
[implementation] ] | ||
|
||
|
||
-- And now, the reveal: | ||
|
||
( # execution stage() (my.routine)() ) | ||
[ # execution stage[] [my.routine][] ] | ||
|
||
-- Yay! <3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule primitives
updated
from 9df3b0 to 9367d5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.