473,839 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is anything easier to do in java than in lisp?

After many years of using LISP, I'm taking a class in Java and finding
the two roughly comparable in some ways and very different in other
ways. Each has a decent size library of useful utilities as a standard
portable part of the core language, the LISP package, and the java.lang
package, respectively. Both have big integers, although only LISP has
rationals as far as I can tell. Because CL supports keyword arguments,
it has a wider range of string search utilities etc. where :key and
:test and :start :end etc. are parametric instead of fixed or
special-cased here but not there. The only major differences I see are
speed and interactivity:

Speed comparisons on FreeBSD Unix:

javac or java takes appx. 24 seconds to start up the first time, then
is virtually instant subsequent times within a short time span.
However even on immediate re-runs, javac takes between 2 and 7 seconds
to compile a very small file (23 lines total, only 10 lines of actual
code).

CMUCL takes appx. 2 seconds to start up the first time, then is
virtually instant subsequent times within a short time span.
Recompiling a 33-line file runs so blindly fast that even with
*error-output* diverted to bit sink so as to suppress listing of each
function compiled, its limited only by 19200 bps printout of the return
value.
(let ((*error-output* (make-broadcast-stream))) (compile-file "tabsp.lisp "))
#p"/home/users/rem/JavaWork/tabsp.x86f"

You need to re-start java every time you want to compile and every time
you want to run what you compiled, you can't just leave the jvm running
and load tasks into it. Consequently, if you go away from java for a
minute to edit the source to recompile it, etc., then you're back to 24
seconds start-up again when you want to compile what you edited, a
royal pain! By comparison, you can stay in CMUCL and do almost
everything there, so you don't have to suffer even the two-second
first-time-start ever again during a session.

Interactivity: In CL (and virtually any LISP since the original), you
can sit in a read-eval-print loop composing and trying one line of code
at a time, storing the results of correct computation in global
variables to feed into the next step of composing&tryin g. By
comparison, in java you have to switch back and forth between editing
the source of not just what you want to test but a whole test rig
around it to make a "complete program", compiling that "complete
program" to bytecode, and running that "complete code" just to see if
you got one line of new code correct. Comparing the instant feedback
when typing one new LISP form into the R-E-P, against the 24+ second
turnaround to try one new line of java code, LISP is a *big* winner!

So I ask, is there any particular kind of task where java has an
advantage over LISP? The only thing I can think of is networking. I've
heard that java has networking built into the language, things like
sockets, TCP/IP, HTTP, etc., whereas they aren't part of CL per se and
need to be supplied by various vendors on the side. So is this true,
that java is better than CL for networking stuff? Also, is there any
other area where java beats CL?

Well, there's Unicode, which is built into java but not CL, but I have
no use for it at present so that doesn't count. But I'd like to write
some Web-networking code to replace the hack I currently use where lynx
is run as a sub-process under CL and lynx does all the work of handling
cookies etc. If java can do all that directly more easily than CL, I
might give it a try.
Jul 17 '05
73 8103
Ro********@Yaho oGroups.Com writes:
RM> is there any other area where java beats CL?
Anything that needs kernel threads.


Hmm, I've never used kernal threads, except when using the
RUN-PROGRAM function to call some other (non-CL) program from inside
CL. Maybe it's a case of since CL doesn't have it and I use CL it
never occurred to me that I needed it, just as non-LISP programmers
don't understand why having a near-universal READ and PRINT is
useful, or why having actual SYMBOLs at runtime is useful, etc.,
which we LISP programmers take for granted and use all the time and
don't want to live without.


Threads are actually very nice when you want to do properly
parallelized computations on a multiprocessor machine. You can of
course spawn off additional processes to match the number of
processors. But threads also make it easy to share data because they
run in the same process space. Sharing data may break parallelized
computation, depending on your expectations, but sharing process
global state information can be useful. You just need fast mutexes.

That all said, Windows was the first platform that Java had native
threads. It was using Green Threads on Suns.

For good or ill, CL implementations have varying degrees of threading
support. The implementors haven't agreed on the best threading API
yet.

--
I wouldn't mind the rat race so much if it wasn't for all the damn cats.
Jul 17 '05 #31
> From: adam connor <ad************ *****@mail.com>
Java's biggest advantage vs. Lisp is its libraries, which are huge.
After your and other messages in this thread, I looked into that some,
see later below...
Want to do GUI programming?
No, I have no use for that because my only access to the net from home
is via VT100 (text only) emulator through Unix shell.
Want to make a secure sockets connection?
No, I just want to make a simple HTTP/TCP/IP connection to Yahoo! Mail
and accept cookies to establish a login session and auto-traverse my
e-mail folders, but java's libraries don't have any support for
cookies, and every time I look through the cookie RFC I cringe at the
work I'd have to do to support cookies myself. Looking at posted stuff
on that topic, I see everyone referring to this one third-party
library, for example:
http://www.google.com/groups?selm=MP...ws.altopia.com
http://www.google.com/groups?selm=MP...ws.altopia.com
http://www.google.com/groups?selm=MP...0news.pop4.net
http://www.google.com/groups?selm=40...a.realtime.net
http://jakarta.apache.org/commons/ht.../features.html
http://jakarta.apache.org/commons/ht.../tutorial.html
http://jakarta.apache.org/site/binindex.cgi
you must verify the integrity of the downloaded files using
signatures downloaded from our main distribution directories.
I have no idea how to do that. The whole point of thinking of using
java instead of CL for this kind of application is that the
capabilities are built into java standard libraries whereas with CL I'd
have to hassle with a third-party library, but here we are with a java
third-party library and more problems than I can deal with.
Java's biggest use is in server-side programming
Given that CL runs native code, which is about ten times as fast as
java's emulated bytecode, java would seem to be inferior for any
server-side application that is going to be used a lot. And because
it's so much easier to develop new software in CL, CL would seem to be
preferable for applications that aren't going to be run a lot too. So
where exactly would java have any advantage over CL there?
A bigger weakness is that Java uses memory like a drunken sailor.
Are you talking about when you call library functions that take objects
as arguments and produce a result as a newly-allocated object to
return, and rely on gc to reclaim the space later, instead of doing the
more memory-efficient thing of overwriting one of the objects with the
result whenever the old object won't be needed again? Or are you merely
referring to the memory overhead inherent in any fullfledged object on
the heap, so if you have lots of objects simultaneously allocated
there's a lot of overhead in them all? Or are you referring to the need
to load a whole package or at least a whole class just to use one
method within it?
I like what I've seen of Lisp a _lot_, but right now it looks like a
much more viable language for hard problems that involve tricky
algorithms than for gluing together solutions out of pre-existing
components -- the components just aren't there.


That's illogical. From CMUCL I can call *any* application whatsoever
that's available on Unix, via EXT:RUN-PROGRAM, so anything available to
java is also available to CL. I typically run lynx, traceroute, whois,
telnet, mail, dig, readmsg, sh, and mv from CMUCL in that way. If I
knew of any useful java applications available here on my ISP, I might
call them from CMUCL too if I wanted to piece them together with other
stuff. Glueing various applications together with CMUCL EXT:RUN-PROGRAM
is better than using a traditional shell-scripting language, because it
can be used in either foreground or background mode, with nice clean CL
callback in the latter case. Also EXT:RUN-PROGRAM lets you specify
exactly what command-line arguments you want to pass to the called
program, without worrying that some characters are magic characters
that expand into something you didn't want. If you want to do a
directory lookup with some template, and pass that list of filenames to
a program, you call (DIRECTORY <template>) explicitly, and splice the
resultant list of filenames (after mapping through namestring or
somesuch of course) into the args argument to EXT:RUN-PROGRAM, and the
rest of the time you don't accidently invoke some magic character that
does an unwanted directory template filename expansion splice.
Jul 17 '05 #32
Ro********@Yaho oGroups.Com writes:
From: adam connor <ad************ *****@mail.com>
I like what I've seen of Lisp a _lot_, but right now it looks like a
much more viable language for hard problems that involve tricky
algorithms than for gluing together solutions out of pre-existing
components -- the components just aren't there.


That's illogical. From CMUCL I can call *any* application whatsoever
that's available on Unix, via EXT:RUN-PROGRAM, so anything available to
java is also available to CL. I typically run lynx, traceroute, whois,
telnet, mail, dig, readmsg, sh, and mv from CMUCL in that way.


By "components " Adam was probably referring not to complete existing
applications (which are trivial to call from any language I know) but
to documented, tested, and reused software libraries.
Jul 17 '05 #33
Ro********@Yaho oGroups.Com wrote:
but java's libraries don't have any support for cookies


Oh, you should check out http://www.jibble.org/cookies.php
:-)

Java's biggest use is in server-side programming


Given that CL runs native code, which is about ten times as fast as
java's emulated bytecode, java would seem to be inferior for any
server-side application that is going to be used a lot.


Could you please point out some benchmarks that show that CL runs
usually ten times faster then Java?
André
--
Jul 17 '05 #34
<Ro********@Yah ooGroups.Com> wrote in message
news:RE******** *******@Yahoo.C om...
From: adam connor <ad************ *****@mail.com>
Java's biggest advantage vs. Lisp is its libraries, which are huge.

Agreed.

(snip) Want to do GUI programming?

No, I have no use for that because my only access to the net from home
is via VT100 (text only) emulator through Unix shell.
Want to make a secure sockets connection?


No, I just want to make a simple HTTP/TCP/IP connection to Yahoo! Mail
and accept cookies to establish a login session and auto-traverse my
e-mail folders, but java's libraries don't have any support for
cookies, and every time I look through the cookie RFC I cringe at the


Java does have support for cookies and for HTTP / tcp/ip connections.

You should be able to write a utility to "login" to your Yahoo!Mail and get
your email.

Look at the java.net.* package especially classes URL and Socket.
Cookie is in javax.servlet.h ttp, although you can probably get away with
just the stuff in java.net.*

However for this kind of utility/glue-application Perl is probably a better
choice. Like Java it connects pretty well to just about everything.

About your question "Is anything easier to do in java than in lisp"?

Certainly yes.
Especially if one is as familiar with Java as you are with Lisp ;-)
For full-blown applications I'd certainly prefer Java, but for utilities
like this Perl, for certain kinds of AI apps Lisp ...

Alex

Jul 17 '05 #35
> From: ta*********@yah oo.com (Tayssir John Gabbour)
I do not know jikes's availability, but I suggest you move over to it.
% whereis jikes
jikes:
% man jikes
No manual entry for jikes

I don't believe jikes is available here on the ISP I'm using. I have
less than 20 megabytes remaining on my disk allocation, and I'll need
most of that myself. How much space does it take to install jikes on
FreeBSD Unix?
Applet security.
I don't think applets would work in lynx, the only Web browser I have
available here on VT100 dialup into Unix, so applets aren't anything I
can use.
READ in lisp is deadly. The fact *read-eval* can be set is
irrelevant; there should be syntactic sugar like say SAFEREAD.
Well as soon as we all agree what definition of safe-read or whatever
is most appropriate for various applications, such as CGI server-side
programs, then we can just start using it and be out of danger.
Concurrency or reasonable facsimile thereof.


As a single user on an ISP with hundreds of users, I'm rather reluctant
to do any multi-threading whereby the admin would notice I had a whole
slew of processes simultaneously running, putting an unfair load on the
system, and tell me to *stop*doing*tha t*.
Jul 17 '05 #36
> From: "Stijn De Saeger" <di*@spammers.d ie>
get a job?


Well actually that's the main reason why I'm taking the java
programming course. Early last year I saw a job ad that said "must be
able to perform duties using java", didn't say "requires 3 years
experience in (five or ten things, none of which I've ever done
before)" like all the other job ads did, so it looked like my 22 years
computer programming experience plus java might qualify me for any
similar job that turns up now. So now that I know how to program in
java, I can now perform job duties in java, what suitable jobs are
available for me?

By the way, 16 of my 22 years programming experience is in lisp, but I
haven't seen lisp programming job openings for many years.
Jul 17 '05 #37
> No, I just want to make a simple HTTP/TCP/IP connection to Yahoo! Mail

like http://yahoopops.sourceforge.net/ ?
"YahooPOPs!/Windows 0.6 has been released" (also Linux)

It's C/C++ so I'm way off-topic. Just thought someone might be interested.

With v 0.5 I noticed it lost my line feeds in plain-text messages. Kind-of
annoying.
Just tried 0.6; it seems not to have that problem.
Jul 17 '05 #38
> From: Kenny Tilton <kt*****@nyc.rr .com>
look at all the seedlings:
http://www.common-lisp.net/projects.shtml
I browsed through there but didn't see anything that looked like HTTP
sessions with cookies. Did I overlook it, or is there indeed nothing
like that among those seedlings?
The old farts are working on useful application stuff.


That's a rather obscene derogatory way of referring to another human
being. Please translate that into decent language so I know who you're
referring to. If you mean anyone with more than 20 years programming
experience, well we're unemployed, unable to find anyone to pay us for
our fine work, borrowing on credit cards just to pay rent to avoid
being homeless, looking toward maxing credit cards and becoming
homeless in a few months if unemployment continues.
Jul 17 '05 #39
> From: Lowell Kirsh <lk****@cs.ubc. ca>
Any of you heard of BeanShell? It's a REPL for Java.


After you mentionned it, I took a look at its Web-based documentation.
It looks interesting to try. I have less than 16 megabytes available in
my shell account, and I'll need most of that already. How much of that
would be consumed by downloading and installing BeanShell?
Jul 17 '05 #40

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.