HDTenEightyP/NetNews huggingface dataset:
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: What do compilers optimize?
Date: 31 Aug 1992 20:33:05 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <7398@skye.ed.ac.uk> jeff@aiai.ed.ac.uk (Jeff Dalton) writes:
>(Do any Lisp implementors read this newsgroup?)

KMP of Symbolics has been participating quite a bit lately.  I know some
Lucid people read it but don't post much.

>Are there any implementations that do any of the following (or
>something similar):
>
>  * Turn a CASE in which the alternatives are integers into
>    an indirect transfer?

Symbolics and Lucid do this.  My gripe with the Symbolics implementation is
that it won't do the optimization if the case values are a dense set not
near 0 -- it doesn't want to create a sparse jump table, and it doesn't try
to offset the value to the base of the set.

Surprisingly, CMUCL doesn't do this optimization at all.

An interesting enhancement to this optimization would be to recognize when
the case values are a sparse set of dense sets, e.g.

(case x
  ((0 1 2 3 4 5 6) ...)
  ((7 9 11) ...)
  ((30 31 32) ...)
  ((33 34 35) ...)
  ((95 97 99 101) ...))

and transform this into

(cond ((<= 0 x 11)
       (case x ((0 1 2 3 4 5 6) ...)
	       ((7 9 11) ...)))
      ((<= 30 35)
       (case x ((30 31 32) ...)
	       ((33 34 35) ...)))
      (t (case x ((95 97 99 101) ...))))

I could imagine the above style of code being in the implementation of a
byte code interpreter.  A processor emulator might be similar, although the
dense sets would likely be found clustered above power-of-two values,
allowing for further optimization; instead of the outer level being a COND,
it could be another CASE that indexes off the high-order bits of the
opcode, which is likely to be a dense set that can be turned into a jump
table.

>  * Use hashing for a CASE with many alternatives?

Neither Symbolics, Lucid, nor CMUCL appear to do this.

>  * Allow fixnums (or floats) to be passed between procedures without
>    any heap allocations (maybe just for local procedures in the same
>    top-level form)?

Most implementations implement fixnums as immediate values, so they are
never allocated on the heap.  Symbolics also implements single floats as
immediate types.  I don't expect any implementations for conventional
32-bit processors to do this, though, since single floats take 32 bits, and
that doesn't leave any room for tags.  I believe this was the original
intent of the small-float type, but apparently it's not useful enough (most
FP hardware only supports 32 and 64 bit floats, and the limited precision
of smaller floats probably makes them pretty useless).

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.lisp
From: charest@Aig.Jpl.Nasa.Gov (Len Charest)
Subject: Re: A question: Dynamic type check
Reply-To: charest@aig.jpl.nasa.gov
Organization: NASA/Jet Propulsion Laboratory
Date: Fri, 28 Aug 1992 19:22:33 GMT

In article <10026@uqcspe.cs.uq.oz.au>, gong@cs.uq.oz.au (Ming Gong) writes:
|> I want to know *at run time* whether or not a expression is a function. 
|> Can some knowledgeable people tell me how?

If the expression is bound to a variable X then
	(functionp x)
should do the job.

|> For example, I have a lisp function PLUS implementing 
|>      lambda x. lambda y. x + y
|> then (funcall (PLUS) 3) is a function and will printout something like
|>      #<Function PLUS ....>.

Some observations: if PLUS is a Lisp function then the form (PLUS) is a call to that function with no arguments; furthermore (funcall (PLUS) 3) is a call to the *result* of (PLUS) with the argument 3. I'll assume that you mean (PLUS) returns the function object and that object is what prints as #<Function PLUS ....>. This suggests that PLUS is not an ordinary Lisp function object, but rather some custom data structure that you implemented yourself.

|> The questions are: can I access such information within a lisp program
|> and how?

If the functions in question are true Lisp function objects, then FUNCTIONP should work as described above. Otherwise, the answer depends on your implementation of these 'functions'. For example, if you used DEFSTRUCT to define the data structure then a type-discriminating predicate would be automatically created. E.g.,

(defstruct function
  name
  lambda-list
  code)

> (setq test (make-function :name 'plus :lambda-list '(x y)
                            :code '(+ x y)))
TEST
> (function-p test)
T
..................................................
                                  Len Charest, Jr.
                 JPL Artificial Intelligence Group
                          charest@aig.jpl.nasa.gov
From: mkant+@cs.cmu.edu (Mark Kantrowitz)
Newsgroups: comp.lang.lisp
Subject: Re: Defsystem: Is this is a feature or a bug?
Date: 27 Aug 92 21:38:38 GMT
Article-I.D.: cs.Btnw4H.Gwn.1
Organization: School of Computer Science, Carnegie Mellon

T. V. Raman writes:
> With the above setup if I do:
> (load-system 'main)
>
> I get the following error:
>     package sub1 is not valid: supply a new package.
>
> All explanations/tips welcome, maybe there is a good reason why
> defsystem does the above.
>
> I am using lucid common lisp 4.1 on a sparc station with the defsystem
> available from cmu in the lisp-utilities directory.

When a package is specified as part of a system, the current version
of defsystem uses IN-PACKAGE to switch to the package. This will not
work correctly in a CLtL2-compliant Lisp, since IN-PACKAGE no longer
creates the package if it doesn't already exist. I would recommend
placing the defpackage forms in a file which is loaded at the
beginning of the system (e.g., all the rest of the files in the system
depend on it), and placing appropriate IN-PACKAGE forms in the
beginning of each file of the system.

--mark
Newsgroups: comp.lang.lisp
From: Stephen Cooper <stephen@csd.uu.se>
Subject: Re: style-guide
X-Xxdate: Wed, 26 Aug 92 13:24:01 GMT
Organization: Uppsala University
X-Useragent: Nuntius v1.1.1d7
Date: Wed, 26 Aug 1992 12:23:29 GMT

In article <PK.92Aug26100014@talitiainen.cs.tut.fi> Kellom{ki Pertti,
pk@cs.tut.fi writes:
>I tried to mail, but it bounced, so...
That's strange...

>In article <1992Aug25.151059.9936@corax.udac.uu.se> Stephen Cooper 
><stephen@csd.uu.se> writes:
>   If I can find an online English copy of the paper, I'll mail a copy to
>   interested parties, or
>   post it if there's enough push for it.
>
>I would like to have a copy of your style guide.

Yes, well you're not alone.  An online copy of the file exists, but in
Swedish.
The original author of the file isn't here today, so I'll have to wait
for him
to show up in order to get permission to translate & post the style
guide.  The
guide has increased dramatically in size since I last saw it, so the
translation
might take a while.  If I get the author's permission, I'll post the
article to
this newsgroup.  I just hope I haven't bitten off more than I can chew :-)

--Stephen
-----------------------------------------------------------
Stephen Cooper  	       	       	+46-(0)18-18 10 73 (voice)
Computing Science Dept  	       	+46-(0)18-52 12 70 (fax) 
Uppsala University, Sweden      	stephen@csd.uu.se
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: Can I use EVAL?
Date: 28 Aug 1992 21:11:27 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <danny-280892103325@danny.farallon.com> danny@farallon.com (Danny Brewer) writes:
>Other pattern directive examples would be:
...
>   (?:*  ?items   (LAMBDA (items) (SUBSETP (INTERSECTION items *x*) *y*)))
>
>The last example would match some items which when intersected with
>the special variable *x* are a subset of special variable *y*.

I suggest that you require the user to supply the actual function object in
that case.  He can do this by using backquote to construct the pattern that
he supplies to MATCH:

(match `((?:* ?items ,#'(lambda (items) (subsetp intersection items *x*) *y*)))
       data)

Besides solving your problem of having to use EVAL or COMPILE to execute
it, it also allows the user to supply a local function (i.e. one defined
using FLET or LABELS), an expression that evaluates to a function, or a
lexical closure, e.g.

(defun example (data predicate)
  (flet ((local-predicate (items) (every #'numberp items)))
    (match `((?:* ?x ,predicate) (?:* ?y ,#'local-predicate)
	     (?:* ?z ,#'(lambda (items) (member (car (last items)) '(a b c)))))
	   data)))

In all these cases, you can use FUNCTIONP to detect that the third element
of the list is a function (note, however, that CLtL1 specified that
FUNCTIONP is true for all symbols, even if they don't have function
bindings, so you should check this case after most others).
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.lisp
From: huyn@hplabsz.hpl.hp.com (Pierre Nam Huyn)
Subject: LCL+foreign functions+multitasking
Date: Wed, 26 Aug 1992 21:39:41 GMT
Organization: Hewlett-Packard Laboratories Palo Alto,CA

Functions (in C) that normally block (e.g. read function)
no longer do so when imported to LCL. The hypothesis is
that multitasking within LCL interferes with the OS scheduling.
I tried "with-scheduling-inhibited" without success.

Questions:
1. Do other LCL users experience the same problem (I'm using
   LCL4.0 under HPUX7.0 on a HP9000/370.
2. If it is a common problem, is there any fix for it.

Thanks.
----------
Pierre Huyn, huyn@hplabs.hp.com
From: skutvik@sleepy.UUCP ( ECMS TEST)
Newsgroups: comp.lang.lisp
Subject: Re: style-guide
Summary: Me too!
Date: 27 Aug 92 00:10:08 GMT
Organization: Boeing Computer Services, Seattle

In article <PK.92Aug26100014@talitiainen.cs.tut.fi>, pk@cs.tut.fi (Kellom{ki Pertti) writes:
> I tried to mail, but it bounced, so...
> In article <1992Aug25.151059.9936@corax.udac.uu.se> Stephen Cooper <stephen@csd.uu.se> writes:
>    If I can find an online English copy of the paper, I'll mail a copy to
>    interested parties, or
>    post it if there's enough push for it.
> 
> I would like to have a copy of your style guide.

I too would like a copy
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: Freezing a variable: how?
Date: 28 Aug 1992 20:59:50 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com
Keywords: Freezing variables: Declaring as constant from here on after:

In article <1992Aug28.155335.12562@cs.cornell.edu> raman@cs.cornell.edu (T. V. Raman) writes:
>After an initial setup phase, I would like to declare a variable as
>being unmodifiable. ... Is there a standard way of doing this?

No.  Constantness of a variable is a lexical property, not a dynamic one.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Newsgroups: comp.lang.lisp
Subject: Re: Free CL with CLOS: advice?
Date: 1 Sep 92 15:02:18 GMT
Organization: AIAI, University of Edinburgh, Scotland

In article <1992Sep1.093746.10481@waikato.ac.nz> bcs@waikato.ac.nz writes:
>Hi all,
>
>I've been asked to find a good cheap/free (sound familiar?) CL with CLOS
>support.  We've had akcl for some time, but I can find no mention of the
>object system in it's readmes or docs (I'm not a lisp practitioner, I just
>run the machines).  I just spotted the release note for the CMU CL distrib-
>ution, and that does offer CLOS in some form.
>
>I guess the question is: is CMU CL the way to go (no offence guys!)?  Or is
>there another CL with CLOS out there on the net somewhere that might be
>better?

CMU CL is excellent if you have a machine it will run on.  (I'd
like a 386/486 port, but it looks like I won't get one, because
a 386 is the wrong kind of machine in terms of number of registers,
among other things.)

PCL (the nearly-portable CLOS) will run in KCL.  It works fairly well
but can be a bit of a pain when CLOS calls COMPILE (which is slow in
KCL).

What I'd like to see is for [A]KCL to catch up with CLtL II / the
spANS and for PCL-in-KCL to be able to avoid both COMPILE and the
pessimizing process you get if you just make COMPILE a no-op.

-- Jd

Ok, so I didn't send via e-mail.  Sorry.
From: bcs@waikato.ac.nz
Newsgroups: comp.lang.lisp
Subject: Free CL with CLOS: advice?
Date: 1 Sep 92 09:37:46 +1200
Organization: University of Waikato, Hamilton, New Zealand

Hi all,

I've been asked to find a good cheap/free (sound familiar?) CL with CLOS
support.  We've had akcl for some time, but I can find no mention of the
object system in it's readmes or docs (I'm not a lisp practitioner, I just
run the machines).  I just spotted the release note for the CMU CL distrib-
ution, and that does offer CLOS in some form.

I guess the question is: is CMU CL the way to go (no offence guys!)?  Or is
there another CL with CLOS out there on the net somewhere that might be
better?

TIA, replies by mail puh-leez.

Oh, and yes - I always hate this kind of posting too 8-)

+-Brent Summers, U of Waikato, NZ----------------------------------------+
|    "Laugh and the world ignores you.  Crying doesn't help either."     |
|      All opinions expressed are, of course, solely my own errors.      |
+------------------------------------------------------bcs@waikato.ac.nz-+
From: sjameson@atl.ge.com (Stephen M Jameson)
Newsgroups: comp.lang.lisp
Subject: Re: Defsystem: Is this is a feature or a bug?
Date: 26 Aug 92 16:39:27 GMT
Organization: General Electric Company

[***]
>With the above setup if I do:
>(load-system 'main)
>
>I get the following error:
>package sub1 is not valid: supply a new package.
>
[***]
>All explanations/tips welcome, maybe there is a good reason why
>defsystem does the above.
>
>--Raman
>-- 

You do not indicate what Lisp you are using.  If you are using a Symbolics, I
would guess that the problem is that the file sub1.system (or whatever the
system declaration file is) has ";;; -*- ... Package:  SUB1" in the header
line, and as soon as it tries to read the file, it complains about the lack of
this package.  As someone else has pointed out (probably barmar), all system
and package declaration files should be created and read in the USER package.
If you are not using a Lispm, I would need more information.  

Good luck.

-- 
Steve Jameson                           General Electric Aerospace 
sjameson@atl.ge.com                     Advanced Technology Laboratories
                                        Moorestown, New Jersey              
****************************************************************************
From: lang@cs.tulane.edu (Raymond Lang)
Subject: Re: Scheme equivalence in CL
Organization: Computer Science Dept., Tulane Univ., New Orleans, LA
Date: Tue, 1 Sep 1992 23:47:12 GMT
Nntp-Posting-Host-[nntpd-23262]: okeanos

In article <gecyA4y00awM4OQVkQ@andrew.cmu.edu> Stefan Monnier <sm86+@andrew.cmu.edu> writes:
>In scheme I just would do:
>       (define state-equal equal)
>
>But in common-lisp, the best I found was:
>       (defun state-equal #'equal)
>
>When I call it, CL has no problems: it is recognized as a function,
>it needs 2 parameters, BUT it ALWAYS returns NIL !!
>
>I know I can redefine it more completely:
>       (defun state-equal (x y) (equal x y))
>
>But the scheme way is so much nicer that I'm sure there is an
>equivalent way in CL.

The following will copy over a definition:

(setf (symbol-function 'state-equal) #'equal)

Ray Lang
lang@cs.tulane.edu
From: haitham@Chemeng.Ed.Ac.Uk (Haitham Lababidi)
Newsgroups: comp.lang.lisp
Subject: standard output and standard error
Date: 27 Aug 92 08:46:14 GMT
Reply-To: haitham@Chemeng.Ed.Ac.Uk
Organization: Edinburgh University Chemical Engineering Department.
Originator: haitham@stow

I created a program (using DISKSAVE) which reads from standard input and
writes to standard output. The problem is that I want to differentiate between
two sorts of output. The first one is the program output which can be
directed to a file (i.e. under unix: % myprogram < input > output). The other
type include messages concerning the progress of the program which should
appear on the screen.

In LCL4.0 *standard-output* stream is equal to *error-output*. So the output
directed through any of these will make no difference. Even *terminal-io* is
the same. I don't want to direct the error output (or progress messages) to
a file because it is important for the user to see.

Another question: is there a way to decrease the size of the program (Lisp Image)?

Thank you in advance for your help.


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Dr. Haitham Lababidi                       Tel  +44 31 650 4862
    Department of Chemical Engineering         Email haitham@uk.ac.ed
    Edinburgh University                                              
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Newsgroups: comp.lang.lisp
From: shekar@femto.cs.umn.edu (Shekhar H. Kirani)
Subject: LISP parser for ANSI C
Summary: Request for lisp parser for ANSI C
Keywords: ANSI C, LISP, parser
Organization: University of Minnesota
Date: Thu, 3 Sep 1992 00:17:13 GMT

Hi,

We are building a software maintenance tool for ANSI C programs in
Common Lisp. So far, we had used Lex/Yacc for parsing C programs to
files and then reading the parsed output from these files in LISP. We
want to parse the C programs in LISP directly now. 

I would like to know whether some one has implemented ANSI C parser in
Lisp and if so is it available for use.

Thanks,

Shekhar Kirani
shekar@cs.umn.edu
----------------------------------------------------------------
Shekhar Kirani				Computer Sc. Dept, 200
1530, S.6th. St., C-410			Union St., Univ. of Minnesota
Minneapolis, MN-55454.			Minneapolis, MN-55455.
Ph: (home) 612-341-0256. 		(off)  612-625-4029.
----------------------------------------------------------------
From: mbp@generali.harvard.edu (Mark B Palmerino)
Newsgroups: comp.lang.lisp
Subject: CMUCL for A/UX
Date: 4 Sep 92 14:56:32 GMT
Organization: Harvard University, Cambridge, MA

Has anyone gone through the trouble of getting CMUCL to work on a machine
running A/UX (Apple's Unix)? I'm looking at that daunting task and am
hoping that others have already paved the way.

Is there any reason why I should forget this approach if I decide to try
it? (Any comments from those at cmu working on CMU CL would be greatly
appreciated).

Thanks.

-- 
========================================================================
Mark Palmerino, Ph.D.    mbp@wjh12.harvard.edu     Voice: (617) 345-9500
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: static, a.k.a. eval-once
Date: 31 Aug 1992 21:22:28 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <7399@skye.ed.ac.uk> jeff@aiai.ed.ac.uk (Jeff Dalton) writes:
>About 4 years ago, I wrote an EVAL-ONCE macro.  It appears, with
>an explanation below.  It has been claimed that my macro isn't
>portable because the behavior of gensyms isn't sufficiently
>restricted when compile and load is involved.  What I want to
>know is:
>
>  1. Is there a problem with using GENSYM this way?

I think it should work.  While the compiler has to arrange for all
references to a particular gensym within a binary file to be the object,
similarly named gensyms in different binary files should refer to different
instances.

BTW, I assume you realize that V should be a gensym, i.e. it should be:

I think your version can be simplified a bit.  The expansion doesn't need a
LET binding:

(defmacro eval-once (form)
  (let ((var (gensym)))
    `(if (boundp ',var)
	 (symbol-value ',var)
	 (set ',var ,form))))

>  2. Is there a better way to get what I want.

Not that I can think of quickly (I thought of using something like Scheme's
delay/force, but it didn't work).

This looks suspiciously like the stuff we were discussing a few months ago,
where you wanted the ability to have modifiable literals in your program.
If that were allowed, you could do:

(defstruct eval-once
  (done nil)
  value)

(defmacro eval-once (form)
  (let ((struct (make-eval-once)))
    `(if (eval-once-done ',struct)
	  (eval-once-value ',struct)
	  (setf (eval-once-done ',struct) t
		(eval-once-value ',struct) ,form)))))

>  3. Is there a way that will get the EVAL-ONCE effect in
>     interpreted code even in an "expand macros each time"
>     implementation?  (N.B. There is no correct portable way
>     to use *macroexpand-hook* cache macro expansions --
>     see page 204 of CLtL II.)
...
>For the interpreted code problem, I can't think of anything better
>than having EVAL-ONCE assume that EQ forms are never logically
>different expressions.

I can't think of another way, either.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: lcl problems
Date: 31 Aug 1992 04:43:48 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: gandalf.think.com
Keywords: lcl clx clue sun

In article <travt.715230213@marsh> travt@marsh.cs.curtin.edu.au (Tony Travers) writes:
>Whilst compiling clue (you need clx and pcl already loaded) the lisp
>errors saying that export is an undefined function (note any command
>typed after this is undefined ... including cons).  Can anyone tell me
>what is going wrong, is it the package, my lisp, memory, me......??????

Sounds like CLUE is defined in a package that didn't specify :USE 'LISP
when it was created.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Newsgroups: comp.lang.lisp
Subject: Re: style-guide
Keywords: style
Date: 28 Aug 92 16:53:06 GMT
Organization: AIAI, University of Edinburgh, Scotland

In article <1992Aug28.004913.1@cc.helsinki.fi> pirinen@cc.helsinki.fi writes:
>You rightly emphasise using 'the most specific construct'.  This, to my
>mind, is the central principle of technical communication, although 'the
>most appropriate construct' might be a better way of putting it.  

That's not a better way of putting it, it's saying something
different.  Picking the most appropriate construct does not
necessarily require picking the most specific one.

>Strunk & White put it in their usual admirably terse and concrete style: 'the
>right word in the right place' (I also don't have my style guides handy,
>but I think I remember that right). 

That's fine unless it's taken to mean there's always a single right
word.

>There should probably be a whole chapter on the pitfalls of complex setf
>methods.  I might write that chapter when I return my erstwhile
>employer, Harlequin, and regain access to some good examples of them. 

I tend to think the answer to the problems of complex SETF methods
is not to use them (though I have used them once or twice), so I'd
be interested in seeing some good examples.

>CATCH and THROW have their place, when you truly want dynamic scope and
>a restart is not appropriate.  They could, however, often be replaced by
>using RETURN-FROM encapsulated in a closure, a technique a CL programmer
>should understand anyhow. 

It might be useful to have some guidance on when to make this
replacement.  Anyway

>Macros are a major reason why Lisp is such a great language to write
>programs in.  They are a great aid to clarity, if used adroitly.  Macro
>writing is the touchstone of a Lisp programmer's skill.  Therefore do
>beware, but do dare!

Just so.

-- jd