From: Phil Stratton
Subject: LISP w/ Java
Date: 
Message-ID: <6rd7h2$ng0$1@ash.prod.itd.earthlink.net>
Greetings,

Does anyone know of a simple (or even not so simple) way to interface Lisp
and Java?  I want to write some interface agents in Java, but I think the
easiest way to get the little guys to reason is by using Lisp.  Is there an
easy way to do this (and portably as an aside)?  Or will I have to reason in
Java, too?

TIA

Phil Stratton

From: Kjetil Valstadsve
Subject: Re: LISP w/ Java
Date: 
Message-ID: <jw4yaslorx8.fsf@ra.pvv.ntnu.no>
"Phil Stratton" <········@sprintmail.dot.com> writes:

> Does anyone know of a simple (or even not so simple) way to
> interface Lisp and Java?  I want to write some interface agents in
> Java, but I think the easiest way to get the little guys to reason
> is by using Lisp.  Is there an easy way to do this (and portably as
> an aside)?  Or will I have to reason in Java, too?

Have you considered CORBA or, someone (please) forbid, COM, as a
middleware solution? I think ACL 5.0 supports this, last I heard.

-- 
 - Musicians. And I don't mean good musicians, I mean jazz musicians
 < Kjetil Valstadsve <···@pvv.org>, <··@computas.com>              <
 >                                <URL:http://www.pvv.org/~eddie/> >
From: Jeff Dalton
Subject: Re: LISP w/ Java
Date: 
Message-ID: <x2soirzd2r.fsf@gairsay.aiai.ed.ac.uk>
Kjetil Valstadsve <·····@pvv.ntnu.no> writes:

> "Phil Stratton" <········@sprintmail.dot.com> writes:
> 
> > Does anyone know of a simple (or even not so simple) way to
> > interface Lisp and Java?  I want to write some interface agents in
> > Java, but I think the easiest way to get the little guys to reason
> > is by using Lisp.  Is there an easy way to do this (and portably as
> > an aside)?  Or will I have to reason in Java, too?
> 
> Have you considered CORBA or, someone (please) forbid, COM, as a
> middleware solution? I think ACL 5.0 supports this, last I heard.

You should be able to run Lisp from Java (or on some other way
get them both going) and arrange pipes or sockets for communication.
Then you can send things back and forth as Lisp-syntax text.  All
you need is some Java code for parsing such things into Lists, etc
(which is not very hard to do, I say, having done it).

-- jd
From: Kjetil Valstadsve
Subject: Re: LISP w/ Java
Date: 
Message-ID: <jw4btpenzbf.fsf@ra.pvv.ntnu.no>
Jeff Dalton <····@gairsay.aiai.ed.ac.uk> writes:

> You should be able to run Lisp from Java (or on some other way get
> them both going) and arrange pipes or sockets for communication.
> Then you can send things back and forth as Lisp-syntax text.  All
> you need is some Java code for parsing such things into Lists, etc
> (which is not very hard to do, I say, having done it).

Errr... So have I, actually, come to think of it. Have you made a
Cons.class yet?

-- 
 - Musicians. And I don't mean good musicians, I mean jazz musicians
 < Kjetil Valstadsve <···@pvv.org>, <··@computas.com>              <
 >                                <URL:http://www.pvv.org/~eddie/> >
From: Jeff Dalton
Subject: Re: LISP w/ Java
Date: 
Message-ID: <x2g1ekq4r6.fsf@gairsay.aiai.ed.ac.uk>
Kjetil Valstadsve <·····@pvv.ntnu.no> writes:

> Jeff Dalton <····@gairsay.aiai.ed.ac.uk> writes:
> 
> > You should be able to run Lisp from Java (or on some other way get
> > them both going) and arrange pipes or sockets for communication.
> > Then you can send things back and forth as Lisp-syntax text.  All
> > you need is some Java code for parsing such things into Lists, etc
> > (which is not very hard to do, I say, having done it).
> 
> Errr... So have I, actually, come to think of it. Have you made a
> Cons.class yet?

Yes.  But after doing lists one way, with separate Cons and Null
classes, as in Common Lisp, I though it might fit better with Java
to just have a List class and make code do explicit tests for 
Lisp.NIL.  Then one could define a subclass of List, rather
than of Cons, to implement such things as "lazy lists" (like
SICP streams).

One thing I noticed along the way was that when people add lists
to Java, they're modifiable, and in effect headed, lists.  That is,
they're like the following sort of thing in Lisp:

  (defstruct singlyLinkedList
    (contents '()))

And then you can, e.g., 

  (defmethod pushElement((s singlyLinkedList) new-elt)
    (push new-elt (singlyLinkedList-contents s)))

-- jeff
From: Barry Margolin
Subject: Re: LISP w/ Java
Date: 
Message-ID: <ecEE1.64$Sm5.1270087@burlma1-snr1.gtei.net>
In article <··············@gairsay.aiai.ed.ac.uk>,
Jeff Dalton  <····@gairsay.aiai.ed.ac.uk> wrote:
>One thing I noticed along the way was that when people add lists
>to Java, they're modifiable, and in effect headed, lists.  That is,
>they're like the following sort of thing in Lisp:
>
>  (defstruct singlyLinkedList
>    (contents '()))

That's the typical way that lists, queues, trees, etc. tend to be
implemented in most non-Lisp-like languages.  They almost always have
separate data types to represent the collection as a whole and the
individual nodes.  One feature of this is that it permits certain types of
polymorphism that are difficult to achieve when you use a single data type
(CONS) to represent both collections and nodes.  It also permits the
collection to have its own identity; destructive functions like SORT,
NREVERSE, and DELETE will do what users intuitively expect, and they won't
run into problems due to multiple references.  And it avoids the user of
the collection structure having to deal with explicit pointers in languages
that would require them.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
From: Per Bothner
Subject: Re: LISP w/ Java
Date: 
Message-ID: <6rgcbf$dr7$1@rtl.cygnus.com>
In article <············@ash.prod.itd.earthlink.net>,
Phil Stratton <········@sprintmail.dot.com> wrote:
>Does anyone know of a simple (or even not so simple) way to interface Lisp
>and Java?

There are various implementatins of Lisp-family languages in Java.
The most advanced, in my rather biased opinion (as author) is
Kawa.  This assumes you consider Scheme to be "Lisp";  if you don't,
Kawa should provide a good start on which to build something closer to
your preference, as I am extending Kawa to be a multi-language toolkit.
See: http://www.cygnus.com/~bothner/kawa.html.
-- 
	--Per Bothner
Cygnus Solutions     ·······@cygnus.com     http://www.cygnus.com/~bothner
From: Joachim Achtzehnter
Subject: Re: LISP w/ Java
Date: 
Message-ID: <m290kkrryt.fsf@kraut.bc.ca>
"Phil Stratton" <········@sprintmail.dot.com> writes:
>
> Does anyone know of a simple (or even not so simple) way to
> interface Lisp and Java?  I want to write some interface agents in
> Java, but I think the easiest way to get the little guys to reason
> is by using Lisp.

Most Lisp implementations have a way to communicate with other
processes. You can use low level mechanisms like foreign function
calls to C (and to Java from there), or TCP/IP sockets. Or you can use
a higher-level mechanism like CORBA. We are doing the latter in a
current project, except we use C++ for the UI instead of Java. CORBA
has defined a standard mapping for Java and many ORBs support
it. There are fewer choices for Lisp. One possibility is ILU from
Xerox/PARC which supports Common Lisp (Franz Allegro), and which we
found reasonably stable and reliable.

Joachim

-- 
private:  ·······@kraut.bc.ca    (http://www.kraut.bc.ca)
work:     ·······@mercury.bc.ca  (http://www.mercury.bc.ca)