aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2015-06-30 12:45:10 +0200
committerDrahflow <drahflow@gmx.de>2015-06-30 12:45:10 +0200
commit7d3be125147c4012299279703491f3cad5822765 (patch)
tree440f4cd7b0049153088d902fedff610b6f6d2ad9 /doc
parent40c991c7d7c8d40336208357a83686c883d42f34 (diff)
Updated documentation on ' and #. and friends
Diffstat (limited to 'doc')
-rw-r--r--doc/execution.md37
-rw-r--r--doc/scopes.md21
2 files changed, 56 insertions, 2 deletions
diff --git a/doc/execution.md b/doc/execution.md
index 317a945..98905fe 100644
--- a/doc/execution.md
+++ b/doc/execution.md
@@ -197,8 +197,41 @@ function object is created.
0000000000000006
0000000000000008
]
-
-(FIXME: There will be a `'` function soonish, which will abbreviate the common cases of `''` for scalar functions.)
+
+To make everything shorter in the common cases, the two functions `'` and `'*` exist as a convenience.
+`'` takes a string of digits a dot, which specifies input and output argument types, and a function, and
+invokes `''` appropriately. Digits before the dot become integers in the input argument array, those after
+the dot go into the output array. Finally `'*` also executes the resulting function right away.
+
+ [ 1 2 3 4 5 6 ] { dump 5 } '*0.0 dump
+ 0000000000000001
+ 0000000000000002
+ 0000000000000003
+ 0000000000000004
+ 0000000000000005
+ 0000000000000006
+ [
+ 0000000000000005
+ 0000000000000005
+ 0000000000000005
+ 0000000000000005
+ 0000000000000005
+ 0000000000000005
+ ]
+ [ 1 2 3 4 5 6 ]
+ { 1 add } '0.0
+ { 1 sub } '0.0
+ mul * txt .produce .u dump
+ [
+ "0"
+ "3"
+ "8"
+ "15"
+ "24"
+ "35"
+ ]
+
+
(FIXME: A lot of the more interesting cases don't work, yet. Many a SIGSEGV will have to be removed before this is as
epic as it should be.)
diff --git a/doc/scopes.md b/doc/scopes.md
index 279c7e3..5627b4e 100644
--- a/doc/scopes.md
+++ b/doc/scopes.md
@@ -106,3 +106,24 @@ achieved by the `>'` function. It behaves like `>` but takes the parent pointer
As `>'` only assigns the parent pointer when the scope stops being the current scope, before its execution the parent
was set as usual, i.e. the current scope before `<`. This allows for interesting possibilities. Note that names in
quoted mode are only resolved during first execution.
+
+
+Missing members
+---------------
+
+If a scope member is accessed, which is not available, the program will call `die` and be dead. Unless, that is,
+that the scope happens to have `#.`, `#.|`, or `#.=` defined, which are used to dynamically handle missing members
+on `.` (or quoted identifiers), on `|` and on `=` respectively. To fully fake missing members, there also exists the
+possibility to declare `#.?` which will be invoked by `.?` when the member does not exist.
+
+ <
+ { ==memberName "#. called with: " memberName cat dump } "#." deffd
+ { ==memberName "#.| called with: " memberName cat dump } "#.|" deffd
+ { ==memberName "#.? called with: " memberName cat dump } "#.?" deffd
+ { ==memberName ==value "#.= called with: " memberName cat dump value dump } "#.=" deffd
+ > ==s
+ s .hello_world
+ "#. called with: hello_world"
+ < { "value" =random_name } s >' -- *
+ "#.= called with: random_name"
+ "value"