From dfbad82f26c20c14989b956b29e94557da1fe575 Mon Sep 17 00:00:00 2001 From: darkf Date: Sun, 20 Oct 2013 22:43:59 -0700 Subject: [PATCH] listsum -> listlength; add actual listsum --- examples/listlength.lamb | 4 ++++ examples/listsum.lamb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 examples/listlength.lamb diff --git a/examples/listlength.lamb b/examples/listlength.lamb new file mode 100644 index 0000000..4cb0172 --- /dev/null +++ b/examples/listlength.lamb @@ -0,0 +1,4 @@ +sum([]) -> 0. +sum(x::xs) -> 1 + sum(xs). + +putstrln(itos(sum([1, 2, 3]))). \ No newline at end of file diff --git a/examples/listsum.lamb b/examples/listsum.lamb index 4cb0172..f171586 100644 --- a/examples/listsum.lamb +++ b/examples/listsum.lamb @@ -1,4 +1,4 @@ sum([]) -> 0. -sum(x::xs) -> 1 + sum(xs). +sum(x::xs) -> x + sum(xs). putstrln(itos(sum([1, 2, 3]))). \ No newline at end of file