add a:first and a:last, new a:map that does not use curry

FossilOrigin-Name: da12a75d7886b4295d6794a3a84a3166ea017d9ab322103186303476d0810b5f
This commit is contained in:
crc 2023-03-20 14:17:14 +00:00
parent 9e030890d2
commit d0f0079898
4 changed files with 777 additions and 771 deletions

View file

@ -1518,6 +1518,7 @@ I then define `a:append` and `a:prepend` to combine arrays.
~~~
:a:append (aa-a)
dup-pair &fetch bi@ + here [ , [ &, a:for-each ] bi@ ] dip ;
:a:prepend (aa-a)
swap a:append ;
~~~
@ -1567,8 +1568,12 @@ Example:
~~~
:a:map (aq-a)
[ call , ] curry
here [ over fetch , a:for-each ] dip ;
swap [ fetch-next [ [ fetch over call ] sip
&store sip n:inc ] times
drop-pair ] sip ;
:a:first (a-n) #0 a:fetch ;
:a:last (a-n) dup a:length n:dec a:fetch ;
~~~
You can use `a:reverse` to make a copy of an array with the

View file

@ -21,7 +21,6 @@ existing set in the future.
:aa:first (a-n) #0 a:fetch ;
:aa:last (a-n) dup a:length n:dec a:fetch ;
:a:dup here [ dup a:length comma &comma a:for-each ] dip ;
~~~

BIN
ngaImage

Binary file not shown.

File diff suppressed because it is too large Load diff