Ken:  yup, that's what was needed.  Thanks. The immutability business
is gonna take some time to learn; very different than newLisp, which
is a wonderful dialect.

On Aug 31, 12:41 pm, Ken Wesson <kwess...@gmail.com> wrote:
> On Wed, Aug 31, 2011 at 3:14 PM, loonster <tbur...@acm.org> wrote:
> > I'm converting a newLisp application I wrote, in production for
> > several years, into clojure, and got stuck immediately.
>
> > (def input-list (ref
> > '(OR,CA,CO,ID,WA)))
>
> > (defn list-ploop
> >  "accepts a ref and returns a list's first and alters the rest"
> >  [in-list]
> >  (do
> >    (dosync
> >      (ref-set input-list (rest in-list))
> >    ((first in-list)))))
>
> > Issuing (list-ploop @input-list) successfully alters the input-list,
> > but it bombs on evaluating the (first ).  Many thanks.
>
> I'm not sure what you're trying to do here, but it seems likely that
>
> (defn list-ploop
>   "accepts a ref and returns a list's first and alters the rest"
>   [in-list]
>   (dosync
>     (let [res (first @in-list)]
>       (alter in-list rest)
>       res)))
>
> (list-ploop @input-list)
>
> is what you're after.
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.

-- 
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

Reply via email to