2009/7/8 Rick Moynihan <span dir="ltr"><<a href="mailto:rick.moynihan@gmail.com">rick.moynihan@gmail.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Perhaps I'm nitpicking but SQL/regexes are actually declarative<br>
languages, likewise the definition you supplied is a great description<br>
of declarative languages.<br>
<br>
Functional programming is a style of programming that encourages you<br>
to write your code as 'pure functions', i.e. procedure's that given<br>
the same inputs always return the same result without mutating state<br>
or causing side effects.<br>
<br>
This said, there can be a lot of similarity between functional<br>
langauges and declarative ones, as functional languages allow you to<br>
easily raise the abstraction so as to provide a declarative<br>
interpretation.<br>
<br>
I think the conflation of the two has probably come from your Haskell<br>
exposure... The reason Haskell is sometimes described as declarative<br>
comes more from its laziness i.e. leaving evaluation order up to the<br>
language than anything else.</blockquote><div><br>I certainly don't mind a bit of nitpicking, I'm quite partial to it myself :)<br><br>I agree with what you say, although I'd counter (in a way that actual agrees with you, but I'm not sure what the word for that is?) that you can't write in a functional style without being declarative. Essentially, pure functions are declarations, which is why they can be used lazily. But it's not the laziness that makes them declarative, that's a choice made by the compiler. Because they're pure, they don't alter program flow and are therefore declarative. To use them you'd have to build an impure function and call them from that, unless you want one of those progs that doesn't speak to the outside world, I forget the name. <br>
<br>You could take any of the languages, including Haskell (and certainly I've seen it done to SQL a lot), and force a procedural style onto them, but then they also wouldn't be (as) declarative anymore. <br><br>Maybe this is down to my main exposure being Haskell, and the style of SQL I write - which is correct (if I do say so myself), and not the sort I've seen most developers I've worked with use. The bane of my existence is having to explain why booleans shouldn't be in databases and what 3NF is. To professionals!<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Anyway, you should check out clojure, it's a practical lisp for the</blockquote><div><br>I was about to write "I will", but then I read the words "practical lisp" :)<br><br>Iain<br> <br></div></div>
<br>