This commit is contained in:
Lobo 2026-01-23 18:43:16 -03:00
parent f40fd7eaa1
commit 30ff72b3ae
10 changed files with 103 additions and 43 deletions

12
std.grr
View file

@ -9,7 +9,12 @@ def when { [] if }
def unless { swap when }
def dip { swap [] curry compose call }
def 2dip { swap [dip] dip }
def 3dip { swap [2dip] dip }
def keep { over [call] dip }
def 2keep { [2dup] dip 2dip }
def bi { [keep] dip call }
def tri { [[keep] dip keep] dip call }
@ -18,3 +23,10 @@ def times {
[drop drop]
[swap over >r >r call r> 1 - r> times];
}
def while {
swap dup bury >r >r
if: call dup
[r> dup >r call r> r> swap while]
[drop r> drop r> drop];
}