aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/rosetta/compare_a_list_of_strings.bruijn18
1 files changed, 18 insertions, 0 deletions
diff --git a/samples/rosetta/compare_a_list_of_strings.bruijn b/samples/rosetta/compare_a_list_of_strings.bruijn
new file mode 100644
index 0000000..636a98d
--- /dev/null
+++ b/samples/rosetta/compare_a_list_of_strings.bruijn
@@ -0,0 +1,18 @@
+:import std/String .
+
+all-eq? [land? (zip-with eq? 0 (tail 0))]
+
+all-gre? [land? (zip-with les? 0 (tail 0))]
+
+# --- tests ---
+
+list-a "abc" : ("abc" : {}("abc"))
+
+list-b "abc" : ("def" : {}("ghi"))
+
+:test (all-eq? list-a) ([[1]])
+:test (all-eq? list-b) ([[0]])
+:test (all-gre? list-a) ([[0]])
+:test (all-gre? list-b) ([[1]])
+
+main [[0]]