mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-09-29 05:36:52 +02:00
retro.forth [ ... ] to &... for various conditions in the stdlib (reduces memory usage, slightly faster)
FossilOrigin-Name: b4bd81cb7806f62ef87421de5482fec0dfe4adc6267e9100d0f63fb95f250e8f
This commit is contained in:
parent
bfdea0f396
commit
1427fc62bf
3 changed files with 678 additions and 680 deletions
|
@ -476,7 +476,7 @@ Example:
|
|||
:prefix:|
|
||||
d:lookup [ d:xt fetch ] [ d:class fetch ] bi
|
||||
compiling? [ [ class:data ] dip compile:call ]
|
||||
[ call ] choose ; immediate
|
||||
&call choose ; immediate
|
||||
~~~
|
||||
|
||||
## Conditionals
|
||||
|
@ -603,7 +603,7 @@ a bit clearer.
|
|||
|
||||
~~~
|
||||
:v:preserve (aq-)
|
||||
swap dup fetch [ [ call ] dip ] dip swap store ;
|
||||
swap dup fetch [ &call dip ] dip swap store ;
|
||||
~~~
|
||||
|
||||
If you need to update a stored variable there are two typical
|
||||
|
@ -713,7 +713,7 @@ null) and other simple structures.
|
|||
:buffer:size (-n) buffer:end buffer:start - ;
|
||||
:buffer:set (a-) !Buffer buffer:empty ;
|
||||
:buffer:preserve (q-)
|
||||
@Buffer @Ptr [ [ call ] dip !Buffer ] dip !Ptr ;
|
||||
@Buffer @Ptr [ &call dip !Buffer ] dip !Ptr ;
|
||||
}}
|
||||
~~~
|
||||
|
||||
|
@ -1380,7 +1380,7 @@ a `TRUE` flag for.
|
|||
|
||||
~~~
|
||||
:a:filter (aq-)
|
||||
[ over [ call ] dip swap [ , ] [ drop ] choose ] curry
|
||||
[ over &call dip swap &, &drop choose ] curry
|
||||
here [ over fetch , a:for-each ] dip
|
||||
here over - n:dec over store ;
|
||||
~~~
|
||||
|
@ -1960,7 +1960,7 @@ prior to creating the header.
|
|||
:fields @Dictionary , (link) , (xt) , (class) ;
|
||||
:invalid-name? dup ASCII:SPACE s:contains-char? ;
|
||||
:rewrite [ ASCII:SPACE [ $_ ] case ] s:map ;
|
||||
:entry here [ call ] dip !Dictionary ;
|
||||
:entry here &call dip !Dictionary ;
|
||||
[ [ fields invalid-name? &rewrite if s, (name) ] entry ]
|
||||
}}
|
||||
|
||||
|
|
BIN
ngaImage
BIN
ngaImage
Binary file not shown.
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue