File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ ````sii
2
+ ``s `k`d`
3
+ `d`c``s `k`s`k`k`ki``s``s`ks``s`k`sik`k`k`ki
4
+ `@i
5
+ ``s`kd``s`k|``s`k`s`kd ``s`kd``sii
6
+ i
7
+
8
+ #########
9
+
10
+ # String Reversing in Unlambda
11
+ # Reads from stdin, prints the reversed string to stdout
12
+ # Run the program here:
13
+ # https://tio.run/##K83LScxNSkn8/z8BCIozM7mApEJCdkJKAhcQJ0N5xUAMhJlALghlQ0ig@myoBFeCA1hrQnYKmKyBKgDyFeDCQNMz///3SM3JyVcIzy/KSVEEAA
14
+ # Or here (good for debugging): https://inazz.jp/unlambda/
15
+
16
+ # Explanation:
17
+ # Lines 2-5 are the main program
18
+ # Lines 2-4 try to read one character
19
+ # Line 3 is a function that returns i when applied to i and `ki when applied to v
20
+ # It is used to check whether the read succeeded (i.e. whether `@i returned i or v)
21
+ # If the read worked, line 5 recurses and then prints the character
22
+ # Lines 1 and 6 call the main program with itself (for the recursion) and a dummy argument (i here, but can be anything) to start it
You can’t perform that action at this time.
0 commit comments