Re: Correct way to define the else clause of a cond form?

2011-07-07 Thread Tassilo Horn
Ken Wesson kwess...@gmail.com writes: Hi! Remove the question mark... or whatever this is...  and you'll be fine. Whatever WHAT is? There's nothing in your post there but three blank lines. Sure there is! ;-) , | character:  (65532, #o14, #xfffc) | preferred charset:

Re: Correct way to define the else clause of a cond form?

2011-07-07 Thread Ken Wesson
On Thu, Jul 7, 2011 at 2:47 AM, Tassilo Horn tass...@member.fsf.org wrote: Ken Wesson kwess...@gmail.com writes: Hi! Remove the question mark... or whatever this is...  and you'll be fine. Whatever WHAT is? There's nothing in your post there but three blank lines. Sure there is! ;-)

Re: Correct way to define the else clause of a cond form?

2011-07-07 Thread Michael Wood
On 7 July 2011 09:10, Ken Wesson kwess...@gmail.com wrote: On Thu, Jul 7, 2011 at 2:47 AM, Tassilo Horn tass...@member.fsf.org wrote: Ken Wesson kwess...@gmail.com writes: Hi! Remove the question mark... or whatever this is...  and you'll be fine. Whatever WHAT is? There's nothing in

Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
Hi, what's the correct way to define an else clause of a cond form? For example, a) (cond (= total 20) 8.75 (or (amount 20) (= country US) 9.75) (else 10.0)) b) (cond (= total 20) 8.75 (or (amount 20) (= country US) 9.75) :default 10.0) c) (cond (= total 20) 8.75

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Benny Tsai
I believe (d) is considered the idiomatic way*. Btw, I think the second case may not be written correctly; if the intended logic is that 9.75 should be returned when either amount 20 or country = US, the code should look something like this: (cond (= total 20) 8.75 (or ( amount 20) (=

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Tim Robinson
In addition to Benny's suggestion - I will suggest, for future reference, that the ClojureDocs website does an brilliant job in showing some examples. It really is a valuable resource that I've come to rely on. http://clojuredocs.org/clojure_core/clojure.core/cond And what's interesting to note

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
On Jul 6, 6:07 pm, Benny Tsai benny.t...@gmail.com wrote: I believe (d) is considered the idiomatic way*.  Btw, I think the second case may not be written correctly; if the intended logic is that 9.75 should be returned when either amount 20 or country = US, the code should look something

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread David Sletten
Conrad, The syntax of 'cond' is actually pretty straightforward. Following the symbol 'cond' you have pairs of predicate forms and consequent expressions. The 'cond' form evaluates each predicate in turn until one evaluates to true and then returns the value of the corresponding consequent

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
On Jul 6, 5:34 pm, Conrad Taylor conra...@gmail.com wrote: Hi, what's the correct way to define an else clause of a cond form? For example, a) (cond    (= total 20) 8.75    (or (amount 20) (= country US) 9.75)    (else 10.0)) b) (cond    (= total 20) 8.75    (or (amount 20) (=

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Benny Tsai
Could you please post the entire form, including the code surrounding the cond form (since total, amount, and country need to be defined somewhere)? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
On Jul 6, 7:16 pm, David Sletten da...@bosatsu.net wrote: Conrad, The syntax of 'cond' is actually pretty straightforward. Following the symbol 'cond' you have pairs of predicate forms and consequent expressions. The 'cond' form evaluates each predicate in turn until one evaluates to true

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
On Jul 6, 7:33 pm, Benny Tsai benny.t...@gmail.com wrote: Could you please post the entire form, including the code surrounding the cond form (since total, amount, and country need to be defined somewhere)? Benny, that was just sample code to zero in on the initial issue. I'm working through

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Tim Robinson
You have some rogue text cluttering your cond statement. Remove the question mark... or whatever this is...  and you'll be fine. On Jul 6, 8:58 pm, Conrad Taylor conra...@gmail.com wrote: On Jul 6, 7:33 pm, Benny Tsai benny.t...@gmail.com wrote: Could you please post the entire form,

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Ken Wesson
On Wed, Jul 6, 2011 at 11:06 PM, Tim Robinson tim.blacks...@gmail.com wrote: You have some rogue text cluttering your cond statement. Remove the question mark... or whatever this is...  and you'll be fine. Whatever WHAT is? There's nothing in your post there but three blank lines. --

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread David Sletten
On Jul 6, 2011, at 10:58 PM, Conrad Taylor wrote: On Jul 6, 7:33 pm, Benny Tsai benny.t...@gmail.com wrote: Could you please post the entire form, including the code surrounding the cond form (since total, amount, and country need to be defined somewhere)? Benny, that was just sample code

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Tim Robinson
Lol. not sure what to tell you... on Mac OSX Firefox I see what looks like this -- - OBJ - -- in the middle line, but really really really small. and when I copy his text and paste at the repl, I get his same error. When I remove it its not a problem. On Jul 6, 9:07 pm,

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Benny Tsai
On Wednesday, July 6, 2011 9:06:30 PM UTC-6, Tim Robinson wrote: You have some rogue text cluttering your cond statement. Remove the question mark... or whatever this is...  and you'll be fine. That's what I encountered too. Conrad, when I pasted your code into emacs, there was a

Re: Correct way to define the else clause of a cond form?

2011-07-06 Thread Conrad Taylor
On Jul 6, 8:08 pm, David Sletten da...@bosatsu.net wrote: On Jul 6, 2011, at 10:58 PM, Conrad Taylor wrote: On Jul 6, 7:33 pm, Benny Tsai benny.t...@gmail.com wrote: Could you please post the entire form, including the code surrounding the cond form (since total, amount, and