Tuesday, September 27, 2011

Why do I still use newLISP?

One of the big* unanswered questions in the world today is why I use newLISP if I am using Clojure. I use R because that's what I've been using for years, I use Fortran because I need speed, and I use Clojure because I want Lisp. So what does newLISP bring to the table when I'm already using Clojure?

Here are a few thoughts:

1. Java is heavy. For example, I work with sockets, and Clojure/Java is overkill for that.

2. You sometimes need an understanding of the Java classpath and all that jazz, and I don't possess that understanding. I can make it work (so far) but I'm not a Java developer and it gets to be a nuisance. The Java build system is a perfectly acceptable reason to avoid Clojure altogether.

3. Another is here:
http://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java
http://stackoverflow.com/questions/3921744/how-do-i-change-directory-in-command-line-with-clojure


I'm sure you can do what you need to do in Clojure, but I don't want the headache. With newLISP, it's straightforward, and I don't have to learn a new approach for no particular reason.

4. It's easy to call C libraries from newLISP (some of the time anyway). It hasn't been a pleasant experience when I've tried to call C from Java in the past. I'm well aware of SWIG, but SWIG is hardly a fun experience, it's just less painful than the alternatives.


I could add more examples, but the reasoning would be the same. It's partially a matter of scripting language vs full-blown programming language, and partially a matter of JVM vs native platform. I'm probably not going to use newLISP for a big simulation, but there are times that it is the best choice.

I'm not claiming Clojure or any other Lisp can't do these things. Further, I could use Python, Ruby, or Perl for all of my scripting needs. I just find newLISP to be the best solution for me.

* Definitions of big may vary.

8 comments:

Anonymous said...

I am functional programmer
I dont want another ΟΟ ,even in lisp style.

Kevin Archie said...

As for point 3: you can't write a 'cd' program in newLISP, either. Nor Python, Ruby, or even C. It has to be a shell builtin.

lmf said...

@Kevin

What I'm saying is that newLISP comes with those functions out of the box, the way we're used to using them, but as the discussion in the link says, it's different with Java.

I can open a newLISP REPL, type (directory) or (real-path) to get information about the directory, I can use (change-dir "..") or (change-dir "/home/newlisp") to change directories, and then manipulate files in those directories.

newLISP is built for tasks like this, Clojure is not. You haven't given many details, but your comment seems to be focused on the underlying implementation rather than what the end user deals with.

Kevin Archie said...

Ah. That's a slightly different problem. The original link you posted wanted to do something impossible in UNIX in any language. You want to do something occasionally useful and maddeningly, stupidly impossible in a JVM (http://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java). Java is not a systems programming language, and once in a while that bites you. Which I suppose is your original point.

lmf said...

Maybe I linked to the wrong post. I'll add your link. Thanks.

Ahmed Fasih said...

Does JNA let you easily use C libraries from Clojure/JVM languages?

lmf said...

JNA is supposed to work, but anytime I've tried it, I've had trouble. I've tried SWIG and JNA.

The problem with JNA is that there is considerable overhead. If you want to do, as an example, matrix algebra through repeated calls to C, you really should use JNI. Then there is the whole issue of callbacks into Clojure code from C. It would by my understanding require using JNI to go C -> Java -> Clojure. That's all a big mess. Simple things can be done in newLISP almost trivially.

emoosh said...

شركة نقل اثاث بجدة
شركة نقل عفش بالرياض
شركة نقل عفش بالمدينة المنورة
شركة نقل عفش بالدمام
شركة نقل عفش بالدمام
شركة نقل اثاث بجدة
شركة نقل عفش بالرياض
شركة نقل عفش بالمدينة المنورة