backport a:index from retro/napia (no longer needs to create a curry function when used)

FossilOrigin-Name: 704f6033f56ff0c908ff8f132d99acd0128a7a28aeb1ba4a4d882a1b5076579b
This commit is contained in:
crc 2021-12-22 14:21:16 +00:00
parent 2ec35cf45c
commit c19ac3e293
6 changed files with 653 additions and 657 deletions

View file

View file

@ -1,5 +1,5 @@
# RetroForth 2022.1 Release Notes
# Core Language
- deprecated
@ -8,14 +8,18 @@
- dictionary
- arrays
- a:index no longer need to construct a new word to locate
the index (backport from retro/napia)
# VM
## nga-c: retro.c
- recognize TAB as whitespace when including files
# Documentation
# Documentatio
# Other

View file

@ -1628,13 +1628,17 @@ using a variable for the flag/offset value, but it's pretty clean
overall.
~~~
:a:index (an-i)
push push #-1 #0 pop pop swap
[ over eq? [ [ over #-1 eq? [ nip dup ] if ] dip ] if
[ n:inc ] dip ]
a:for-each drop-pair ;
{{
:identify
#-1 swap #0
[ TRUE eq? [ over #-1 eq? [ nip dup ] if ] if n:inc ] a:reduce drop ;
---reveal---
:a:index (an-n)
&Heap [ &eq? curry a:map identify ] v:preserve ;
:a:index/string (as-n)
&Heap [ &s:eq? curry a:map identify ] v:preserve ;
}}

View file

@ -1,4 +1,4 @@
# RETRO Core 2021.11
# RETRO Core 2022.1
RETRO Core is a minimal Forth implementation for the Nga
virtual machine. Like Nga this is intended to be used within
@ -147,7 +147,7 @@ r 9999
d 1536
: Version
d 202111
d 202201
: references
r interpret

BIN
ngaImage

Binary file not shown.

File diff suppressed because it is too large Load diff