From 40486ab3ab7d74ecc2bcc0edf78747a7d03b9cda Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Wed, 16 Dec 2015 19:40:38 +0100 Subject: Start a "standard library" -- rip style --- stdlib.rip | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ stdlibtest.rip | 21 +++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 stdlib.rip create mode 100644 stdlibtest.rip diff --git a/stdlib.rip b/stdlib.rip new file mode 100644 index 0000000..8ab0448 --- /dev/null +++ b/stdlib.rip @@ -0,0 +1,59 @@ +0I[prints string; destructive] +F[ + + 97aDm + SDW[ + D3RD3rM o D3rq + D] + PP +] + +0I[takes string char; returns string+char] +F[ + S97aDmma +] + +0I[reverses string in place] +F[ + 0S + DW[ + D 97aDm D 3r M 3r q 3r S 97aDm m a S + D] + P +] + +0I[concatenates two strings] +F[ + 97aDm S + DW[ + S D 3r S D 3R M 4R 97aDmma 3r S D 3r q + D] + PP +] + +0I[takes list of characters and a length, builds a string] +F[ + 0S + DW[ + D3aR 3R 97aDm m a S d + D] + P +] + +0I[ + a b 256 + a b 256 256 + a 256 b 256 + a 256 256 b + a 256 256 b b + a 256 b b 256 + a 256 b b%ff + 256 b b%ff a + 256 b newa + newa 256 b + newa b 256 + newa b 256 256 + newa 256 b 256 + newa 256 newb + newa newb 256 +] diff --git a/stdlibtest.rip b/stdlibtest.rip new file mode 100644 index 0000000..c0926cd --- /dev/null +++ b/stdlibtest.rip @@ -0,0 +1,21 @@ +# +0 0I[empty string] +'a +'b +' +'4 +'2 +9i + +0 +'a +'b +'c +'d +'e +'f +9i + + + +'a 'b 'c 'd 'x 'y 'z 9i 8 -- cgit v1.2.3-54-g00ecf