Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

idle puzzle

11 views
Skip to first unread message

Dorai Sitaram

unread,
Apr 3, 2002, 2:32:42 PM4/3/02
to
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.)

Chris Kirkwood-Watts

unread,
Apr 3, 2002, 3:12:31 PM4/3/02
to
__ ds...@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.

Joe Marshall

unread,
Apr 3, 2002, 3:13:22 PM4/3/02
to

"Chris Kirkwood-Watts" <kirk...@gauss.totzeit.net> wrote in message
news:3cab622f$1...@news.mhogaming.com...

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.

Geoff Summerhayes

unread,
Apr 3, 2002, 3:19:35 PM4/3/02
to

"Dorai Sitaram" <ds...@goldshoe.gte.com> wrote in message
news:a8flcq$jk6$1...@news.gte.com...

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

-------
Geoff


Kent M Pitman

unread,
Apr 3, 2002, 3:27:02 PM4/3/02
to
"Geoff Summerhayes" <sNuOmS...@hNoOtSmPaAiMl.com> writes:

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

Rahul Jain

unread,
Apr 3, 2002, 3:45:36 PM4/3/02
to
ds...@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 -=- mailto:rj...@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.

Harald Hanche-Olsen

unread,
Apr 3, 2002, 4:11:16 PM4/3/02
to
+ Chris Kirkwood-Watts <kirk...@gauss.totzeit.net>:

| __ ds...@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?

Erik Naggum

unread,
Apr 3, 2002, 4:22:31 PM4/3/02
to
* 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

Geoff Summerhayes

unread,
Apr 3, 2002, 4:35:53 PM4/3/02
to

"Kent M Pitman" <pit...@world.std.com> wrote in message
news:sfwlmc4...@shell01.TheWorld.com...

> "Geoff Summerhayes" <sNuOmS...@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

Dorai Sitaram

unread,
Apr 4, 2002, 9:19:43 AM4/4/02
to
*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?

Raymond Wiker

unread,
Apr 4, 2002, 9:37:46 AM4/4/02
to
ds...@goldshoe.gte.com (Dorai Sitaram) writes:

(\Setq *read-base* a)

--
Raymond Wiker Mail: Raymon...@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/

Geoff Summerhayes

unread,
Apr 4, 2002, 10:11:33 AM4/4/02
to

"Dorai Sitaram" <ds...@goldshoe.gte.com> wrote in message
news:a8hndv$kr7$1...@news.gte.com...

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

I was looking at the opposite:

CL-USER 4 > (+ 43333 9964327)
12

---------
Geoff

Christopher Browne

unread,
Apr 4, 2002, 9:44:19 AM4/4/02
to
In an attempt to throw the authorities off his trail, ds...@goldshoe.gte.com (Dorai Sitaram) transmitted:

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

Dorai Sitaram

unread,
Apr 4, 2002, 11:15:34 AM4/4/02
to
In article <86elhv7...@raw.grenland.fast.no>,
Raymond Wiker <Raymon...@fast.no> wrote:

>ds...@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.

Pierre R. Mai

unread,
Apr 4, 2002, 10:30:51 AM4/4/02
to
ds...@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 <pm...@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

Paolo Amoroso

unread,
Apr 4, 2002, 11:33:56 AM4/4/02
to
On 4 Apr 2002 14:19:43 GMT, ds...@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/]

Kent M Pitman

unread,
Apr 4, 2002, 11:56:03 AM4/4/02
to
ds...@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?

Kent M Pitman

unread,
Apr 4, 2002, 11:58:25 AM4/4/02
to
Christopher Browne <cbbr...@acm.org> writes:

> In an attempt to throw the authorities off his trail, ds...@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))


Thomas F. Burdick

unread,
Apr 4, 2002, 12:40:34 PM4/4/02
to
ds...@goldshoe.gte.com (Dorai Sitaram) writes:

(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! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'

Dorai Sitaram

unread,
Apr 4, 2002, 1:01:41 PM4/4/02
to
In article <xcvhemr...@famine.OCF.Berkeley.EDU>,

Thomas F. Burdick <t...@famine.OCF.Berkeley.EDU> wrote:
>ds...@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.

Christopher C. Stacy

unread,
Apr 4, 2002, 1:58:47 PM4/4/02
to
>>>>> On Thu, 4 Apr 2002 16:56:03 GMT, Kent M Pitman ("Kent") writes:
Kent> ds...@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)

Joe Marshall

unread,
Apr 4, 2002, 6:00:34 PM4/4/02
to

"Kent M Pitman" <pit...@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.

Dorai Sitaram

unread,
Apr 8, 2002, 9:50:52 AM4/8/02
to

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?

Nils Goesche

unread,
Apr 8, 2002, 10:05:10 AM4/8/02
to

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

Dorai Sitaram

unread,
Apr 8, 2002, 10:11:32 AM4/8/02
to
In article <a8s82m$undha$1...@ID-125440.news.dfncis.de>,

Nils Goesche <car...@cartan.de> wrote:
>In article <a8s77s$8p7$1...@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.

Matthias Blume

unread,
Apr 8, 2002, 10:13:40 AM4/8/02
to
ds...@goldshoe.gte.com (Dorai Sitaram) writes:

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 *
...

Dorai Sitaram

unread,
Apr 8, 2002, 10:24:53 AM4/8/02
to
In article <fog026b...@trex10.cs.bell-labs.com>,

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.

Nils Goesche

unread,
Apr 8, 2002, 10:36:31 AM4/8/02
to

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

Erik Naggum

unread,
Apr 8, 2002, 10:46:19 AM4/8/02
to
* Dorai Sitaram

| The problem explicitly requires a primitive function for A.

There are no "primitive functions" in Common Lisp.

Francois-Rene Rideau

unread,
Apr 8, 2002, 10:51:16 AM4/8/02
to
ds...@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"

Dorai Sitaram

unread,
Apr 8, 2002, 11:01:03 AM4/8/02
to
In article <a8s9tf$u5kvm$1...@ID-125440.news.dfncis.de>,

Nils Goesche <car...@cartan.de> wrote:
>In article <a8s8ek$8pv$1...@news.gte.com>, Dorai Sitaram wrote:
>> In article <a8s82m$undha$1...@ID-125440.news.dfncis.de>,
>> Nils Goesche <car...@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.

Dorai Sitaram

unread,
Apr 8, 2002, 11:07:57 AM4/8/02
to
In article <87d6xaq...@Samaris.tunes.org>,

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.

Francois-Rene Rideau

unread,
Apr 8, 2002, 11:46:20 AM4/8/02
to
ds...@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.

Kent M Pitman

unread,
Apr 8, 2002, 3:47:56 PM4/8/02
to
ds...@goldshoe.gte.com (Dorai Sitaram) writes:

(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)
...

Kent M Pitman

unread,
Apr 8, 2002, 3:55:56 PM4/8/02
to
ds...@goldshoe.gte.com (Dorai Sitaram) writes:

> In article <87d6xaq...@Samaris.tunes.org>,
> Francois-Rene Rideau <fa...@tunes.org> wrote:
> >ds...@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.

Dorai Sitaram

unread,
Apr 8, 2002, 4:40:30 PM4/8/02
to
In article <sfwr8lq...@shell01.TheWorld.com>,

Kent M Pitman <pit...@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?

Kimmo T Takkunen

unread,
Apr 8, 2002, 4:55:08 PM4/8/02
to
In article <a8s77s$8p7$1...@news.gte.com>, Dorai Sitaram wrote:
>

(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)

0 new messages