Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by lispm on Tuesday August 03, 2010 @06:18PM
(#1572966)
In Lisp I would write a macro that could be used like this:
[ Parent
| on HN ]
Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by mkramlich on Tuesday August 03, 2010 @07:14PM
(#1573086)
God that's elegant. S-expressions for the win.
No, no, remember: all other languages need a chance to incrementally catch back up to Lisp. :)
Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by papaf on Wednesday August 04, 2010 @05:46AM
(#1574097)
Just a question of personal taste but I'd have the conditions as functions and have search return a list if I was using clojure...
(braintree/search
(starts-with :order-id "a2d")
(ends-with :customer-website ".com")
(equals :billing-first-name "John")
(one-of :status [:authorised :settled])
(between :amount 10 20))
The cool thing being that both styles are possible in a lisp.