3 ms·
In Lisp I would write a macro that could be used like this: (for-each (transaction) :where ((order :starts-with "a2d")
by lispm 16y ago
In Lisp I would write a macro that could be used like this:
(for-each (transaction)
:where
((order :starts-with "a2d")
(customer-website :ends-with ".com")
(billing-first-name :equals "John")
(status :one-of '(:authorized :settled))
(amount :between '("10.00" "20.00")))
:do
(print (id transaction)))
- mkramlich 16y agoGod that's elegant. S-expressions for the win. No, no, remember: all other languages need a chance to incrementally catch back up to Lisp. :)
- papaf 16y agoJust 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.