Did this get returned from my htc
Sent from my HTC
- Reply message -
From: "Angus"
To:
Subject: How to convert this simple (and inefficient) fibonacci function to #
format
Date: Wed, Nov 13, 2013 17:41
I know this fibonacci function is not optimal but I want to learn one step
at a t
Ah, as in:
> ((fn fib [x](cond (= x 0) 0 (= x 1) 1 :else (+ (fib (- x 1)) (fib (- x
2) 8))
21
Many thanks.
On Wednesday, 13 November 2013 17:46:57 UTC, Jim foo.bar wrote:
>
> you don't need 'fn' when you're using #(...) - that is the whole point.
> To not have to declare a function and
you don't need 'fn' when you're using #(...) - that is the whole point.
To not have to declare a function and its args explicitly.
this particular example you cannot write using #() syntax though because
it is recursing at 2 points and you cannot use 'recur'.
Jim
wOn 13/11/13 17:41, Angus wr
#(fn fib [x] ... ) creates a zero-arity function which, when called, will
return a one-arity function. Just get rid of the #.
On Wed, Nov 13, 2013 at 9:41 AM, Angus wrote:
> I know this fibonacci function is not optimal but I want to learn one step
> at a time. I want to be able to apply this