Created
January 10, 2010 21:45
-
-
Save aboekhoff/273795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; *very* quick and dirty support for javascript destructuring on | |
;;;; native javascript arrays and objects | |
(add-inline-form | |
get [[_ a b c]] | |
(str "((" a "[" b "]" ")||" c ")")) | |
(add-inline-form | |
nth [[_ a b]] | |
(str a "[" b "]")) | |
(add-inline-form | |
nthnext [[_ a b]] | |
(str a ".slice(" b ")")) | |
;;;; pointless destructuring fn | |
(defscrypt trial | |
{:ns jury.destro} | |
(defn foo [{:keys [this-thingy that-thingy] | |
:or {this-thingy "foo" | |
that-thingy "bar"}} | |
[x y & ys]] | |
(alert this-thingy) | |
(alert that-thingy) | |
(alert x) | |
(alert y) | |
(alert ys))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment