On Wednesday, January 14, 2015 at 3:50:21 PM UTC-5, Yehonathan Sharvit wrote: > In my app, I am using :yes and :no sometimes instead of true and false. > > > > > I’d like to know what is the best way to extends the `not` function to be > able to handle :yes and :no properly. > > > > > I was expecting some kind of Boolean protocol but I wasn’t able to find it. > > > > > I could write this: > > > > > > > (defn not [x] > > (case x > > :yes :no > > :no :yes > > (cljs.core.not x))) > > > > > (map not [false true :yes :no]); (true false :no :yes) > > > > > But I’m not sure it is the most idiomatic solution. > > Any ideas? > > > > — > Sent from Mailbox
If you are passing around :yes and :no as values in your code and want to treat them like boolean values, why not pass around true or false instead? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
