aboutsummaryrefslogtreecommitdiff
path: root/examples/palindrome.fusp
diff options
context:
space:
mode:
authorCamil Staps2016-10-04 20:16:56 +0200
committerCamil Staps2016-10-04 20:16:56 +0200
commit2cd524e55f4d3057fe82db119541b1b5284629dc (patch)
tree5ed4dc27682c39a9c3f4c1e3a9f731c02a32b63b /examples/palindrome.fusp
parentDebug graph readability improvements (diff)
Examples
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:[]]]]]];