comp.lang.ada
 help / color / mirror / Atom feed
From: pierson@mist (Dan Pierson)
Subject: Re: Ada vs. LISP (Response to Robert Eachus's second posting)
Date: 21 Mar 89 17:02:21 GMT	[thread overview]
Message-ID: <5170@xenna.Encore.COM> (raw)
In-Reply-To: rar@ZOOKS.ADS.COM (Bob Riemenschneider)

In article <8903152108.AA06589@zooks.ads.com>, rar@ZOOKS (Bob Riemenschneider) writes:
>There are exceptions, however.  Based on your latest posting, I take it
>you believe "(apply (read) (read))" to be a specially concocted example,
>intended to make your claim sound dubious.  It wasn't; it was a (simplified) 
>example taken from an actual Lisp application.  (The program supports
>interactive multi-attribute utility analysis.  Rather than having the 
>user supply weights used in a linear combination of utilities across
>attributes, the user is asked for an arbitrary computable function from
>[0,1]^number-of-attributes to [0,1] to be used for combination.  The
>designer (me) has arguments that, for many applications, non-linearity
>is required.)  When time for considering translation to another language
>came around, "(apply (read) (read))"--which, when expanded out to include the
>syntactic analysis of the sexpr read in, etc., made up a goodly chunk of
>the program--was the only really hard part.  Writing a simple Lisp-interpreter
>equivalent was evidently necessary, as you observed.  I asked about
>"(apply (read) (read))" because I wanted to know whether either of the
>AdaLISP submissions you received contained at least a simple interpreter
>of the sort you sketch in your posting.  I still want to know.

My only complaint with this is the assumtion that a Common Lisp
_interpreter_ is the correct (or only solution).  It seems likely that
the computable functions mentioned above would be reused several times
in an analysis session.  Therefore they should run as quickly as
possible and the user should have a way to list the previously entered
functions and reselect one.  This means that "(apply (read) (read))"
might be better expressed as:

    (let* ((form (read))
           (fast (compile nil form)))
      (save-form form fast)
      (apply fast (read)))

Doing this in Ada would require implementing a complete Common Lisp
incremental compiler.  Of course, you could do that, but it hardly
seems worth the effort.

Of course, the functions in the actual application described may be
small enough that the overhead of incremental compilation is greater
than the overhead of interpreting the function.  There are
applications in which incremental compilation is nearly vital, there
are others in which it merely wastes resouces, and there are some in
which is makes sense for the program to initially save the interpreted
form and compile it when and if its usage pattern indicates that
compilation would result in a net savings.
-- 
                                            dan

In real life: Dan Pierson, Encore Computer Corporation, Research
UUCP: {talcott,linus,necis,decvax}!encore!pierson
Internet: pierson@encore.com

      parent reply	other threads:[~1989-03-21 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-03-15 21:08 Ada vs. LISP (Response to Robert Eachus's second posting) Bob Riemenschneider
1989-03-16 18:34 ` Robert Eachus
1989-03-21 17:02 ` Dan Pierson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox