top | item 3589787

Python’s Valentines Day Gift to Clojure

80 points| sunng | 14 years ago |sunng.info | reply

12 comments

order
[+] ericmoritz|14 years ago|reply
I have to say, after tinkering with Clojure, when I'm typing out a python dict or list I think, "So many damn commas..."
[+] atdt|14 years ago|reply
Try this:

>>> dict(user='root', password='secret') {'password': 'secret', 'user': 'root'} >>> "marry had a little lamb".split() ['marry', 'had', 'a', 'little', 'lamb']

[+] pashields|14 years ago|reply
Some (potential) context to this is that at Clojure Conj there was a discussion of the potential for clojure expressions to become a standard data serialization format. The idea is that clojure data is significantly more rich than something like JSON.

In fact, as I understand it, some of the changes to the reader in 1.4 are aimed at working on this goal. You can read a little about this at http://dev.clojure.org/pages/viewpage.action?pageId=950382

[+] dustingetz|14 years ago|reply
why do people want to do this?
[+] overshard|14 years ago|reply
Same reason people use different programming languages in general, they just prefer/like/forced/are used to it.

If you like clojure and must program in python, have an idea of how to implement something in clojure but not in python then just use clojure now.

[+] zaphar|14 years ago|reply
It's a way to share data with a clojure application. And s-expressions are a pretty good format for data transfer so it's not a terrible idea to provide ways for people to use it as such.