Re: Idiomatically returning one or two values from a function.

2011-09-30 Thread Daniel Pittman
On Wed, Sep 28, 2011 at 12:15, Daniel Solano Gomez cloj...@sattvik.com wrote: On Wed Sep 28 18:52 2011, Daniel Pittman wrote: I have problem that I have been thrashing back and forth over the best design of for a week now, and I can't work out the nicest way to handle it.  Specifically, I

Re: Idiomatically returning one or two values from a function.

2011-09-29 Thread Tassilo Horn
Meikel Brandmeyer m...@kotka.de writes: you can return always a vector. (fn [] [true]) (fn [] [true {:foo 12}]) And then use destructuring on the return value. (let [[value annotations] (...)] (when annotations ..)) My first idea was to add metadata to the return value, but that

Idiomatically returning one or two values from a function.

2011-09-28 Thread Daniel Pittman
G'day. I have problem that I have been thrashing back and forth over the best design of for a week now, and I can't work out the nicest way to handle it. Specifically, I have a collection of functions that return a primary result, and might also return a secondary annotation about that result.

Re: Idiomatically returning one or two values from a function.

2011-09-28 Thread Daniel Solano Gomez
On Wed Sep 28 18:52 2011, Daniel Pittman wrote: G'day. I have problem that I have been thrashing back and forth over the best design of for a week now, and I can't work out the nicest way to handle it. Specifically, I have a collection of functions that return a primary result, and might

Re: Idiomatically returning one or two values from a function.

2011-09-28 Thread Meikel Brandmeyer
Hi, you can return always a vector. (fn [] [true]) (fn [] [true {:foo 12}]) And then use destructuring on the return value. (let [[value annotations] (...)] (when annotations ..)) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure