Commit 4344f1fe46aeca784a671a359321891f4524734a

Thomas de Grivel 2023-09-05T17:29:09

List.reverse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/c3/0.1/list.facts b/lib/c3/0.1/list.facts
index 1279c47..2f777ba 100644
--- a/lib/c3/0.1/list.facts
+++ b/lib/c3/0.1/list.facts
@@ -4,6 +4,7 @@ add {List, :is_a, :module}
 add {List, :name, "List"}
 add {List, :path, "list.facts"}
 add {List, :symbol, List.map}
+add {List, :symbol, List.reverse}
 add {List.map, :fn, fn {
   ((), _) {
     ()
@@ -12,3 +13,8 @@ add {List.map, :fn, fn {
     (f(a) | List.map(b, f))
   }
 }}
+add {List.reverse, :fn, fn {
+  (x) { List.reverse(x, ()) }
+  ((), acc) { acc }
+  ((a | b), acc) { List.reverse(b, (a | acc)) }
+}}