A lot of people who've used lisp dialect languages will get "why clojure".

Even then, a lot of us lispers wanted more.  We wanted to leverage some of 
the vast amounts of code that have been written in recent years, in my 
case, for Java.
I like lisp a lot but had sworn it off for many years because the older 
lisp implementations I enjoyed weren't sufficiently blended with the newer 
tools I used to solve
problems.   So for a long time I've been looking at Scheme and Lisp 
implementations that interfaced with Java or had other 'critical support 
factors' that appealed to me.
Clojure seems to fit my needs for Lisp in 2014.

Here's an example of "why clojure" based on some recent Clojure scripting I 
was involved with.

Last week I decided I was tired of my hacks for calling 'ssh' via shell 
interfaces from Java (mostly because of pty hacks for sudo commands).
Granted, this is not a modern problem, but it was a very nice trip down 
lisp lane with a rewarding result in a few minutes at the lisp REPL prompt.

The ganymed2 java ssh library has been around a long time, so I decided to 
try that. I'd never used it before.

There was an example of using proxies with ganymed here:

https://code.google.com/p/ganymed-ssh-2/source/browse/trunk/examples/BasicWithHTTPProxy.java
(101 lines)

I adapted that in one REPL session to something like this:

http://pastebin.com/r0aTqFXp
(33 lines)

Throw a single dependency into your lein dependencies, experiment from the 
REPL,
and poof, ssh problems solved.

It isn't just the lines of code.
It isn't just that all the maven or ant and other build headaches went away.

It's just the best of both worlds, java and all that that implies, and lisp
and all that that implies, nicely brought together to solve whatever the 
problem-du-jour may be.

Actually, to solve my particular problem, I also needed to add one more 
line of code to the example I posted in the pastebin.

 (.requestDumbPTY session)

Now I can do my 'sudo' commands on Amazon EC2 instances with a pseudo tty 
with a lisp scripting environment.


So Lisp + Java + Good Interoperability == loads of fun and quick solutions.
That's "Why Clojure" for me.

Hope that helps any of you who (a) are wondering about  clojure and (b) 
need an ssh client from Clojure.

-- 
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/d/optout.

Reply via email to