Skip to content

Instantly share code, notes, and snippets.

@tuturto
Last active October 5, 2016 15:53
Show Gist options
  • Save tuturto/3b60e1aa0c55acf83c1ff1bada14d1c9 to your computer and use it in GitHub Desktop.
Save tuturto/3b60e1aa0c55acf83c1ff1bada14d1c9 to your computer and use it in GitHub Desktop.
=> (macroexpand '(-> "http://httpbin.org/ip" requests.get (fn [x] (getattr x "text"))))
('fn' ('requests.get' 'http://httpbin.org/ip') ['x'] ('getattr' 'x' 'text'))
=> (macroexpand '(-> "http://httpbin.org/ip" requests.get ((fn [x] (getattr x "text")))))
(('fn' ['x'] ('getattr' 'x' 'text')) ('requests.get' 'http://httpbin.org/ip'))
---
=> (defn foo [x] (getattr x "text"))
=> (macroexpand '(-> "http://httpbin.org/ip" requests.get (foo)))
('foo' ('requests.get' 'http://httpbin.org/ip'))
=> (macroexpand '(-> "http://httpbin.org/ip" requests.get foo))
('foo' ('requests.get' 'http://httpbin.org/ip'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment