aboutsummaryrefslogtreecommitdiff
path: root/examples/palindrome.fusp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/palindrome.fusp')
-rw-r--r--examples/palindrome.fusp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/palindrome.fusp b/examples/palindrome.fusp
new file mode 100644
index 0000000..d2c6eba
--- /dev/null
+++ b/examples/palindrome.fusp
@@ -0,0 +1,9 @@
+import int;
+import list;
+import bool;
+
+is_palindrome [] = 1;
+is_palindrome [_:[]] = 1;
+is_palindrome [x:xs] = if (eq x (last xs)) (is_palindrome (init xs)) 0;
+
+main = is_palindrome [0:[42:[37:[42:[0:[]]]]]];