Heh, looking at the repo I see you're underselling your library. :-)

For those who haven't clicked on the link, there's quite a funky DSL
for Angular and some Jasmine stuff in there too. The ?/! also seem to
support accessor syntax for reaching properties whose names are
themselves determined by reading other properties (of possibly
unrelated objects).

Looks fun!

Cheers,
M.


On 12 May 2013 11:37, zcaudate <z...@caudate.me> wrote:
> This is a quick and dirty release for interested parties. I found it very
> useful when working with angularjs. The syntax should not change that much
> but there will be more documentation in the future. I would love to have
> some input into additional features that could be added.
>
> Excerpt from Github: https://github.com/zcaudate/purnam
>
> Installation
>
> In your project file, add
>
> [purnam "0.0.9"]
>
> Why?
>
> Because the javascript dot-notation is awesome and the
> javascript/clojurescript interop (aget aset, .<fn> and .-<prop>accessors)
> make for really ugly code. Using the language-extension macros,
> clojurescript becomes more than twice as concise when working with existing
> javascript libraries (I'm mainly working with angularjs).
>
> So the use case can be seen below:
>
> Getters:
>
> ## javascript (12 keystrokes):
> object.a.b.c
>
> ## clojurescript (45 keystrokes):
> (-> object
>   (aget "a")
>   (aget "b")
>   (aget "c"))
>
> ## clojurescript + purnam (16 keystrokes):
> (? object.a.b.c)
>
> Setters:
>
> ## javascript (17 keystrokes):
> object.a.b.c = 10
>
> ## clojurescript (48 keystrokes):
> (-> object
>   (aget "a")
>   (aget "b")
>   (aset "c" 10))
>
> ## clojurescript + purnam (19 keystrokes):
> (! object.a.b.c 10)
>
> Functions:
>
> These are really bad examples of code but its what usually happens when
> working with existing javascript libraries. Using the dot-notation can save
> alot of screen and head space:
>
> ## javascript (~100 chars):
> var bad_code = function(obj, val){
>   obj.inner.number = 10;
>   val.inner.count = obj.inner.count + 10;}
>
> ## clojurescript (~180 chars):
> (defn bad-code [obj val]
>   (-> obj (aget "inner") (aset "number" 10))
>   (-> val
>       (aget "inner")
>       (aset "count"
>             (+ 10 (-> obj (aget "inner") (aget "count")))))
>   nil)
>
> ## clojurescript + purnam (~110 chars):
> (def.n bad-code [obj val]
>   (! obj.inner.number 10)
>   (! val.inner.count
>      (+ 10 obj.inner.count))
>   nil)
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to