From: Dorai Sitaram
Subject: idle puzzle
Date: 
Message-ID: <a8flcq$jk6$1@news.gte.com>
In CL, if you type

(setq x 25) 

at the top-level repl, you will get

25

back, regardless of what identifier x is, right?
Well, there is an identifier, let's call it y, for
which

(setq y 25)

does not return 25 (and does not error).  What is
y?

(Hope this isn't too easy.  It took me a while to
figure out what was happening when I happened to use
this identifier.)

From: Chris Kirkwood-Watts
Subject: Re: idle puzzle
Date: 
Message-ID: <3cab622f$1@news.mhogaming.com>
 __ ····@goldshoe.gte.com (Dorai Sitaram) _____
| In CL, if you type
| 
| (setq x 25) 
| 
| at the top-level repl, you will get
| 
| 25
| 
| back, regardless of what identifier x is, right?
| Well, there is an identifier, let's call it y, for
| which
| 
| (setq y 25)
| 
| does not return 25 (and does not error).  What is
| y?

  One answer after spoiler space.



  *print-base*

Chris.
From: Joe Marshall
Subject: Re: idle puzzle
Date: 
Message-ID: <CnJq8.395$%s3.690984@typhoon.ne.ipsvc.net>
"Chris Kirkwood-Watts" <········@gauss.totzeit.net> wrote in message
···············@news.mhogaming.com...
> __ ····@goldshoe.gte.com (Dorai Sitaram) _____
> | In CL, if you type
> |
> | (setq x 25)
> |
> | at the top-level repl, you will get
> |
> | 25
> |
> | back, regardless of what identifier x is, right?
> | Well, there is an identifier, let's call it y, for
> | which
> |
> | (setq y 25)
> |
> | does not return 25 (and does not error).  What is
> | y?
>
>   One answer after spoiler space.
>
>
>
>   *print-base*

As an April fools joke many years ago I set that
variable to 9 (decimal).  The victim noticed that
the math results seemed a little off, but simple
experiments (like adding 2 and 3) came out ok.
It is *really* hard to notice that there aren't any
9s in the output.
From: Harald Hanche-Olsen
Subject: Re: idle puzzle
Date: 
Message-ID: <pcosn6cbi8b.fsf@thoth.math.ntnu.no>
+ Chris Kirkwood-Watts <········@gauss.totzeit.net>:

|  __ ····@goldshoe.gte.com (Dorai Sitaram) _____
| | Well, there is an identifier, let's call it y, for
| | which
| | 
| | (setq y 25)
| | 
| | does not return 25 (and does not error).  What is
| | y?
| 
|   One answer after spoiler space.
| 
|   *print-base*

That is not right.  The form still *returns* 25 - the return value
just gets *printed* as 10, which is something entirely different.

I still can't figure it out - why would it not be a violation of the
standard to return anything other than 25?  The Hyperspec says

result---the primary value of the last form, or nil if no pairs were supplied.

which seems quite specific to me.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Yes it works in practice - but does it work in theory?
From: Rahul Jain
Subject: Re: idle puzzle
Date: 
Message-ID: <877knocxzj.fsf@photino.sid.rice.edu>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> In CL, if you type

> (setq x 25) 

> at the top-level repl, you will get

> 25

> back, regardless of what identifier x is, right?

No. If X is not defined at the toplevel, what happens is undefined.

In CMUCL, e.g., see (describe '*top-level-auto-declare*)

> Well, there is an identifier, let's call it y, for
> which

> (setq y 25)

> does not return 25 (and does not error).  What is
> y?

My guess is that one of the REPL variables (+ * - /) is the answer in
some implementations.
 - If it's declared at toplevel, no problem.
 - If it's an unbound variable, you'll probably get an error or a
   warning and it'll be set anyway.
 - If it's a constant, you should get an error.

> (Hope this isn't too easy.  It took me a while to
> figure out what was happening when I happened to use
> this identifier.)

-- 
-> -/                        - Rahul Jain -                        \- <-
-> -\  http://linux.rice.edu/~rahul -=-  ············@techie.com   /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook  \- <-
-> -\  people if [they] try to walk around on their own. I really  /- <-
-> -/  wonder why XML does not." -- Erik Naggum, comp.lang.lisp    \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   (c)1996-2002, All rights reserved. Disclaimer available upon request.
From: Geoff Summerhayes
Subject: Re: idle puzzle
Date: 
Message-ID: <rtJq8.7214$f4.440687@news3.calgary.shaw.ca>
"Dorai Sitaram" <····@goldshoe.gte.com> wrote in message
·················@news.gte.com...
> In CL, if you type
>
> (setq x 25)
>
> at the top-level repl, you will get
>
> 25
>
> back, regardless of what identifier x is, right?
> Well, there is an identifier, let's call it y, for
> which
>
> (setq y 25)
>
> does not return 25 (and does not error).  What is
> y?
>
> (Hope this isn't too easy.  It took me a while to
> figure out what was happening when I happened to use
> this identifier.)

Does (eq (setq y 25) 25) return T? ;-)

-------
Geoff
From: Kent M Pitman
Subject: Re: idle puzzle
Date: 
Message-ID: <sfwlmc4wmsp.fsf@shell01.TheWorld.com>
"Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> writes:

> "Dorai Sitaram" <····@goldshoe.gte.com> wrote in message
> ·················@news.gte.com...
> > In CL, if you type
> >
> > (setq x 25)
> >
> > at the top-level repl, you will get
> >
> > 25
> >
> > back, regardless of what identifier x is, right?
> > Well, there is an identifier, let's call it y, for
> > which
> >
> > (setq y 25)
> >
> > does not return 25 (and does not error).  What is
> > y?
> >
> > (Hope this isn't too easy.  It took me a while to
> > figure out what was happening when I happened to use
> > this identifier.)
> 
> Does (eq (setq y 25) 25) return T? ;-)

Heh. This problem used to be a lot more irritating and obscure in Maclisp,
where those variables had shorter, more innocuous-looking names and no *'s
on the ends of their names...

Incidentally, if you're looking for related thought-stretching humor and
you've not read my article about "ambitious evaluation", this might be a
good time to check out

 http://world.std.com/~pitman/PS/Ambitious.html
From: Geoff Summerhayes
Subject: Re: idle puzzle
Date: 
Message-ID: <ZAKq8.7465$f4.458361@news3.calgary.shaw.ca>
"Kent M Pitman" <······@world.std.com> wrote in message
····················@shell01.TheWorld.com...
> "Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> writes:
>
> > Does (eq (setq y 25) 25) return T? ;-)
>
> Heh. This problem used to be a lot more irritating and obscure in Maclisp,
> where those variables had shorter, more innocuous-looking names and no *'s
> on the ends of their names...
>
> Incidentally, if you're looking for related thought-stretching humor and
> you've not read my article about "ambitious evaluation", this might be a
> good time to check out
>
>  http://world.std.com/~pitman/PS/Ambitious.html

I'm glad Lisp went the way it did. I've seen this come up
more often in the Forth NG where newbies are always having
problems with things like

25 base ! base @ . 10  ok

a similar bit in lisp,

> (let ((*print-base* 25))
    (print *print-base*))

10
25

For those helpless victims of Apr.1 jokes,
shame on you Mr. Marshall!:

(defun print-bases-in-decimal()
  (let* ((x *print-base*)
         (*print-base* 10.))
    (format t "~&*print-base* is ~A (decimal)~%~
        *read-base* is ~A (decimal)~%" x *read-base*)))

(defun print-bases()
  (let ((*print-radix* t))
    (format t "~&*print-base* is ~A~%~
        *read-base* is ~A~%" *print-base* *read-base*)))

Which raises an interesting point, is it a good idea to
always output numbers which are going to seen by the
reader with *print-radix* set to true?

----------
Geoff
From: Dorai Sitaram
Subject: Re: idle puzzle
Date: 
Message-ID: <a8hndv$kr7$1@news.gte.com>
*print-base* is indeed the answer I had in mind.  In
addition to those that posted, Barry Margolin and
Joe Marshall got the right answer in private email.

Hopefully the following puzzle is a bit more meaty.

You have just entered a CL repl and without any
precaution you have typed

(setq *read-base* 36)

How do you set it back to ten without exiting the
repl, and without creating and/or loading external
files?
From: Thomas F. Burdick
Subject: Re: idle puzzle
Date: 
Message-ID: <xcvhemrbbvx.fsf@famine.OCF.Berkeley.EDU>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> *print-base* is indeed the answer I had in mind.  In
> addition to those that posted, Barry Margolin and
> Joe Marshall got the right answer in private email.
> 
> Hopefully the following puzzle is a bit more meaty.
> 
> You have just entered a CL repl and without any
> precaution you have typed
> 
> (setq *read-base* 36)
> 
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

(cl:setq *read-base* 10.)

I've been futzing around with packages that don't (:use "CL") a lot
recently, so specifying cl:somename is quite a common occurance for me
if I accidentally get myself into the wrong package.  Same kind of
oops-I-did-something-stupid sichyation.  Incidentally, how would
external files help?  If you can't figure out how to cal setq, I'd
assume you can't figure out how to call load...

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Dorai Sitaram
Subject: Re: idle puzzle
Date: 
Message-ID: <a8i4e5$l09$1@news.gte.com>
In article <···············@famine.OCF.Berkeley.EDU>,
Thomas F. Burdick <···@famine.OCF.Berkeley.EDU> wrote:
>····@goldshoe.gte.com (Dorai Sitaram) writes:
>> 
>> You have just entered a CL repl and without any
>> precaution you have typed
>> 
>> (setq *read-base* 36)
>> 
>> How do you set it back to ten without exiting the
>> repl, and without creating and/or loading external
>> files?
>
>(cl:setq *read-base* 10.)
>
>I've been futzing around with packages that don't (:use "CL") a lot
>recently, so specifying cl:somename is quite a common occurance for me
>if I accidentally get myself into the wrong package.  Same kind of
>oops-I-did-something-stupid sichyation.  Incidentally, how would
>external files help?  If you can't figure out how to cal setq, I'd
>assume you can't figure out how to call load...

I don't think external files would help either.
I was trying to stave off possible solutions that
weren't the one I had.

The answer I had in mind (with the implicit assumption
that backslash/pipe/colon-escaping was
disallowed) was

(multiple-value-setq (*read-base*)
  (values-list '(a))

but that unearths me as a Scheme freak, because as
Kent's solution (not the one he "usually" does)
shows, a single-argument "values" in CL can be replaced
by that single argument, and so the (values-list '(a))
can be replaced with just a.
From: Christopher Browne
Subject: Re: idle puzzle
Date: 
Message-ID: <m3sn6b4j7g.fsf@chvatal.cbbrowne.com>
In an attempt to throw the authorities off his trail, ····@goldshoe.gte.com (Dorai Sitaram) transmitted:
> *print-base* is indeed the answer I had in mind.  In
> addition to those that posted, Barry Margolin and
> Joe Marshall got the right answer in private email.
>
> Hopefully the following puzzle is a bit more meaty.
>
> You have just entered a CL repl and without any
> precaution you have typed
>
> (setq *read-base* 36)
>
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

I'd think that the following would be useful in _all_ situations...
(setq *read-base* (+ 1 1 1 1 1 1 1 1 1 1)) 

It should work in any but the pathological case where *read-base* got
set to 1, at which point I think you'd be Severely Messed Up...
-- 
(concatenate 'string "cbbrowne" ·@acm.org")
http://www3.sympatico.ca/cbbrowne/wp.html
"Whip me.  Beat me.  Make me maintain AIX." -- Stephan Zielinski
From: Kent M Pitman
Subject: Re: idle puzzle
Date: 
Message-ID: <sfwu1qr8kpa.fsf@shell01.TheWorld.com>
Christopher Browne <········@acm.org> writes:

> In an attempt to throw the authorities off his trail, ····@goldshoe.gte.com (Dorai Sitaram) transmitted:
> > *print-base* is indeed the answer I had in mind.  In
> > addition to those that posted, Barry Margolin and
> > Joe Marshall got the right answer in private email.
> >
> > Hopefully the following puzzle is a bit more meaty.
> >
> > You have just entered a CL repl and without any
> > precaution you have typed
> >
> > (setq *read-base* 36)
> >
> > How do you set it back to ten without exiting the
> > repl, and without creating and/or loading external
> > files?
> 
> I'd think that the following would be useful in _all_ situations...
> (setq *read-base* (+ 1 1 1 1 1 1 1 1 1 1)) 

I don't think this is going to work.  Did you try it?

Maybe you meant (multiple-value-setq (*read-base*) (+ 5 5))
From: Geoff Summerhayes
Subject: Re: idle puzzle
Date: 
Message-ID: <F2_q8.11239$2j3.790650@news2.calgary.shaw.ca>
"Dorai Sitaram" <····@goldshoe.gte.com> wrote in message
·················@news.gte.com...
> *print-base* is indeed the answer I had in mind.  In
> addition to those that posted, Barry Margolin and
> Joe Marshall got the right answer in private email.
>
> Hopefully the following puzzle is a bit more meaty.
>
> You have just entered a CL repl and without any
> precaution you have typed
>
> (setq *read-base* 36)
>
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

(|SETQ| *read-base* 10.)

I was looking at the opposite:

CL-USER 4 > (+ 43333 9964327)
12

---------
Geoff
From: Raymond Wiker
Subject: Re: idle puzzle
Date: 
Message-ID: <86elhv7cn9.fsf@raw.grenland.fast.no>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> *print-base* is indeed the answer I had in mind.  In
> addition to those that posted, Barry Margolin and
> Joe Marshall got the right answer in private email.
> 
> Hopefully the following puzzle is a bit more meaty.
> 
> You have just entered a CL repl and without any
> precaution you have typed
> 
> (setq *read-base* 36)
> 
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

(\Setq *read-base* a)

-- 
Raymond Wiker                        Mail:  ·············@fast.no
Senior Software Engineer             Web:   http://www.fast.no/
Fast Search & Transfer ASA           Phone: +47 23 01 11 60
P.O. Box 1677 Vika                   Fax:   +47 35 54 87 99
NO-0120 Oslo, NORWAY                 Mob:   +47 48 01 11 60

Try FAST Search: http://alltheweb.com/
From: Dorai Sitaram
Subject: Re: idle puzzle
Date: 
Message-ID: <a8hu76$ktn$1@news.gte.com>
In article <··············@raw.grenland.fast.no>,
Raymond Wiker  <·············@fast.no> wrote:
>····@goldshoe.gte.com (Dorai Sitaram) writes:
>
>> Hopefully the following puzzle is a bit more meaty.
>> 
>> You have just entered a CL repl and without any
>> precaution you have typed
>> 
>> (setq *read-base* 36)
>> 
>> How do you set it back to ten without exiting the
>> repl, and without creating and/or loading external
>> files?
>
>(\Setq *read-base* a)

Ah, I didn't realize I had intended the problem to be a
wee bit harder.  Ie, I didn't want escaping
mechanisms -- backslashes, pipes, but also colons (so
cl:setq is out) -- to prevent symbols being mistook for
numbers. 

It's probably still too easy.
From: Kent M Pitman
Subject: Re: idle puzzle
Date: 
Message-ID: <sfwwuvn8kt8.fsf@shell01.TheWorld.com>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> You have just entered a CL repl and without any
> precaution you have typed
> 
> (setq *read-base* 36)
> 
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

I don't see the problem here.  I usually just type:

 #.(let* ((*read-base* 10.)) (read-from-string "(setq *read-base* 10)"))

Does this really not work for you?
From: Christopher C. Stacy
Subject: Re: idle puzzle
Date: 
Message-ID: <un0wjjno8.fsf@theworld.com>
>>>>> On Thu, 4 Apr 2002 16:56:03 GMT, Kent M Pitman ("Kent") writes:
 Kent> ····@goldshoe.gte.com (Dorai Sitaram) writes:
 >> You have just entered a CL repl and without any
 >> precaution you have typed
 >> 
 >> (setq *read-base* 36)
 >> 
 >> How do you set it back to ten without exiting the
 >> repl, and without creating and/or loading external
 >> files?

 Kent>  #.(let* ((*read-base* 10.)) (read-from-string "(setq *read-base* 10)"))


I usually just avoid setting *read-base* in the first place!

(parse-integer "774000" :radix 8)
From: Joe Marshall
Subject: Re: idle puzzle
Date: 
Message-ID: <mW4r8.3494$%s3.1648736@typhoon.ne.ipsvc.net>
"Kent M Pitman" <······@world.std.com> wrote in message
>
> I don't see the problem here.  I usually just type:
>
>  #.(let* ((*read-base* 10.)) (read-from-string "(setq *read-base* 10)"))
>

Gee, my usual solution was to modify the symbol value cell
via the spy port on a dual processor lashup, then restart
the second processor.  Your solution is *much* easier.
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8s77s$8p7$1@news.gte.com>
In a PROGN-form, one can follow the form's head,
PROGN, with zero or more NILs (or other
side-effect-free form) and the form evaluates to the
same result and has the same side effects.

   (progn a b c) 
== (progn NIL a b c)
== (progn NIL NIL a b c)
== et cetera

Can you come up with another CL form, this time a call
to a primitive function, let's call it A, such that the
A can be followed by zero or more Bs, without
changing the result or side-effects of the call?  What
is the A and what is its corresponding B?
From: Matthias Blume
Subject: Re: idle puzzle 3
Date: 
Message-ID: <fog026b7mz.fsf@trex10.cs.bell-labs.com>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> In a PROGN-form, one can follow the form's head,
> PROGN, with zero or more NILs (or other
> side-effect-free form) and the form evaluates to the
> same result and has the same side effects.
> 
>    (progn a b c) 
> == (progn NIL a b c)
> == (progn NIL NIL a b c)
> == et cetera
> 
> Can you come up with another CL form, this time a call
> to a primitive function, let's call it A, such that the
> A can be followed by zero or more Bs, without
> changing the result or side-effects of the call?  What
> is the A and what is its corresponding B?

Solutions on next screen...


How about *any* function taking an arbitrary number of arguments that
implements the right-folding of some binary function with a left
identity?  Examples:

       binary operation      left-identity(B)    CL Function(A)
       --------------------------------------------------------
       list append           NIL                 APPEND
       addition              0                   +
       multiplication        1                   *
       ...
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8s97l$8qk$1@news.gte.com>
In article <··············@trex10.cs.bell-labs.com>,
Matthias Blume  <········@shimizu-blume.com> wrote:
>····@goldshoe.gte.com (Dorai Sitaram) writes:
>
>> In a PROGN-form, one can follow the form's head,
>> PROGN, with zero or more NILs (or other
>> side-effect-free form) and the form evaluates to the
>> same result and has the same side effects.
>> 
>>    (progn a b c) 
>> == (progn NIL a b c)
>> == (progn NIL NIL a b c)
>> == et cetera
>> 
>> Can you come up with another CL form, this time a call
>> to a primitive function, let's call it A, such that the
>> A can be followed by zero or more Bs, without
>> changing the result or side-effects of the call?  What
>> is the A and what is its corresponding B?
>
>Solutions on next screen...
>
>
>How about *any* function taking an arbitrary number of arguments that
>implements the right-folding of some binary function with a left
>identity?  Examples:
>
>       binary operation      left-identity(B)    CL Function(A)
>       --------------------------------------------------------
>       list append           NIL                 APPEND
>       addition              0                   +
>       multiplication        1                   *
>       ...

All good answers.  I am looking for something that
doesn't involve the "zeros" of arithmetic operations or
any other operations, including lists, strings,
booleans, arrays, etc.  
From: Nils Goesche
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8s82m$undha$1@ID-125440.news.dfncis.de>
In article <············@news.gte.com>, Dorai Sitaram wrote:
> 
> In a PROGN-form, one can follow the form's head,
> PROGN, with zero or more NILs (or other
> side-effect-free form) and the form evaluates to the
> same result and has the same side effects.
> 
>    (progn a b c) 
>== (progn NIL a b c)
>== (progn NIL NIL a b c)
>== et cetera
> 
> Can you come up with another CL form, this time a call
> to a primitive function, let's call it A, such that the
> A can be followed by zero or more Bs, without
> changing the result or side-effects of the call?  What
> is the A and what is its corresponding B?

I guess there are quite a few.  How about TAGBODY and BLARK, for
instance?

(tagbody blark blark (pprint 'foo))

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8s8ek$8pv$1@news.gte.com>
In article <··············@ID-125440.news.dfncis.de>,
Nils Goesche  <······@cartan.de> wrote:
>In article <············@news.gte.com>, Dorai Sitaram wrote:
>> 
>> In a PROGN-form, one can follow the form's head,
>> PROGN, with zero or more NILs (or other
>> side-effect-free form) and the form evaluates to the
>> same result and has the same side effects.
>> 
>>    (progn a b c) 
>>== (progn NIL a b c)
>>== (progn NIL NIL a b c)
>>== et cetera
>> 
>> Can you come up with another CL form, this time a call
>> to a primitive function, let's call it A, such that the
>> A can be followed by zero or more Bs, without
>> changing the result or side-effects of the call?  What
>> is the A and what is its corresponding B?
>
>I guess there are quite a few.  How about TAGBODY and BLARK, for
>instance?
>
>(tagbody blark blark (pprint 'foo))

The problem explicitly requires a primitive function
for A.  
From: Nils Goesche
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8s9tf$u5kvm$1@ID-125440.news.dfncis.de>
In article <············@news.gte.com>, Dorai Sitaram wrote:
> In article <··············@ID-125440.news.dfncis.de>,
> Nils Goesche  <······@cartan.de> wrote:
>>I guess there are quite a few.  How about TAGBODY and BLARK, for
>>instance?
>>
>>(tagbody blark blark (pprint 'foo))
> 
> The problem explicitly requires a primitive function
> for A.  

Then you should define what a ``primitive function'' actually is,
because the HyperSpec doesn't AFAICT...

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8sbbf$8rg$1@news.gte.com>
In article <··············@ID-125440.news.dfncis.de>,
Nils Goesche  <······@cartan.de> wrote:
>In article <············@news.gte.com>, Dorai Sitaram wrote:
>> In article <··············@ID-125440.news.dfncis.de>,
>> Nils Goesche  <······@cartan.de> wrote:
>>>I guess there are quite a few.  How about TAGBODY and BLARK, for
>>>instance?
>>>
>>>(tagbody blark blark (pprint 'foo))
>> 
>> The problem explicitly requires a primitive function
>> for A.  
>
>Then you should define what a ``primitive function'' actually is,
>because the HyperSpec doesn't AFAICT...

Hm.  I don't think I can come up with a definition.  I
can attempt a description:

I mean the functions that are available to you in the
COMMON-LISP package when you start a CL session.  In
particular, these functions are available as the values
of the SYMBOL-FUNCTION property.  Special operators and
macros don't qualify, even when they are available
"primitively".  Functions that you introduce with DEFUN
also don't qualify.  

If there is a canonical name for this sort of
thing, let me know.
From: Erik Naggum
Subject: Re: idle puzzle 3
Date: 
Message-ID: <3227265996347206@naggum.net>
* Dorai Sitaram
| The problem explicitly requires a primitive function for A.

  There are no "primitive functions" in Common Lisp.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg
From: Francois-Rene Rideau
Subject: Re: idle puzzle 3
Date: 
Message-ID: <87d6xaqm57.fsf@Samaris.tunes.org>
····@goldshoe.gte.com (Dorai Sitaram) writes:
> Can you come up with another CL form, this time a call
> to a primitive function, let's call it A, such that the
> A can be followed by zero or more Bs, without
> changing the result or side-effects of the call?  What
> is the A and what is its corresponding B?

I think you excluded these ones because A is not a function:
A=cond B=(nil ...) REST=...
A=and B=t REST=...
A=let B=nil REST=(nil . ...)
A=nil B=... REST=...
A=(lambda (&rest x) nil) B=... REST=...


I think you wanted to exclude these trivial ones, but didn't:
A=+ B=0 REST=...
A=logior B=0 REST=...
A=append B=nil REST=...
A=nconc B=nil REST=...
and many other similar stupid things...

I think these are funny, and work because you didn't specify that there
shall be no constraint on the rest of the CL form:
A=< B=... REST=(1 0 ...)
A=... B=... REST=((error) . ...)
A=... B=#+common-lisp REST=(... . ...)

Not portably, any of A, B or REST could contain #.(quit) or #.(explode-a-bomb)

but I think you wanted these one:
A=funcall B=#'funcall REST=...
A=apply B=#'funcall REST=...

Of course, since you didn't constrain B or REST, we could have
A=funcall B=(lambda (&rest ignored) (funcall #'funcall REST)) REST=...

[ Fran�ois-Ren� �VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
Brain, n.:
	The apparatus with which we think that we think.
		-- Ambrose Bierce, "The Devil's Dictionary"
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8sbod$8s3$1@news.gte.com>
In article <··············@Samaris.tunes.org>,
Francois-Rene Rideau  <····@tunes.org> wrote:
>····@goldshoe.gte.com (Dorai Sitaram) writes:
>> Can you come up with another CL form, this time a call
>> to a primitive function, let's call it A, such that the
>> A can be followed by zero or more Bs, without
>> changing the result or side-effects of the call?  What
>> is the A and what is its corresponding B?
>
>I think you excluded these ones because A is not a function:
>A=cond B=(nil ...) REST=...
>A=and B=t REST=...
>A=let B=nil REST=(nil . ...)
>A=nil B=... REST=...
>A=(lambda (&rest x) nil) B=... REST=...
>
>
>I think you wanted to exclude these trivial ones, but didn't:
>A=+ B=0 REST=...
>A=logior B=0 REST=...
>A=append B=nil REST=...
>A=nconc B=nil REST=...
>and many other similar stupid things...
>
>I think these are funny, and work because you didn't specify that there
>shall be no constraint on the rest of the CL form:
>A=< B=... REST=(1 0 ...)
>A=... B=... REST=((error) . ...)
>A=... B=#+common-lisp REST=(... . ...)
>
>Not portably, any of A, B or REST could contain #.(quit) or #.(explode-a-bomb)
>
>but I think you wanted these one:
>A=funcall B=#'funcall REST=...

Bingo!  I don't know if there is an answer for this
puzzle in a Lisp1.  If not, a well-written form
of this puzzle could be used as a crisp and concise
shibboleth for a Lisp2. 
From: Francois-Rene Rideau
Subject: Re: idle puzzle 3
Date: 
Message-ID: <878z7yqjlf.fsf@Samaris.tunes.org>
····@goldshoe.gte.com (Dorai Sitaram) writes:
>>but I think you wanted these one:
>>A=funcall B=#'funcall REST=...
> 
> Bingo!  I don't know if there is an answer for this
> puzzle in a Lisp1.  If not, a well-written form
> of this puzzle could be used as a crisp and concise
> shibboleth for a Lisp2. 

Well, in Scheme, considering the way you specified the puzzle, there is
A=apply B=(lambda (f . rest) (apply f rest)) REST=... ; B is really funcall
A=apply B=(lambda ignored (foo bar)) REST=(foo (list bar)) ; REST-dependent

I also like these cheats that works in all LISP dialects:
A=... B=' REST=(1 . ...) ; you didn't specify that B ought to be a form
A=car B=... REST=(... ... . ...) ; you didn't specify that the form be valid

This cheat breaks your rule:
A=(lambda ignored (foo)) B=... REST=...

[ Fran�ois-Ren� �VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
Democracy is the irresponsible and regressive reign of the median voter.
Market is the responsible and progressive reign of the average consumer.
From: Kent M Pitman
Subject: Re: idle puzzle 3
Date: 
Message-ID: <sfwr8lqufqr.fsf@shell01.TheWorld.com>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> In article <··············@Samaris.tunes.org>,
> Francois-Rene Rideau  <····@tunes.org> wrote:
> >····@goldshoe.gte.com (Dorai Sitaram) writes:
...
> >
> >but I think you wanted these one:
> >A=funcall B=#'funcall REST=...

(Oh, darn.  I see someone beat me to it.)
 
Then again, I didn't have to even think about this.  I'd noticed it
years ago by accident.  It comes up in really obvious form when you're
doing meta-circular implementations of Lisps...  It's the kind of
thing one either remembers or one doesn't.

> Bingo!  I don't know if there is an answer for this
> puzzle in a Lisp1.  If not, a well-written form
> of this puzzle could be used as a crisp and concise
> shibboleth for a Lisp2. 

Don't have a Scheme handy, but doesn't it work to do:

(define (funcall fn . x) (apply fn x))

(funcall funcall funcall funcall + 1 2 3)

I'm not sure why this is a Lisp1 issue.

Surely Lisp1 folks would just say their language was somehow better
for not requiring an operator with such silly semantics.  But then,
now having looked up "shibboleth" at webster.com, I see that's what
you mean.  What a strange thing to have made a word for.
From: Dorai Sitaram
Subject: Re: idle puzzle 3
Date: 
Message-ID: <a8sv7u$5p1$1@news.gte.com>
In article <···············@shell01.TheWorld.com>,
Kent M Pitman  <······@world.std.com> wrote:
>
>> Bingo!  I don't know if there is an answer for this
>> puzzle in a Lisp1.  If not, a well-written form
>> of this puzzle could be used as a crisp and concise
>> shibboleth for a Lisp2. 
>
>Don't have a Scheme handy, but doesn't it work to do:
>
>(define (funcall fn . x) (apply fn x))
>
>(funcall funcall funcall funcall + 1 2 3)
>
>I'm not sure why this is a Lisp1 issue.
>
>Surely Lisp1 folks would just say their language was somehow better
>for not requiring an operator with such silly semantics.  But then,
>now having looked up "shibboleth" at webster.com, I see that's what
>you mean.  What a strange thing to have made a word for.

I didn't realize the word was controversial.  I just
checked webster.com and was most surprised by what they
gave as meaning #1.  I merely meant a "quick
distinguishing test".  Something like "litmus", where
the issue isn't passing or failing but fruitful
differentiation.  Although I guess the negative phrase
"failing the litmus" makes that word also unusable (and
would probably have elicited an acid (ha) retort
from you).  

Oh well...  Maybe I should have used "potato", as
in "you say".  "[A] crisp and concise potato" it is,
then.  Can we call the whole thing off?
From: Kent M Pitman
Subject: Re: idle puzzle 3
Date: 
Message-ID: <sfwu1qmug43.fsf@shell01.TheWorld.com>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> In a PROGN-form, one can follow the form's head,
> PROGN, with zero or more NILs (or other
> side-effect-free form) and the form evaluates to the
> same result and has the same side effects.
> 
>    (progn a b c) 
> == (progn NIL a b c)
> == (progn NIL NIL a b c)
> == et cetera
> 
> Can you come up with another CL form, this time a call
> to a primitive function, let's call it A, such that the
> A can be followed by zero or more Bs, without
> changing the result or side-effects of the call?  What
> is the A and what is its corresponding B?

(funcall #'+ 1 2 3)
(funcall #'funcall #'+ 1 2 3)
(funcall #'funcall #'+ 1 2 3)
(funcall #'funcall #'funcall #'+ 1 2 3)
(funcall #'funcall #'funcall #'funcall #'+ 1 2 3)
...
From: Kimmo T Takkunen
Subject: Re: idle puzzle 3
Date: 
Message-ID: <slrnab40tc.4lv.ktakkune@sirppi.helsinki.fi>
In article <············@news.gte.com>, Dorai Sitaram wrote:
> 
> In a PROGN-form, one can follow the form's head,
> PROGN, with zero or more NILs (or other
> side-effect-free form) and the form evaluates to the
> same result and has the same side effects.
> 
>    (progn a b c) 
> == (progn NIL a b c)
> == (progn NIL NIL a b c)
> == et cetera
> 
> Can you come up with another CL form, this time a call
> to a primitive function, let's call it A, such that the
> A can be followed by zero or more Bs, without
> changing the result or side-effects of the call?  What
> is the A and what is its corresponding B?

(defun primitive-function-p (f)
 "This is what I think you mean with primitive function."
    (do-symbols (s "COMMON-LISP")
      (if (and (fboundp s) 
	       (eq (symbol-function s) f))
	  (return t))))  

(if (primitive-function-p #'+)
  (let ((A #'+)
        (B 0))
    (= (funcall A B 1 2 3)
       (funcall A B B 1 2 3))))

--  Kimmo,  http://www.iki.fi/kt/
((lambda (integer) 
   (coerce (loop for i upfrom 0 by 8 below (integer-length integer)
                 collect (code-char (ldb (byte 8 i) integer))) 'string))
 100291759904362517251920937783274743691485481194069255743433035)
From: Pierre R. Mai
Subject: Re: idle puzzle
Date: 
Message-ID: <87sn6bmqfo.fsf@orion.bln.pmsf.de>
····@goldshoe.gte.com (Dorai Sitaram) writes:

> You have just entered a CL repl and without any
> precaution you have typed
> 
> (setq *read-base* 36)
> 
> How do you set it back to ten without exiting the
> repl, and without creating and/or loading external
> files?

\ is your friend.

Regs, Pierre.

-- 
Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein
From: Paolo Amoroso
Subject: Re: idle puzzle
Date: 
Message-ID: <TYCsPGFEFdCmFkX6ip4WmI4EmvUJ@4ax.com>
On 4 Apr 2002 14:19:43 GMT, ····@goldshoe.gte.com (Dorai Sitaram) wrote:

[CONSes & Dragons]> enter repl

> You have just entered a CL repl and without any
> precaution you have typed
> 
> (setq *read-base* 36)

[CONSes & Dragons]> kill process with sword

:)


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]
From: Erik Naggum
Subject: Re: idle puzzle
Date: 
Message-ID: <3226857767263484@naggum.net>
* Dorai Sitaram
| What is y?

  *print-base* appears to be an obvious candidate.

| (Hope this isn't too easy.  It took me a while to figure out what was
| happening when I happened to use this identifier.)

  But this is a contraindication for *print-base*.  I doubt that anyone
  would "happen to use" that particular variable.  I am curious to see
  which other variables can have the effect you observed.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg