So start with something like:
(def a '(+ 3 9))
Then write a function where:
(evaltree a)
=> (12 3 9)
Don't worry about recursion to start with. Just get the simplest case
working first.
- James
On 14 November 2015 at 17:46, <[email protected]> wrote:
> Sorry I'm a complete rookie at this that didn't make a bit of sense to me.
> So far I have this:
>
>
> (def a '(* (+ 5 (* 3 7)) (- 6 8)) )
>
> (defn evaltree [tree] (cons (eval (first (rest tree))) tree))
>
> all i have so far which evals the first part of list but doesn't recurse
> through to do the rest of the list and doesn't replace the operator it only
> adds the value to the beginning
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.