> 2. "each=" and "all-true" are gone, replaced by the new macro "are",
> which works with any predicate:
>     (are =
>       2 (+ 1 1)
>       4 (+ 2 2))
>
> -Stuart Sierra

Hello and thanks for additions!

Happy to see additions and work done on tests :-)

I just wonder - how do you define "all-true" using "are"? Since "are"  
always makes pairs for predicate, it might not be possible.

(defn logically-true? [x]
   (if x true false))

(are logically-true?
   43
   "abc"
   true
   (not false)
   (not nil))

My guess: Fails because logically-true? accepts only 1 argument and (not  
nil) never gets tested even if predicate accepts 2 arguments ("are"  
doesn't test for odd number of params).

Possible solution: Add another number-of-arguments parameter to "are":

(are 2 =
   (+ 1 2) 3
   (+ 1 -1) 0 )

(are 1 logically-true?
   43
   "abc"
   true
   (not false)
   (not nil))

Also [syntactic sugar]:
   (are 1 pred? ...) could be (are-all pred? ...)
   (are 2 pred? ...) could be (are-pairs pred? ...)


Thanks for considering these ideas, Frantisek

PS: Still writing tests - latest are 'and', 'or', 'first', 'rest',  
'ffirst'.

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

Reply via email to