Re: Newbie question - Functional programming special cases

2010-02-10 Thread ka
Thanks, that answers my questions. -- 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

Newbie question - Functional programming special cases

2010-02-01 Thread ka
Hi clojure folk, I'm reading up on clojure from the book 'Programming clojure'. In chapter 2 there is a statement - The imperative indexOfAny must deal with several special cases: null or empty strings, a null or empty set of search characters, and the absence of a match. These special cases

Re: Newbie question - Functional programming special cases

2010-02-01 Thread CuppoJava
Hi ka, You're right. Eliminating special cases is more a factor of the design of the API than of the programming language. Nevertheless, a well- designed API (that has eliminating special cases in mind) in combination with a functional programming language makes your code extremely elegant. Thus

Re: Newbie question - Functional programming special cases

2010-02-01 Thread Jerome Baum
'when pred' just checks that you're not passing in garbage for the predicate -- it's probably not really necessary and it might be better to let Clojure throw an exception. Totally agree on your point with the branching. That's not really FP- related, it's only that most FP languages allow