aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib.rip25
1 files changed, 25 insertions, 0 deletions
diff --git a/stdlib.rip b/stdlib.rip
index 7d209b7..f35641b 100644
--- a/stdlib.rip
+++ b/stdlib.rip
@@ -65,6 +65,20 @@ F<strcmp>[
PP
]
+0I[takes string, returns integer (assumes correct input: only digits and at most
+ one minus); replaces string on stack]
+F<parseint>[
+ <strrev>
+ 0 S
+ DW[
+ D 28pM
+ D'-EI[P S 0Ss S 0]
+ DI['0s 3R 9ima S 0]
+ P 28pq
+ D]
+ P
+]
+
0I[initialises variable store at beginning of stack (no args) (CALL ONLY ONCE)]
F<varinit>[
@@ -183,3 +197,14 @@ F<strsend>[
F<dup2>[
SD3RD3r
]
+
+0I[number -> n'th stack item from top (top is 1);
+ a b c d e 4<sget> -> a b c d e b]
+F<sget>[iDRD3Rr]
+
+0I[value, number -> replace n'th stack item AFTER value with value (top is 1);
+ a b c d e X 2<sput> -> a b c X e]
+F<sput>[DiiRPr]
+
+0I[quits program]
+F<quit>[`]