4 ms·
When I last looked at this I found: plus a+b: addition Example: 1+2 -> 3 from a{b: selects the a-th element from b Example: 3{4,5,6,7,8 -> 7 find a~b:
by 1wd 9y ago
When I last looked at this I found:
plus a+b: addition
Example: 1+2 -> 3
from a{b: selects the a-th element from b
Example: 3{4,5,6,7,8 -> 7
find a~b: Not implemented? Or maybe this exploits some old-style C behavior?
rsh a#b: repeat a items of b
Example: 3#9 -> [9,9,9]
Example: 7#2,3 -> [2,3,2,3,2,3,2]
cat a,b: concatenate item a onto the list b
Example: 1,2,3 -> [1,2,3]
id +a: identity
Example: +7 -> 7
size {a: get the size (in the first dimension) of a
Example: {7,8,9 -> 3
Example: a=4,5
b=a#7
{b -> 4
iota ~a: enumerates all integers from 0 to a-1
Example: ~3 -> 0,1,2
Example: ~2,3 -> [0,1,2,3,4,5]
box <a: Put a into an indirection box
Example: <1 -> <1
sha #a: get the shape (size in all dimensions) of a
Example: #7,8,9 -> 3
Example: a=4,5
b=a#7
#b -> 4,5
I don't remember or haven't figured out how to dereference a boxed value, or what this can be used for.
The struct A has members:
t: The "type": 0=integer, 1=boxed reference
r: The "rank": size of array d
d: The "dimensions": Multiply to get the size of array p
p: The actual data. Can be integers or pointers to boxed data (cast to a 32-bit integer!)
- sillysaurus3 9y agoWow. This is genuinely incredible. The interpreter works, and all of your examples run. Thank you for detailing all of this.