make some small optimizations to some fll: words

FossilOrigin-Name: 767c0b08d5e9ddd854a15027d025aa1b89f5359c67718b0bf51e2a06c2996f71
This commit is contained in:
crc 2023-10-23 16:08:18 +00:00
parent a0ae942d31
commit 3eec5480ab
5 changed files with 731 additions and 732 deletions

View file

@ -22,5 +22,6 @@
- use strlcpy() in tools/retro-muri.c
- quieter output when building
- remove old Python build + packaging code
- small optimizations in fll: vocabulary
================================================================

View file

@ -18,10 +18,10 @@ String deduplication for RetroForth.
@s:dedup.data [ @t1 s:eq? @t2 or !t2 ] fll:for-each @t2 ;
:s:dedup.find (s-s)
!t1 #0 !t2
@s:dedup.data [ dup @t1 s:eq? [ !t2 ] [ drop ] choose ]
@s:dedup.data [ dup @t1 s:eq? [ !t2 ] &drop choose ]
fll:for-each @t2 ;
:s:dedup (s-s)
dup s:dedup.defined? [ s:dedup.find ] [ s:dedup.register ]
dup s:dedup.defined? &s:dedup.find &s:dedup.register
choose ;
:s:unique? (s-f) s:dedup.defined? ;
}}

View file

@ -16,6 +16,6 @@ and things that will be standard in the future.
#0 &d:lookup store
#0 &d:lookup n:inc store ;
'interface/future.retro 'd:use-hashes d:set-source
'interface/future.retro 'd:use-hashes d:set-source
'interface/future.retro 'd:use-strings d:set-source
~~~

View file

@ -75,7 +75,7 @@ a pointer to the final cons cell.
---reveal---
:fll:to-end (p-p)
dup !r [ cdr@ dup &END -eq? dup
[ over !r ] [ nip ] choose ] while @r ;
[ over !r ] &nip choose ] while @r ;
}}
~~~
@ -94,7 +94,7 @@ An issue with this: it does not currently check the length to
make sure that the index is valid.
~~~
:fll:to-index (pn-p) [ cdr@ ] times ;
:fll:to-index (pn-p) &cdr@ times ;
~~~

File diff suppressed because it is too large Load diff