Clojurepy is nice and all, but with a slow startup time, I really don't 
have a use for it. Coming from Clojure, I found clojurepy more complicated 
than Clojure itself. Probably due to lack of documentation. What bothered 
me the most is that it seems like they've changed things making it 
different from Clojure. Obviously certain changes will be necessarily, but 
I'm concerned on what they might change on a whim in the future.

It is pretty terrible that we don't have a good implementation of Clojure 
that doesn't have significant startup overhead. Clojurescript + node.js 
could have filled this hole, but for some reason (that baffles my mind), 
it's mostly left untested and unused. Every time I use it I find a new bug 
that makes it generally unusable. ClojureC could probably serve this 
purpose, but it is a very long way from being useful.

So, I guess the question I'm asking is "Why?". What is the big deal about 
it? I see a lot of potential in clojurepy, but the hopes I have for it seem 
to be completely different from what you're excited about. Is it really 
just "Clojure is hard!"? I'm unclear on how one implementation of Clojure 
can be significantly 'harder' than another. There are always going to be 
some platform related things to learn about. If you already know Python, 
then sure, I can see it being easier. But limiting yourself to languages 
implemented on top of Python might not be the best way to build your future.

On Thursday, August 16, 2012 8:00:50 AM UTC-5, Sean Neilan wrote:
>
> Hey All,
>
> ClojurePY is actually quite amazing. It has none of the complexities with 
> libraries and projects like Clojure and is suitable for crunching data 
> (because it's on Python) unlike Node.js/Clojurescript. You can use all the 
> python libraries. You can even import ipdb and step through your code 
> without any modifications to the ClojurePY source tree. Even the REPL is 
> better by default.
>
> Just try 
> sudo easy_install clojure-py
>
> Then, type clojurepy at your shell to run it!
>
> Then, put this crappy script into emailScraper.clj to automagically 
> listen to IMAP emails from Gmail:
> Be sure to download imapidle.py from 
> https://raw.github.com/athoune/imapidle/master/src/imapidle.py and place 
> it in the same directory as emailScraper.clj
> Then do $ clojurepy emailScraper.clj. No leiningen! No compilation! Just 
> run it!
>
> (ns emailScraper)
> ; adding current directory to path
> (require 'os)
> (require 'sys)
> (require 'time)
>
> ;(.chdir os "/Users/seanneilan/BucketsOfNantucket")
>
> (.append sys/path (.abspath os/path (.-curdir os/path)))
>
> ; using imapidle in clojurepy
> ;https://raw.github.com/athoune/imapidle/master/src/imapidle.py
>
>
> (require 'imapidle)
> (def m (.IMAP4_SSL (.-imaplib imapidle) "imap.gmail.com"))
> (def fetcher (.IMAP4_SSL (.-imaplib imapidle) "imap.gmail.com"))
> (require 'getpass)
> (require 'pyzmail)
> ;(require 'ipdb)
>
> (def pass "Your password here!")
>
> (.login m "your gmail here" pass) ; type in your password here
> (.login fetcher "your gmail here" pass)
> (.select m)
>
>
> (defn process-message [message]
>   ;(println message)
>   (.select fetcher)
>   (let [raw-msg (.fetch fetcher (int (first message)) "(BODY.PEEK[])")
>         msg (.message_from_string pyzmail (-> raw-msg
>                                             second
>                                             first
>                                             second))
>         from (.get_address msg "from")
>         to (.get_addresses msg "to")
>         cc (.get_addresses msg "cc")
>         bcc (.get_addresses msg "bcc")
>         subject (.get_subject msg)
>         attachments (filter
>                      #(nil? (.-is_body msg))
>                      (.-mailparts msg))
>         text_body (filter
>                    #(= (.-is_body %) "text/plain")
>                    (.-mailparts msg))
>         html_body (filter
>                    #(= (.-is_body %) "text/html")
>                    (.-mailparts msg))
>         body (if (empty? html_body) (first text_body) (first html_body))
>         body (.get_payload body)]
>     (println body)))
>
>
> (dorun (map process-message (.idle m)))
>
> (comment
> (loop [messages (.idle m)]
>   (println (first messages))
>   (recur (rest messages))))
>
>
> I'm surprised ClojurePY hasn't received more attention.
>
>

-- 
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

Reply via email to