2014-07-08 23:11 GMT+02:00 Bob Hutchison <hutch-li...@recursive.ca>:

>
> On Jul 8, 2014, at 9:40 AM, Cecil Westerhof <cldwester...@gmail.com>
> wrote:
>
> > In Clojure you can define a local constant with let, but I need a
> variable (I think).
> >
> > I want to do the following. I have a function that checks several
> things. Every time an error is found I want to set the variable errors to:
> >     (concat errors new-error)
> >
> > Is this possible? Or is there a better way to do this?
>
> Here's a different take on your question, and a few comments about how I'd
> write that code. I don't think you need the atom -- kinda ugly and the
> reduce/map/filter family of sequence functions will take you a long way.
>
> ; This is not a predicate, so don't use the -p suffix (and in Clojure it's
> a ? normally)
>

​As I understood it (I am rewriting land of lisp to Clojure) that when a
function returns a true/false state, that you then use the -p suffix. When
returning () there are no errors. But I should use the ? then?

​


> ; There's no reason not to pass those two objects into this function, so I
> do.
>

​Good idea. Makes it easy to test the function also.

[…]​



> I hope you can make sense of that :-)
>

​Not immediately. I need to digest it.

By the way. The current function is only the start of the checks.​

​After the if I need to do several other checks also. So I think I do need
the atom. But maybe I am mistaken. ;-)

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to