From: Richard James Panturis Giuly
Subject: Access the the second return value?
Date: 
Message-ID: <3959B48D.835EA63E@spam.com>
For some reason I can't find how to access the second return
value of a function like gethash. Could someone help me out?


(I hope I'm not bothering you people with all these questions.)

-- 
	ricky
	······@surfsouth.com

From: David Bakhash
Subject: Re: Access the the second return value?
Date: 
Message-ID: <c29sntyayus.fsf@nerd-xing.mit.edu>
Richard James Panturis Giuly <··@spam.com> writes:

> For some reason I can't find how to access the second return
> value of a function like gethash. Could someone help me out?

it's #'nth-value:

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/mac_nth-value.html

dave
From: Friedrich Dominicus
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87aeg65h7a.fsf@q-software-solutions.com>
Richard James Panturis Giuly <··@spam.com> writes:

> For some reason I can't find how to access the second return
> value of a function like gethash. Could someone help me out?
> 
> 
> (I hope I'm not bothering you people with all these questions.)

example :  
CL-USER 5 : 1 > (setf ht (make-hash-table))
#<EQL Hash Table{0} 204EB5C4>

CL-USER 6 : 1 > (setf (gethash 1 ht) "one")
"one"

CL-USER 7 : 1 > (setf (gethash 2 ht) "two")
"two"

CL-USER 8 : 1 > (gethash 2 ht)
"two"
T

CL-USER 9 : 1 > (multiple-value-bind (item present?)
                    (gethash 2 ht)
                  (list item present?))
("two" T)


There are a bunch of other multiple-.... functions for different
purposes.

Regards
Friedrich

-- 
for e-mail reply remove all after .com 
From: Paul Foley
Subject: Re: Access the the second return value?
Date: 
Message-ID: <m24s6e2km8.fsf@mycroft.actrix.gen.nz>
On 28 Jun 2000 10:43:21 +0200, Friedrich Dominicus wrote:

> CL-USER 9 : 1 > (multiple-value-bind (item present?)

Argh!  I am the only one that's bothered by this godawful Schemish use
of `?' in symbols for "predicate" functions/values?

-- 
Cogito ergo I'm right and you're wrong.               -- Blair Houghton

(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(··@) "actrix.gen.nz>"))
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87itutcge8.fsf@quadium.net>
Paul Foley <·······@actrix.gen.nz> writes:

> Argh!  I am the only one that's bothered by this godawful Schemish use
> of `?' in symbols for "predicate" functions/values?

I don't know, but I despise the use of "FIRST" and "SECOND" in Winston 
and Horn.  I _like_ using CAR, CDR, and the like, because it actually
shows the operations taking place, and it's intuitive that CADDR takes 
a little more time than CAR.  Whenever anything is made "friendly",
there's lossage involved, and painful ignorance on the way.

-- 
vsync
http://quadium.net/ - last updated Fri Jun 23 23:28:05 MDT 2000
Orjner.
From: Paul Foley
Subject: Re: Access the the second return value?
Date: 
Message-ID: <m2bt0l145g.fsf@mycroft.actrix.gen.nz>
On 28 Jun 2000 21:31:11 -0600, vsync  wrote:

> I don't know, but I despise the use of "FIRST" and "SECOND" in Winston 
> and Horn.  I _like_ using CAR, CDR, and the like, because it actually
> shows the operations taking place, and it's intuitive that CADDR takes 
> a little more time than CAR.  Whenever anything is made "friendly",
> there's lossage involved, and painful ignorance on the way.

When thinking of conses as conses I prefer CAR and CDR to FIRST and
REST , but when thinking of them as a list, I usually prefer
FIRST/SECOND/REST/etc.  [Though I sometimes use CAR/CDR out of habit;
and I use CADR and CADAR but rarely other variants]

I don't think of FIRST and REST as replacements for CAR and CDR.

-- 
Nomina stultorum in parietibus et portis semper videmus.      -- Cicero

(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(··@) "actrix.gen.nz>"))
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87u2ed9izy.fsf@quadium.net>
Paul Foley <·······@actrix.gen.nz> writes:

> When thinking of conses as conses I prefer CAR and CDR to FIRST and
> REST , but when thinking of them as a list, I usually prefer
> FIRST/SECOND/REST/etc.  [Though I sometimes use CAR/CDR out of habit;

But I love the fact that lists are just conses of conses, and I love
expressing them that way.  One of the Lisp books I read had a section
on "why Lisp doesn't have pointers", but I realized they were wrong:
_everything_ is a pointer.  Then I was Enlightened.

What's that quote?  "I like Lisp because you can feel the bits between 
your toes."?

> and I use CADR and CADAR but rarely other variants]

I used CAR through CADDDR today.

I also discovered the ~R directive for FORMAT.  That was fun.

-- 
vsync
http://quadium.net/ - last updated Fri Jun 23 23:28:05 MDT 2000
(cons (cons (car (cons 'c 'r)) (cdr (cons 'a 'o))) ; Orjner
      (cons (cons (car (cons 'n 'c)) (cdr (cons nil 's))) nil)))
From: Larry Elmore
Subject: Re: Access the the second return value?
Date: 
Message-ID: <8jj3sn$ikm$1@newssvr03-int.news.prodigy.com>
"vsync" <·····@quadium.net> wrote in message
···················@quadium.net...
> Paul Foley <·······@actrix.gen.nz> writes:
>
> > Argh!  I am the only one that's bothered by this godawful Schemish use
> > of `?' in symbols for "predicate" functions/values?

Actually, I prefer it. In effect, they're asking a true/false question and
the '?' makes sense in that regard. More sense than 'p' or sometimes '-p'
stuck on the end, at least to me. I never had any problem with 'set!'
instead of 'setf', either, perhaps because it's similar to Forth's '!'
(store) operator and I used Forth for a number of years. At least Scheme
uses '!' consistently, identifying all destructive functions similarly. I
honestly don't see how prepending an 'n' to a function (_especially_ with
'nconc' as the destructive version of 'append' -- where's the logic there?)
is any better. I'm considering renaming a number of CL functions and macros
for use on my own system, perhaps with a translator to restore them to their
original form for any code I might put in a public forum. I suppose there's
some dangers in that, though -- I've used HP (RPN) calculators for so long
that now I can barely use a TI or Casio without making so many mistakes I'd
be better off using pencil and paper.

> I don't know, but I despise the use of "FIRST" and "SECOND" in Winston
> and Horn.  I _like_ using CAR, CDR, and the like, because it actually
> shows the operations taking place,

I don't see this, unless you are using the IBM mainframe on which Lisp was
first developed -- and even then, the abbreviations for 'Contents of Address
Register' and 'Contents of Data Register'  aren't very meaningful...

I've always thought 'head' and 'tail' would've made a lot more sense even
40+ years ago, and possibly 'htail', 'httail', etc. as extensions. For some
things, though, like getting the nth element of a list, other words are a
_lot_ clearer, though I name them 'first-of', 'third-of', etc.

> and it's intuitive that CADDR takes
> a little more time than CAR.  Whenever anything is made "friendly",
> there's lossage involved, and painful ignorance on the way.

I'm not a fan of what's usually passed off as "friendly," what you state is
usually the reality. I _am_ a big fan of "clearer", though, and that's truly
friendly, but only as a consequence.

Larry
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <871z1ewq34.fsf@quadium.net>
"Larry Elmore" <········@prodigy.net> writes:

> > I don't know, but I despise the use of "FIRST" and "SECOND" in Winston
> > and Horn.  I _like_ using CAR, CDR, and the like, because it actually
> > shows the operations taking place,
> 
> I don't see this, unless you are using the IBM mainframe on which Lisp was
> first developed -- and even then, the abbreviations for 'Contents of Address
> Register' and 'Contents of Data Register'  aren't very meaningful...

I honestly can't explain it; the names CAR and CDR just made instant
sense to me, and have stuck with me as The Logical Way To Do Things
ever since.

As far as IBM mainframes go, I have never used a mainframe, and the
most ancient Lisp architecture I have used is CLISP (plus Emacs, if
that counts =).  But although the terms themselves may not have been
the best choices, using them allows me to _visualize_ the operations
in my head.  Quite literally.  I can see the pointers and the lists
and the structures.  No other language has let me do that as easily.

Anyway, I find legacy hardware quite easy to understand and in many
ways more elegant than today's systems.  Just a personal quirk.

> I've always thought 'head' and 'tail' would've made a lot more sense even

Mmmmm...  Prolog.

-- 
vsync
http://quadium.net/ - last updated Thu Jun 29 13:01:57 MDT 2000
(cons (cons (car (cons 'c 'r)) (cdr (cons 'a 'o))) ; Orjner
      (cons (cons (car (cons 'n 'c)) (cdr (cons nil 's))) nil)))
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171439197402294@naggum.net>
* "Larry Elmore" <········@prodigy.net>
| I don't see this, unless you are using the IBM mainframe on which
| Lisp was first developed -- and even then, the abbreviations for
| 'Contents of Address Register' and 'Contents of Data Register'
| aren't very meaningful...

  AFAIK, they were the instructions used to extract halves of a kind
  of pointer, and it consisted of an address part and a decrement part
  (not data).  A stack that knew its size was easily implemented with
  this scheme, and it was done just that way on the PDP-10 I grew up
  on (for all practical purposes) -- both stack and more specialized
  instructions would add 1 to both halves of the machine word and you
  could test for overflow at this point if the _negative_ size would
  overflow into zero.  If you read the Lisp 1.5 Programmer's Reference
  Manual carefully, you'll much intermingled discussions of the
  special treatment of negative pointer values -- the sized pointer
  concept was clearly _abused_ by the Lisp implementation on that IBM
  processor!  I found this quite amusing when I read it.

  (Argh, this remind me that I pushed a request for an explanation of
  the power of the PDP-10 macro assembler on my internal stack, and it
  _doesn't_ signal overflow.  Sigh.)

| I've always thought 'head' and 'tail' would've made a lot more sense
| even 40+ years ago, and possibly 'htail', 'httail', etc. as
| extensions. For some things, though, like getting the nth element of
| a list, other words are a _lot_ clearer, though I name them
| 'first-of', 'third-of', etc.

  Hm?  I already pronounce (first foo) as "first of foo".

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Hartmann Schaffer
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395e5892@news.sentex.net>
In article <················@naggum.net>,
	Erik Naggum <····@naggum.net> writes:
> * "Larry Elmore" <········@prodigy.net>
>| I don't see this, unless you are using the IBM mainframe on which
>| Lisp was first developed -- and even then, the abbreviations for
>| 'Contents of Address Register' and 'Contents of Data Register'
>| aren't very meaningful...

unless memory deceives me very badly, the d in cdr stands for
decrement.  given the limited amount of memory those machines had,
there usualls was enough space in a word or register to kep two
addresse, and manu machines had an optimization feature that let you
store a second value in a (n index)register that was added to or
subtracted from the other (address) part every time the register got
accessed.

> ...

-- 

Hartmann Schaffer
From: Derek Peschel
Subject: Re: Access the the second return value?
Date: 
Message-ID: <slrn8ludkl.ru6.dpeschel@eskimo.com>
In article <········@news.sentex.net>, Hartmann Schaffer wrote:
>In article <················@naggum.net>,
>	Erik Naggum <····@naggum.net> writes:
>> * "Larry Elmore" <········@prodigy.net>
>>| I don't see this, unless you are using the IBM mainframe on which
>>| Lisp was first developed -- and even then, the abbreviations for
>>| 'Contents of Address Register' and 'Contents of Data Register'
>>| aren't very meaningful...
>
>unless memory deceives me very badly, the d in cdr stands for
>decrement.  given the limited amount of memory those machines had,
>there usualls was enough space in a word or register to kep two
>addresse, and manu machines had an optimization feature that let you
>store a second value in a (n index)register that was added to or
>subtracted from the other (address) part every time the register got
>accessed.

You're very close to the truth.  Larry is a farther away (and his expansions
of CAR and CDR get quoted a lot -- or "Contents of Decrement Register" if
you're lucky).

The IBM 704 had 36-bit words and 15-bit (!) addresses.  Words used as data
had four parts: 3-bit tag (or prefix?) field, 15-bit address field, 3-bit
prefix (or tag?) field, and 15-bit decrement field.  I'm not sure where the
prefix and tag fields go in the word.

LISP 1.5 rarely or never uses the prefix and tag fields.  CONS cells have 0
in those fields.  So that's why you only get CAR and CDR; earlier versions
of LISP gave you CPR and CTR (and CWR for the whole word) as well but
evidently they were too useless to keep.

Of course LISP does have full words (numbers, names of symbols, machine
instructions) in which all the fields are full, but they aren't treated as
separate fields so you aren't allowed to get the parts of full words.

The real key to the etymology is that "register" once referred to _all_
memory locations, not just the ones internal to the CPU.  If you programmed
the machine directly, you might want to refer to the address field of
location 12345.  This would be the contents of the address field of register
12345, or CAR 12345.  LISP added names (symbols) so you didn't have to refer
to absolute memory locations, but the usage is almost the same.  (CAR FOO)
converts FOO to an absolute location and gets you the contents of the
address field at that location, or register.  The part about index register
instructions is true but is a red herring.

-- Derek
From: Janos Blazi
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395f46bf$1_2@spamkiller.newsfeeds.com>
Derek Peschel <········@eskimo.com> schrieb in im Newsbeitrag:
·······················@eskimo.com...
> In article <········@news.sentex.net>, Hartmann Schaffer wrote:
> >In article <················@naggum.net>,
> > Erik Naggum <····@naggum.net> writes:
> >> * "Larry Elmore" <········@prodigy.net>
> >>| I don't see this, unless you are using the IBM mainframe on which
> >>| Lisp was first developed -- and even then, the abbreviations for
> >>| 'Contents of Address Register' and 'Contents of Data Register'
> >>| aren't very meaningful...
> >
> >unless memory deceives me very badly, the d in cdr stands for
> >decrement.  given the limited amount of memory those machines had,
> >there usualls was enough space in a word or register to kep two
> >addresse, and manu machines had an optimization feature that let you
> >store a second value in a (n index)register that was added to or
> >subtracted from the other (address) part every time the register got
> >accessed.
>
> You're very close to the truth.  Larry is a farther away (and his
expansions
> of CAR and CDR get quoted a lot -- or "Contents of Decrement Register" if
> you're lucky).
>
> The IBM 704 had 36-bit words and 15-bit (!) addresses.  Words used as data
> had four parts: 3-bit tag (or prefix?) field, 15-bit address field, 3-bit
> prefix (or tag?) field, and 15-bit decrement field.  I'm not sure where
the
> prefix and tag fields go in the word.
>
> LISP 1.5 rarely or never uses the prefix and tag fields.  CONS cells have
0
> in those fields.  So that's why you only get CAR and CDR; earlier versions
> of LISP gave you CPR and CTR (and CWR for the whole word) as well but
> evidently they were too useless to keep.
>
> Of course LISP does have full words (numbers, names of symbols, machine
> instructions) in which all the fields are full, but they aren't treated as
> separate fields so you aren't allowed to get the parts of full words.
>
> The real key to the etymology is that "register" once referred to _all_
> memory locations, not just the ones internal to the CPU.  If you
programmed
> the machine directly, you might want to refer to the address field of
> location 12345.  This would be the contents of the address field of
register
> 12345, or CAR 12345.  LISP added names (symbols) so you didn't have to
refer
> to absolute memory locations, but the usage is almost the same.  (CAR FOO)
> converts FOO to an absolute location and gets you the contents of the
> address field at that location, or register.  The part about index
register
> instructions is true but is a red herring.
>
> -- Derek

Isn't it strange that early machine archtectures still have such an impact
on modern programming languages? This is the same as the zero terminated
strings in C, but one would not expect this kind of thing in Lisp2!

Janos Blazi
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171547074485720@naggum.net>
* "Janos Blazi" <······@vipsurf.de>
| Isn't it strange that early machine archtectures still have such an
| impact on modern programming languages?

  No.  Genuinely good ideas don't suddenly turn bad because of the
  passage of time.

| This is the same as the zero terminated strings in C,

  No, it isn't.

| but one would not expect this kind of thing in Lisp2!

  Lisp2?

  Take a look at LDB and DPB some day you're prepared for a shock.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Janos Blazi
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395f84dd_2@spamkiller.newsfeeds.com>
Erik Naggum <····@naggum.net> schrieb in im Newsbeitrag:
················@naggum.net...
> * "Janos Blazi" <······@vipsurf.de>
> | Isn't it strange that early machine archtectures still have such an
> | impact on modern programming languages?
>
>   No.  Genuinely good ideas don't suddenly turn bad because of the
>   passage of time.
>
> | This is the same as the zero terminated strings in C,
>
>   No, it isn't.

Prima facie it seemed to be tha same, but I possibly some deeper analysis
may show that you are right.

>
> | but one would not expect this kind of thing in Lisp2!
>
>   Lisp2?

I saw at the Python home page that they are working on some minor changes
and they wanted to call it Python 1.6 after 1.5.2 but now they call it
Python 2 as "some companies do not use products the version numbers of which
start with a 1". And I feel that such hype, however disgusting, may be
helpful.

>
>   Take a look at LDB and DPB some day you're prepared for a shock.

Hahaha! Now I did not want to be reprimanded again so I took a look in the
Net and found in google.com that "LDB" stands for "regrettable debugger" and
"Long Distance Bacgammon players" and "'Little Drummer Boy' drum loop
creation software" on the first page and there are nine other pages to
follow.

J.B.
From: Robert Monfera
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395F87F3.F452D016@fisec.com>
Janos Blazi wrote:

> Hahaha! Now I did not want to be reprimanded again so I took a look
> in the
> Net and found in google.com that "LDB" stands for "regrettable
> debugger" and
> "Long Distance Bacgammon players" and "'Little Drummer Boy' drum loop
> creation software" on the first page and there are nine other pages
> to follow.

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/acc_ldb.html#ldb

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/fun_dpb.html#dpb

Robert
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171552409722168@naggum.net>
* "Janos Blazi" <······@vipsurf.de>
| >   Take a look at LDB and DPB some day you're prepared for a shock.
| 
| Hahaha!  Now I did not want to be reprimanded again so I took a look in the
| Net and found in google.com that "LDB" stands for "regrettable debugger" and
| "Long Distance Bacgammon players" and "'Little Drummer Boy' drum loop
| creation software" on the first page and there are nine other pages to
| follow.

  Sigh.  HINT: Check the HyperSpec.  Also the Hacker's Dictionary.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Hartmann Schaffer
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395fb14e@news.sentex.net>
In article <··········@spamkiller.newsfeeds.com>,
	"Janos Blazi" <······@vipsurf.de> writes:
> 
> Erik Naggum <····@naggum.net> schrieb in im Newsbeitrag:
> ················@naggum.net...
>> * "Janos Blazi" <······@vipsurf.de>
>> | Isn't it strange that early machine archtectures still have such an
>> | impact on modern programming languages?
>>
>>   No.  Genuinely good ideas don't suddenly turn bad because of the
>>   passage of time.
>>
>> | This is the same as the zero terminated strings in C,
>>
>>   No, it isn't.
> 
> Prima facie it seemed to be tha same, but I possibly some deeper analysis
> may show that you are right.

no:  this is a case of problem oriented data structuring that happened
to find hardware structures andinstructions that can conveniently be
used for it.  you could argue that using the machine instruction names 
for the function names (head and tail would have served as well for
lists, though not necessarily for non-list cons cells) was
unfortunate, but i wouldn't say that the machine architecture had such 
a great influence on the language design of lisp.  i could name you a
few languages for which this is much more true.  Zero termnated
strings is probably more influenced by the intended use of strings
than by the machine architecture.

>>
>> | but one would not expect this kind of thing in Lisp2!
>>
>>   Lisp2?

i doubt Janos meant that, but there was a Lisp2 implementation done in 
Stanford in the 60s (i think by Paul Abrahams).  I never found too much
information about it, but it seems to have been Lisp1.5 semantics with 
largely Algol syntax (not sure about exactly where in the Algol tree)

> ..

-- 

Hartmann Schaffer
From: Janos Blazi
Subject: Re: Access the the second return value?
Date: 
Message-ID: <39607dcd_4@spamkiller.newsfeeds.com>
> no:  this is a case of problem oriented data structuring that happened
> to find hardware structures andinstructions that can conveniently be
> used for it.  you could argue that using the machine instruction names
> for the function names (head and tail would have served as well for
> lists, though not necessarily for non-list cons cells) was
> unfortunate, but i wouldn't say that the machine architecture had such
> a great influence on the language design of lisp.  i could name you a
> few languages for which this is much more true.  Zero termnated
> strings is probably more influenced by the intended use of strings
> than by the machine architecture.

I thought about Erik's remark and my explanation is this: You always had to
use zero terminated strings in C, there was no way to circuvent them, but
you could do very well without LDB (it took me several minutes to figure out
that in LDB the byte does not necessarily starts at a byte boundary; it is a
powerful function). (The reason for zero terminated strings was that on
their first machine (PDP?) they used hardwate to find such zeroes.)
And in C++ zero terminated strings still were in use, though they became
less important.

>
> >>
> >> | but one would not expect this kind of thing in Lisp2!
> >>
> >>   Lisp2?
>
> i doubt Janos meant that, but there was a Lisp2 implementation done in
> Stanford in the 60s (i think by Paul Abrahams).  I never found too much
> information about it, but it seems to have been Lisp1.5 semantics with
> largely Algol syntax (not sure about exactly where in the Algol tree)

No, I did not know about this (as usual). So call it Lisp3.

J.B.
From: Paul F. Dietz
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3960857B.F78E5873@interaccess.com>
Janos Blazi wrote:

> (The reason for zero terminated strings was that on
> their first machine (PDP?) they used hardwate to find such zeroes.)

I think the reason was so you could write loops like:

	while (*to++ = *from++);

which translates to two PDP-11 instructions, if 'to'
and 'from' were declared to be in registers.  The
mov instruction set a condition code depending
on whether the byte moved was zero or not.

	Paul
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171623893332559@naggum.net>
* "Janos Blazi" <······@vipsurf.de>
| You always had to use zero terminated strings in C, there was no way
| to circuvent them

  Wrong.  The language does initialize literal strings in the code to
  be zero-terminated, but there's nothing that actually requires this
  apart from the standard C library.  Software written in C that does
  not use literals in the source code don't have to deal with this at
  all if they don't want to.  Several Pascal systems have used a
  length word (16 bits) before the data.  A simple way to deal with C
  and Pascal is thus to allocate three bytes too many, relative to the
  exact length, and write the length before the string and a zero byte
  after it.  Some Common Lisp systems also do this zero byte thing for
  the benefit of their FFIs.

| (it took me several minutes to figure out that in LDB the byte does
| not necessarily starts at a byte boundary; it is a powerful
| function).

  You would have spent less time if you had looked up "byte" in the
  glossary of the HyperSpec.  The 8-bit byte is a story of IBM taking
  over the meaning of perfectly good words.

| (The reason for zero terminated strings was that on their first
| machine (PDP?) they used hardwate to find such zeroes.)

  Wrong.  (Except in the trivial sense that one _always_ uses hardware
  when executing programs of any kind.)

| And in C++ zero terminated strings still were in use, though they
| became less important.

  Wrong.

  ISO/IEC 14882:1998(E) [lex.string] 2.13.4 String literals

4 After any necessary concatenation, in translation phase 7 (2.1),
  '\0' is appended to every string literal so that programs that scan
  a string can find its end.

| No, I did not know about this (as usual). So call it Lisp3.

  Why not just _drop_ this silliness?

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Janos Blazi
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3960c6db_4@spamkiller.newsfeeds.com>
(A)
You take my (and anybody's)  sentences as if they were mathematical
statements and then you check if they are true in the strict mathematical
sense. Usually they are not as it is too tiresome to think about every word
one writes and additionally my knowledge lacks the ultimate precision too.
Then your comment is a scathing 'WRONG'.
Of course you are usually right in a stricly logical sense.

(B)
Let me tell you a joke (which I usually do not do):
A few people are in the air in a balloon and there is a storm and some way
they find themselves over the sea. They do not know where they are but after
a few hours they see land and they see somebody down below. They shout:
'Where are we?!' And after a few minutes of thinking the guy they see shouts
back: 'In a balloon!'
Now first they are very angry but then they conclude that this guy must have
been a mathematician, as
(i) he thought for a long time, how to answer;
(ii) the answer was absolutely precise;
(iii) the answer was absolutely useless as well.

(C)
By saying 'less important' I meant that now there are several string classes
in C++ you can use (at least to some extent) instead of the zero terminated
strings.

(D)
And I remember reading somewhere that the PDPs had some special hardware
that made dealing with zero terminated strings fast but I forgot where I
read that.

> | No, I did not know about this (as usual). So call it Lisp3.
>
>   Why not just _drop_ this silliness?

O.K., I shall drop it. But I still think it is worth thinking about
something like that.

J.
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171634783182003@naggum.net>
* "Janos Blazi" <······@vipsurf.de>
| You take my (and anybody's) sentences as if they were mathematical
| statements and then you check if they are true in the strict
| mathematical sense.

  Wrong.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Janos Blazi
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3960d1e3_1@spamkiller.newsfeeds.com>
Erik Naggum <····@naggum.net> schrieb in im Newsbeitrag:
················@naggum.net...
> * "Janos Blazi" <······@vipsurf.de>
> | You take my (and anybody's) sentences as if they were mathematical
> | statements and then you check if they are true in the strict
> | mathematical sense.
>
>   Wrong.

:)
J.
From: Hartmann Schaffer
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3960da03@news.sentex.net>
In article <··········@spamkiller.newsfeeds.com>,
	"Janos Blazi" <······@vipsurf.de> writes:
> ...
> I thought about Erik's remark and my explanation is this: You always had to
> use zero terminated strings in C, there was no way to circuvent them, but

no you don't.  in C, strings are nothing but arrays of characters, and 
your code can deal with rhem any way it (or it's programmer) wants.

> you could do very well without LDB (it took me several minutes to figure out
> that in LDB the byte does not necessarily starts at a byte boundary; it is a
> powerful function). (The reason for zero terminated strings was that on
> their first machine (PDP?) they used hardwate to find such zeroes.)

pdp 7 and pdp11.  the pdp11 definitely didn't have any special
instructions to support zero terminated strings (except for the fact
that almost any instruction set the condition register, so you usually 
didn't have to use an extra compare instruction to check for a zero
byte.  C's granddaddy (bcpl) used length delimited strings (i.e  you
stored the length at the beginning of the string).  My suspicion is
(based on my own experiences) that  for the applications C got used
for the length determined strings didn't buy you anything (esp in the
absence of any hadware support for string move), snd in most cases you 
get more compact code (those machines didn't have more than 64KB
address space, so code size was critical) with zero terminated strings.

> And in C++ zero terminated strings still were in use, though they became
> less important.

because there are a couple of alternate string libraries available.
Just proves that there is no assumption about string representation
built into the language

> ...

-- 

Hartmann Schaffer
From: Barry Margolin
Subject: Re: Access the the second return value?
Date: 
Message-ID: <e%485.29$VE5.689@burlma1-snr2>
In article <········@news.sentex.net>,
Hartmann Schaffer <··@inferno.nirvananet> wrote:
>In article <··········@spamkiller.newsfeeds.com>,
>	"Janos Blazi" <······@vipsurf.de> writes:
>> ...
>> I thought about Erik's remark and my explanation is this: You always had to
>> use zero terminated strings in C, there was no way to circuvent them, but
>
>no you don't.  in C, strings are nothing but arrays of characters, and 
>your code can deal with rhem any way it (or it's programmer) wants.

Actually, in the C standard, the term "string" is defined to be to
zero-terminated arrays of characters.  I believe the descriptions of the
strXXX() functions depend on this definition (e.g. the description of
strcat() says that its two arguments are pointers to strings).

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Hartmann Schaffer
Subject: Re: Access the the second return value?
Date: 
Message-ID: <39610a9f@news.sentex.net>
In article <················@burlma1-snr2>,
	Barry Margolin <······@genuity.net> writes:
> In article <········@news.sentex.net>,
> Hartmann Schaffer <··@inferno.nirvananet> wrote:
>>In article <··········@spamkiller.newsfeeds.com>,
>>	"Janos Blazi" <······@vipsurf.de> writes:
>>> ...
>>> I thought about Erik's remark and my explanation is this: You always had to
>>> use zero terminated strings in C, there was no way to circuvent them, but
>>
>>no you don't.  in C, strings are nothing but arrays of characters, and 
>>your code can deal with rhem any way it (or it's programmer) wants.
> 
> Actually, in the C standard, the term "string" is defined to be to
> zero-terminated arrays of characters.  I believe the descriptions of the

doesn't that only cover the string literals and the library functions?
you can easily write code that doesn't use the zero termination

> strXXX() functions depend on this definition (e.g. the description of
> strcat() says that its two arguments are pointers to strings).
> 

-- 

Hartmann Schaffer
From: Barry Margolin
Subject: Re: Access the the second return value?
Date: 
Message-ID: <bo885.41$VE5.757@burlma1-snr2>
In article <········@news.sentex.net>,
Hartmann Schaffer <··@inferno.nirvananet> wrote:
>In article <················@burlma1-snr2>,
>	Barry Margolin <······@genuity.net> writes:
>> In article <········@news.sentex.net>,
>> Hartmann Schaffer <··@inferno.nirvananet> wrote:
>>>In article <··········@spamkiller.newsfeeds.com>,
>>>	"Janos Blazi" <······@vipsurf.de> writes:
>>>> ...
>>>> I thought about Erik's remark and my explanation is this: You always had to
>>>> use zero terminated strings in C, there was no way to circuvent them, but
>>>
>>>no you don't.  in C, strings are nothing but arrays of characters, and 
>>>your code can deal with rhem any way it (or it's programmer) wants.
>> 
>> Actually, in the C standard, the term "string" is defined to be to
>> zero-terminated arrays of characters.  I believe the descriptions of the
>
>doesn't that only cover the string literals and the library functions?
>you can easily write code that doesn't use the zero termination

The things that it deals with would not generally be called "strings".  In
the C community, that term has a specific meaning, which is based on the
literals and the library functions.  Anything else is just a character
array, not a string.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Gareth McCaughan
Subject: Re: Access the the second return value?
Date: 
Message-ID: <slrn8lv1ev.1e1.gjm11@g.local>
Janos Blazi wrote:

[SNIP: someone else's explanation of CAR and CDR]
> Isn't it strange that early machine archtectures still have such an impact
> on modern programming languages? This is the same as the zero terminated
> strings in C, but one would not expect this kind of thing in Lisp2!

Doesn't look like very much impact to me. Just the names. (It's
not as if CL is the only language that has an "ordered pair"
type, after all. Even C++ has one, sort of.)

-- 
Gareth McCaughan  ················@pobox.com
sig under construction
From: Larry Elmore
Subject: Re: Access the the second return value?
Date: 
Message-ID: <8jq4ca$2ivo$1@newssvr03-int.news.prodigy.com>
"Derek Peschel" <········@eskimo.com> wrote in message
····························@eskimo.com...
> In article <········@news.sentex.net>, Hartmann Schaffer wrote:
> >In article <················@naggum.net>,
> > Erik Naggum <····@naggum.net> writes:
> >> * "Larry Elmore" <········@prodigy.net>
> >>| I don't see this, unless you are using the IBM mainframe on which
> >>| Lisp was first developed -- and even then, the abbreviations for
> >>| 'Contents of Address Register' and 'Contents of Data Register'
> >>| aren't very meaningful...
> >
> >unless memory deceives me very badly, the d in cdr stands for
> >decrement.  given the limited amount of memory those machines had,
> >there usualls was enough space in a word or register to kep two
> >addresse, and manu machines had an optimization feature that let you
> >store a second value in a (n index)register that was added to or
> >subtracted from the other (address) part every time the register got
> >accessed.
>
> You're very close to the truth.  Larry is a farther away (and his
expansions
> of CAR and CDR get quoted a lot -- or "Contents of Decrement Register" if
> you're lucky).

They do get quoted a lot -- the incorrect explanation was one I'd read in
several places and so assumed was correct.

> The IBM 704 had 36-bit words and 15-bit (!) addresses.  Words used as data
> had four parts: 3-bit tag (or prefix?) field, 15-bit address field, 3-bit
> prefix (or tag?) field, and 15-bit decrement field.  I'm not sure where
the
> prefix and tag fields go in the word.
>
> LISP 1.5 rarely or never uses the prefix and tag fields.  CONS cells have
0
> in those fields.  So that's why you only get CAR and CDR; earlier versions
> of LISP gave you CPR and CTR (and CWR for the whole word) as well but
> evidently they were too useless to keep.
>
> Of course LISP does have full words (numbers, names of symbols, machine
> instructions) in which all the fields are full, but they aren't treated as
> separate fields so you aren't allowed to get the parts of full words.
>
> The real key to the etymology is that "register" once referred to _all_
> memory locations, not just the ones internal to the CPU.  If you
programmed
> the machine directly, you might want to refer to the address field of
> location 12345.  This would be the contents of the address field of
register
> 12345, or CAR 12345.  LISP added names (symbols) so you didn't have to
refer
> to absolute memory locations, but the usage is almost the same.  (CAR FOO)
> converts FOO to an absolute location and gets you the contents of the
> address field at that location, or register.  The part about index
register
> instructions is true but is a red herring.

Thanks for the detailed explanation. Lisp's historical baggage is even
heavier than I thought...

Larry
From: Robert Monfera
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3960A89F.7B3487C8@fisec.com>
Your superfluous quoting baggage is even heavier than I thought...

Robert

Larry Elmore wrote:

[lots of text deleted]

> Lisp's historical baggage is even heavier than I thought...
From: Larry Elmore
Subject: Re: Access the the second return value?
Date: 
Message-ID: <8k5tql$1nfa$1@newssvr03-int.news.prodigy.com>
"Robert Monfera" <·······@fisec.com> wrote in message
······················@fisec.com...
> Your superfluous quoting baggage is even heavier than I thought...
Sorry! :(
From: Friedrich Dominicus
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87snty3vex.fsf@q-software-solutions.com>
Paul Foley <·······@actrix.gen.nz> writes:

> On 28 Jun 2000 10:43:21 +0200, Friedrich Dominicus wrote:
> 
> > CL-USER 9 : 1 > (multiple-value-bind (item present?)
> 
> Argh!  I am the only one that's bothered by this godawful Schemish use
> of `?' in symbols for "predicate" functions/values?

matter of taste. I have to admit I like ! and ? more than in case one
I did not even know and what's or p or is it -p in the latter. But if
you feel unhappy with that read it as
presentp ;-)

Regard
Friedrich

-- 
for e-mail reply remove all after .com 
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171179407863670@naggum.no>
* Paul Foley <·······@actrix.gen.nz>
| Argh!  I am the only one that's bothered by this godawful Schemish
| use of `?' in symbols for "predicate" functions/values?

  No, but it's a very useful thing, this little question mark, as it
  communicates there's little hope of getting the person using it to
  stop thinking in Scheme when writing in Common Lisp.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <u8zvqnfnd.fsf@res.raytheon.com>
Paul Foley <·······@actrix.gen.nz> writes:

> On 28 Jun 2000 10:43:21 +0200, Friedrich Dominicus wrote:
> 
> > CL-USER 9 : 1 > (multiple-value-bind (item present?)
> 
> Argh!  I am the only one that's bothered by this godawful Schemish use
> of `?' in symbols for "predicate" functions/values?

there's no accounting for taste.  i happen to like ? and ! over the
more traditional p and f.  just because this notation comes from
scheme doesn't necessarily make it bad.  it's only a style convention.

i do use p and f because it's hard to fight the tide of tradition.
macros for CLOS, for example, automatically define a -p instead of a ?
suffix.  lisp, being an old language, has many of these minor
traditionals which could have been better but live on for
historical reasons.

you may actually be the only one this bothered.

-- 
johan kullstam l72t00052
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171189838798439@naggum.no>
* Johan Kullstam <········@ne.mediaone.net>
| there's no accounting for taste.  i happen to like ? and ! over the
| more traditional p and f.

  f?  If this is what I think it is, namely a truly _perverted_
  Schemocentric world-view where Scheme's ridiculous set! is deemed
  the model for setf, there _is_ accounting for taste: Scheme is bad
  for young people's brains.

| just because this notation comes from scheme doesn't necessarily
| make it bad.

  No, not _necessarily_, but it doesn't help.  Everything good in
  Scheme is already adopted by every other language.  Being a
  minimalist language, that means whatever is left is just trash
  waiting for the last reference to go before it is collected and
  carted out.

| you may actually be the only one this bothered.

  Not so.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <uvgytn2h6.fsf@res.raytheon.com>
Erik Naggum <····@naggum.no> writes:

> * Johan Kullstam <········@ne.mediaone.net>
> | there's no accounting for taste.  i happen to like ? and ! over the
> | more traditional p and f.
> 
>   f?  If this is what I think it is,

not at all.  i just think that using the characters ? and ! instead of
p and f in common-lisp would be preferable [1].  i am not saying use
scheme's set!, i am saying we could just as well have spelled
common-lisp "setf" as "set!" [2].  it'd still *be* setf.  only the name
would be different.  on the other hand, it's not like spelling matters
much and it's certainly not worth the bother of changing now.  keeping
everything consistant is much more important.  i'm not agitating for
any changes, just pointing out that i don't find it all that annoying.

>   namely a truly _perverted_
>   Schemocentric world-view where Scheme's ridiculous set! is deemed
>   the model for setf, there _is_ accounting for taste: Scheme is bad
>   for young people's brains.

no need for fear and loathing time yet.  sorry i brought it up.

[1] just my opinion and i realize there's no accounting for taste.
    p and f are letters and whether to use "-p" or just slap a plain
    "p" on the end of a predicate is a (albeit very slight) annoyance.

[2] except for early keyboards back in '62 might not have had any "!"
    or perhaps it was used for some system function, or maybe someone
    else just had a different set of tastes.

-- 
johan kullstam l72t00052
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171206428191286@naggum.no>
* Johan Kullstam <········@ne.mediaone.net>
| there's no accounting for taste.  i happen to like ? and ! over the
| more traditional p and f.

* Erik Naggum
| f?  If this is what I think it is,

* Johan Kullstam <········@ne.mediaone.net>
| not at all.

  But then you proceed to tell me it is exactly what I think it is: A
  serious confusion of Scheme's childishly amusing use of bang in some
  operators like set!, with Common Lisp's very generalized "set
  field", which originally comes from CLOS, I believe.

| i am not saying use scheme's set!, i am saying we could just as well
| have spelled common-lisp "setf" as "set!" [2].

  No, we couldn't.  ! is overcute, childish, silly, even ridiculous,
  the sort of immature reminders that C programmers who build complex
  prefix systems ["Hungarian" noation] in their variable names use
  because they lose track of type information.  ? at least has _some_
  merit, but its association with ! is not to its credit.

| on the other hand, it's not like spelling matters much and it's
| certainly not worth the bother of changing now.

  Syntax and spelling matters very much.

| no need for fear and loathing time yet.

  OK.  :)

| [1] just my opinion and i realize there's no accounting for taste.
|     p and f are letters and whether to use "-p" or just slap a plain
|     "p" on the end of a predicate is a (albeit very slight) annoyance.

  But the rule is quite simple: If the symbol has a - already, add -p
  at the end, and if not, just add p.

| [2] except for early keyboards back in '62 might not have had any "!"
|     or perhaps it was used for some system function, or maybe someone
|     else just had a different set of tastes.

  Or perhaps it's because it looks dumb.  E.g., suppose I think we
  need a special syntax for conditions, like ending in interrobang.
  Some would think it cute, some would retch and barf in my general
  direction, and hoardes of educators everywhere would think it just
  as bright as the Hungarian notation and destroy the aesthetic sense
  of _another_ generation of programmers, as if Perl and C++ hadn't
  done away with the concept of aesthetics in the first place.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Joe Marshall
Subject: Re: Access the the second return value?
Date: 
Message-ID: <wvj9r20g.fsf@alum.mit.edu>
Erik Naggum <····@naggum.no> writes:

> | i am not saying use scheme's set!, i am saying we could just as well
> | have spelled common-lisp "setf" as "set!" [2].
> 
>   No, we couldn't.  ! is overcute, childish, silly, even ridiculous,
>   the sort of immature reminders that C programmers who build complex
>   prefix systems ["Hungarian" noation] in their variable names use
>   because they lose track of type information.  ? at least has _some_
>   merit, but its association with ! is not to its credit.

`Hungarian' notation loses on two counts:  not only does it encodes
type information in variables (strong typing advocates may not object
to this), it also encodes the concrete type rather than the abstract
type, thus cluttering the variable name with irrelevant noise.
Knowing that the variable `user_name' is implemented as a `pointer to
a zero-terminated string of two-byte characters' is pointless trivia.

Scheme's `!' notation does not encode a type, but indicates that the
function named may have side effects.  The absence of the `!' is a
reasonable indication that you are dealing with a `pure' function.  If
you believe that there is some merit in writing purely functional
code, it is convenient to know if a particular function should be
avoided.

The `?' notation, however, *does* encode type information, although
not the same sort of information that `Hungarian' notation encodes.

Common Lisp does not eschew side effects as much as Scheme, so the `!'
notation may be of less utility.
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87em5hcg6t.fsf@quadium.net>
Joe Marshall <·········@alum.mit.edu> writes:

> to this), it also encodes the concrete type rather than the abstract
> type, thus cluttering the variable name with irrelevant noise.
> Knowing that the variable `user_name' is implemented as a `pointer to
> a zero-terminated string of two-byte characters' is pointless trivia.

In my Java work especially, I write code that operates on, say, a
LinkedList.  I may decide to abstract it more to allow any List, or
restrict it to use MySpecialListDuJour.  Why anyone would want to
scatter possibly volatile information throughout their code and make
such changes more difficult is beyond me.

-- 
vsync
http://quadium.net/ - last updated Fri Jun 23 23:28:05 MDT 2000
Orjner.
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <u66qtmtxc.fsf@res.raytheon.com>
Erik Naggum <····@naggum.no> writes:

> | [1] just my opinion and i realize there's no accounting for taste.
> |     p and f are letters and whether to use "-p" or just slap a plain
> |     "p" on the end of a predicate is a (albeit very slight) annoyance.
> 
>   But the rule is quite simple: If the symbol has a - already, add -p
>   at the end, and if not, just add p.

except for CLOS which affixes -p no matter what.  i do think the CLOS
behavior is correct.  having defclass parse the symbol name string and
use -p or p depending on presence of - or not seems to be a bit more
fanciness than is warranted.

i like a language to support artificial intelligence, not to be an
artificial intelligence in its own right.  ;-)  reminds me of DWIM.

> | [2] except for early keyboards back in '62 might not have had any "!"
> |     or perhaps it was used for some system function, or maybe someone
> |     else just had a different set of tastes.
> 
>   Or perhaps it's because it looks dumb.

which is your (and probably the majority's) opinion.  it's also
somewhat of what you are used to.  changes are usually unwelcome.
gratuitous change more so.

-- 
johan kullstam l72t00052
From: Tim Bradshaw
Subject: Re: Access the the second return value?
Date: 
Message-ID: <ey366qt1noi.fsf@cley.com>
* Johan Kullstam wrote:
> except for CLOS which affixes -p no matter what.  i do think the CLOS
> behavior is correct.  having defclass parse the symbol name string and
> use -p or p depending on presence of - or not seems to be a bit more
> fanciness than is warranted.

I think you mean DEFSTRUCT, not DEFCLASS (which doesn't define a
predicate)

--tim
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <m2d7l0its4.fsf@euler.axel.nom>
Tim Bradshaw <···@cley.com> writes:

> * Johan Kullstam wrote:
> > except for CLOS which affixes -p no matter what.  i do think the CLOS
> > behavior is correct.  having defclass parse the symbol name string and
> > use -p or p depending on presence of - or not seems to be a bit more
> > fanciness than is warranted.
> 
> I think you mean DEFSTRUCT, not DEFCLASS (which doesn't define a
> predicate)

yes.  thanks.

-- 
J o h a n  K u l l s t a m
[········@ne.mediaone.net]
Don't Fear the Penguin!
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171224965405537@naggum.no>
* Johan Kullstam <········@ne.mediaone.net>
| except for CLOS which affixes -p no matter what.

  Um, where does CLOS do that?

| which is your (and probably the majority's) opinion.  it's also
| somewhat of what you are used to.  changes are usually unwelcome.
| gratuitous change more so.

  Well, I have made it the biggest issue of my life and carreer to be
  able to sustain dramatic changes with a minimum of personal cost.
  This has certain costs of its own, which would be unwelcome to
  people who prefer _most_ things to be practically static in their
  life, but staying on top requires so much adaptability to change
  that I consider "changes are usually unwelcome" to be a dumb thing
  to say in our time.  10 years ago, it would make much more sense as
  a general statement for our part of the culture, but the world has,
  well, changed a lot in 10 years, and sticking to old stuff is the
  hallmark of unemployed or retired IT specialists.  The morale of
  this gripe is simply: Don't assume that people are so unable to deal
  with change that they will use it as an argument against anything.
  Chances are that anyone who makes a reasonably good living in
  information technology these days have to deal with a rate of change
  that would probably drive someone literally insane in the 70's.

  Incidentally, I recommend Alvin Toffler: Future Shock to anyone who
  think adapting to change is too expensive.

  Oh, and as an irrelevant side-note: The the kinds of things that
  _don't_ change bug me the most.  Stupidity, for instance.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <m266qsi3qi.fsf@euler.axel.nom>
Erik Naggum <····@naggum.no> writes:

> * Johan Kullstam <········@ne.mediaone.net>
> | except for CLOS which affixes -p no matter what.
> 
>   Um, where does CLOS do that?

sorry, i meant defstruct.

this whole thing is snowballing way further than it was ever worth.
i shall, as they say in france, laisse tomb�.

-- 
J o h a n  K u l l s t a m
[········@ne.mediaone.net]
Don't Fear the Penguin!
From: Christopher Browne
Subject: Re: Access the the second return value?
Date: 
Message-ID: <slrn8ll55b.2sd.cbbrowne@knuth.brownes.org>
Centuries ago, Nostradamus foresaw a time when Erik Naggum would say:
>* Johan Kullstam <········@ne.mediaone.net>
>| i am not saying use scheme's set!, i am saying we could just as well
>| have spelled common-lisp "setf" as "set!" [2].
>
>  No, we couldn't.  ! is overcute, childish, silly, even ridiculous,
>  the sort of immature reminders that C programmers who build complex
>  prefix systems ["Hungarian" noation] in their variable names use
>  because they lose track of type information.  ? at least has _some_
>  merit, but its association with ! is not to its credit.

Worse still, it's more likely due, not to Scheme, but rather to
_Forth_.

: add2! dup @ 2 + ! ;
-- 
········@ntlug.org - <http://www.ntlug.org/~cbbrowne/lsf.html>
Rules of the Evil Overlord #77. "If I have a fit of temporary
insanity and decide to give the hero the chance to reject a job as my
trusted lieutentant, I will retain enough sanity to wait until my
current trusted lieutenant is out of earshot before making the offer."
<http://www.eviloverlord.com/>
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171274968612040@naggum.no>
* Christopher Browne
| Worse still, it's more likely due, not to Scheme, but rather to
| _Forth_.
| 
| : add2! dup @ 2 + ! ;

  I find this _highly_ unlikely.

#:Erik, who wrote a Forth interpreter for fun for a PDP-10 in 1982.
-- 
  If this is not what you expected, please alter your expectations.
From: R Matthew Emerson
Subject: Re: Access the the second return value?
Date: 
Message-ID: <rbs8zvpr1ov.fsf@agrias.lerc.nasa.gov>
Johan Kullstam <········@ne.mediaone.net> writes:

> i just think that using the characters ? and ! instead of
> p and f in common-lisp would be preferable [1].  i am not saying use
> scheme's set!, i am saying we could just as well have spelled
> common-lisp "setf" as "set!" [2].  it'd still *be* setf.  only the name
> would be different.

I think you're misunderstanding the '!' convention as used in Scheme
and Dylan.  I believe that the bang suffix is used to denote mutators.
CL's "nappend" would be "append!";  "nreverse" would be "reverse!";
"sort" would be "sort!", and so forth.

Generalized variable access is something else again.

> on the other hand, it's not like spelling matters much and it's
> certainly not worth the bother of changing now.  keeping everything
> consistant is much more important.

Well, CL isn't 100% consistent in any case---why isn't sort called
nsort, for example?  I think the point is that it's wise to stick to
the traditional idiom/style/mode of the language.

-- 
Matt Emerson <···@grc.nasa.gov>
Never get involved in a land war in Asia.
From: Philip Lijnzaad
Subject: Re: Access the the second return value?
Date: 
Message-ID: <u7sntxbkc8.fsf@o2-3.ebi.ac.uk>
> I think you're misunderstanding the '!' convention as used in Scheme
> and Dylan.  I believe that the bang suffix is used to denote mutators.
> CL's "nappend" would be "append!";  "nreverse" would be "reverse!";
> "sort" would be "sort!", and so forth.

exactly: FORTH. Did this '!'-convention perhaps come from Forth, where it's
usually pronounced as 'store' (as in: "42 the_answer !", which puts 42 into
the variable the_answer)? Or is it is more likely to have come from mutators
being indicative of imperative (as in "Do this! Do that!") programming?

(I must say though, that NREVERSE doesn't receive much of an aesthetics or
clarity price either)

                                                                      Philip
-- 
Ban GM foods! Long live the Mesolithicum, pesticides and starvation
-----------------------------------------------------------------------------
Philip Lijnzaad, ········@ebi.ac.uk \ European Bioinformatics Institute,rm A2-24
+44 (0)1223 49 4639                 / Wellcome Trust Genome Campus, Hinxton
+44 (0)1223 49 4468 (fax)           \ Cambridgeshire CB10 1SD,  GREAT BRITAIN
PGP fingerprint: E1 03 BF 80 94 61 B6 FC  50 3D 1F 64 40 75 FB 53
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87aeg5cg4p.fsf@quadium.net>
Philip Lijnzaad <········@ebi.ac.uk> writes:

> exactly: FORTH. Did this '!'-convention perhaps come from Forth, where it's
> usually pronounced as 'store' (as in: "42 the_answer !", which puts 42 into
> the variable the_answer)? Or is it is more likely to have come from mutators
> being indicative of imperative (as in "Do this! Do that!") programming?

Or maybe as a warning to the more forgetful programmers.  ("Look out!
This may eat stuff!")

-- 
vsync
http://quadium.net/ - last updated Fri Jun 23 23:28:05 MDT 2000
Orjner.
From: Larry Elmore
Subject: Re: Access the the second return value?
Date: 
Message-ID: <8jfk90$8m4$1@news.campuscwix.net>
"Philip Lijnzaad" <········@ebi.ac.uk> wrote in message
···················@o2-3.ebi.ac.uk...
>
> > I think you're misunderstanding the '!' convention as used in Scheme
> > and Dylan.  I believe that the bang suffix is used to denote mutators.
> > CL's "nappend" would be "append!";  "nreverse" would be "reverse!";
> > "sort" would be "sort!", and so forth.
>
> exactly: FORTH. Did this '!'-convention perhaps come from Forth, where
it's
> usually pronounced as 'store' (as in: "42 the_answer !", which puts 42
into
> the variable the_answer)? Or is it is more likely to have come from
mutators
> being indicative of imperative (as in "Do this! Do that!") programming?

I don't know. I've wondered about a possible Forth connection, too. I've
always had a good feeling about Forth since it was the second computer
language I learned and found that it was so far superior to the first (Basic
on a Radio Shack TRS-80 Model I) that I stuck with it for quite a while.
It's too minimalist, though, and too fragmented, but it was _fun_ to work
with. I've always hated C and C++, could tolerate Ada95, but didn't
rediscover the _joy_ of programming until I encountered Lisp last year and
took the time to really look into it.

> (I must say though, that NREVERSE doesn't receive much of an aesthetics or
> clarity price either)

No, it certainly doesn't. One thing I really like about Scheme is that it's
very clean and consistent (what there is of it; although I'm not too sure
about continuations being all that clean). Having strong opinions on whether
set! or setf is preferable strikes me as akin to having strong opinions
about whether sandwiches should be sliced vertically or diagonally -- i.e.,
some people probably need more fiber in their diet. 'setf' makes as little
sense to me as 'set!' -- so it's short for 'set field', so what? What _else_
could it possibly set other than various words meaning the same thing? Why
couldn't it have just been called 'set'?

Either way, I find Scheme's consistency pleasing (as far as it goes) and
Common Lisp's many idiosyncracies in this regard rather dopey -- I realize
there are historical reasons for all of them, but I've never been one to
revere tradition simply for tradition's sake. Of course, I also think the
English alphabet needs to be somewhat enlarged and made phonetic -- 'cat'
_should_ be spelled 'kat' and the letter 'c' used to represent just the 'ch'
sound instead of also masquerading as an 's' sometimes and a 'k' at others.

Common Lisp is a lot more usable than Scheme (though most Schemes have a lot
of (mutually incompatible) extensions that partially make up for the slim
standard), but I'd like to see a "grown-up" Scheme -- a standard that
embraces the functionality of Common Lisp while remaining as clean and
consistent as possible. In theory, Scheme is clean and consistent now, but
in practice it's not because of all the extensive, incompatible add-ons each
version finds necessary to put in. That's why I'm returning to Common Lisp
after an extended detour to learn Scheme -- Scheme's not as practical. One
might hope that will change, but at the rate the Scheme standard grows, it
will reach Common Lisp's functionality long after I'm dead.

Larry
From: Johan Kullstam
Subject: Re: Access the the second return value?
Date: 
Message-ID: <u1z1hmt22.fsf@res.raytheon.com>
R Matthew Emerson <···@grc.nasa.gov> writes:

> Johan Kullstam <········@ne.mediaone.net> writes:
> 
> > i just think that using the characters ? and ! instead of
> > p and f in common-lisp would be preferable [1].  i am not saying use
> > scheme's set!, i am saying we could just as well have spelled
> > common-lisp "setf" as "set!" [2].  it'd still *be* setf.  only the name
> > would be different.
> 
> I think you're misunderstanding the '!' convention as used in Scheme
> and Dylan.

i think i'm intentionally not caring what the "!" convention means in
scheme or dylan.  some lisp operations end in an "f", e.g., SETF, INCF.
one could have spelled it SET! and INC! respectively.  it seems most
people here prefer the traditional way.  so be it.

> I believe that the bang suffix is used to denote mutators.
> CL's "nappend" would be "append!";  "nreverse" would be "reverse!";
> "sort" would be "sort!", and so forth.

> Generalized variable access is something else again.

hmm.  i have always said that there are two kinds of destruction.  the
one that might wantonly chew up its args like NREVERSE and the kind
that must alter an argument in a particular well-defined way like
INCF.

> > on the other hand, it's not like spelling matters much and it's
> > certainly not worth the bother of changing now.  keeping everything
> > consistant is much more important.
> 
> Well, CL isn't 100% consistent in any case---why isn't sort called
> nsort, for example?  I think the point is that it's wise to stick to
> the traditional idiom/style/mode of the language.

sure, and there's the REMOVE and DELETE pair.  you might think DELETE
would be spelled NREMOVE.

-- 
johan kullstam l72t00052
From: Erik Naggum
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3171225324347929@naggum.no>
* Johan Kullstam <········@ne.mediaone.net>
| i think i'm intentionally not caring what the "!" convention means in
| scheme or dylan.  some lisp operations end in an "f", e.g., SETF, INCF.
| one could have spelled it SET! and INC! respectively.  it seems most
| people here prefer the traditional way.  so be it.

  No.  They would be probably spelled SETF! and INCF!, since the F has
  nothing at all to do with mutating anything, it has to do with what
  is being accessed (and mutated).  Please understand this and quit
  that annoying noise about the suffix F.  It's dead wrong.  Repeating
  it so annoyingly often means you don't listen, and that very likely
  means your other notions are not based on listening, either, which
  is a very nice way of saying that they are your own inventions.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: R Matthew Emerson
Subject: Re: Access the the second return value?
Date: 
Message-ID: <rbszoo5pl0p.fsf@agrias.lerc.nasa.gov>
R Matthew Emerson <···@grc.nasa.gov> writes:

> I think you're misunderstanding the '!' convention as used in Scheme
> and Dylan.  I believe that the bang suffix is used to denote mutators.
> CL's "nappend" would be "append!";  "nreverse" would be "reverse!";
> "sort" would be "sort!", and so forth.

err, there isn't actually a function in CL called nappend; nconc
is the destructive version of append.

-- 
Matt Emerson <···@grc.nasa.gov>
Wizard shot the food.
From: David Bakhash
Subject: Re: Access the the second return value?
Date: 
Message-ID: <c29n1k5c1sa.fsf@nerd-xing.mit.edu>
Johan Kullstam <········@ne.mediaone.net> writes:

> you may actually be the only one this bothered.

well, if you wanna know, I'm bothered every time I see a ? or ! in a CL
program.  

dave
From: Paul Foley
Subject: Re: Access the the second return value?
Date: 
Message-ID: <m2pup129pc.fsf@mycroft.actrix.gen.nz>
On 28 Jun 2000 08:39:34 -0400, Johan Kullstam wrote:

> Paul Foley <·······@actrix.gen.nz> writes:
>> On 28 Jun 2000 10:43:21 +0200, Friedrich Dominicus wrote:
>> 
>> > CL-USER 9 : 1 > (multiple-value-bind (item present?)
>> 
>> Argh!  I am the only one that's bothered by this godawful Schemish use
>> of `?' in symbols for "predicate" functions/values?

> there's no accounting for taste.  i happen to like ? and ! over the
> more traditional p and f.  just because this notation comes from
> scheme doesn't necessarily make it bad.  it's only a style convention.

I didn't say it was bad _because_ it comes from Scheme.  I guess the
main reason I dislike it is that I think verbally, and automatically
read the punctuation marks as changes in "intonation" (if I can use
that word of a thought), and it's really jarring to have it come in
the programming-language equivalent? of the middle! of a sentence.

[I'm not aware of any tradition of using "f" in Lisp where Scheme uses
"!".  SETF is a fairly recent addition to Lisp, and SETQ was
originally a minor variation on SET.]

-- 
Nomina stultorum in parietibus et portis semper videmus.      -- Cicero

(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(··@) "actrix.gen.nz>"))
From: vsync
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87n1k5cgig.fsf@quadium.net>
Paul Foley <·······@actrix.gen.nz> writes:

> [I'm not aware of any tradition of using "f" in Lisp where Scheme uses
> "!".  SETF is a fairly recent addition to Lisp, and SETQ was
> originally a minor variation on SET.]

I thought there was somewhat of a tradition of using "n-" for
destructive operations (nconc etc...)  Isn't that what "!" is for in
Scheme?

-- 
vsync
http://quadium.net/ - last updated Fri Jun 23 23:28:05 MDT 2000
Orjner.
From: Reini Urban
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395b5533.272507915@news>
Johan Kullstam wrote:
>Paul Foley <·······@actrix.gen.nz> writes:
>> On 28 Jun 2000 10:43:21 +0200, Friedrich Dominicus wrote:
>> > CL-USER 9 : 1 > (multiple-value-bind (item present?)
>> 
>> Argh!  I am the only one that's bothered by this godawful Schemish use
>> of `?' in symbols for "predicate" functions/values?
>
>there's no accounting for taste.  i happen to like ? and ! over the
>more traditional p and f.  just because this notation comes from
>scheme doesn't necessarily make it bad.  it's only a style convention.
>
>i do use p and f because it's hard to fight the tide of tradition.
>macros for CLOS, for example, automatically define a -p instead of a ?
>suffix.  lisp, being an old language, has many of these minor
>traditionals which could have been better but live on for
>historical reasons.
>
>you may actually be the only one this bothered.

I personally prefer -bool over ? or -p suffixes where is enough room.
here as once used argument there is enough room, inside loops or nested
calls I would favor a short p?

-p is reserved for a function, not the variable, 
? is fine in a variable name, but I prefer more readable names,
so dummies (coming from pascal/C/java, ...) can also understand it
without the bruden to be forced to think in cryptic language specific
pre-/suffix conventions as with scheme, lisp, ms-hungarian and such.
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
From: SRS
Subject: Re: Access the the second return value?
Date: 
Message-ID: <8jicre$b3e$1@nnrp1.deja.com>
In article <··············@mycroft.actrix.gen.nz>,
  Paul Foley <·······@actrix.gen.nz> wrote:
> Argh!  I am the only one that's bothered by this godawful Schemish use
> of `?' in symbols for "predicate" functions/values?

Starting predicates with "is" or "has" (like java does) avoids this
problem altogether: e.g. is-present instead of present{-p|p|?|whatever}

--SRS


Sent via Deja.com http://www.deja.com/
Before you buy.
From: David Thornley
Subject: Re: Access the the second return value?
Date: 
Message-ID: <u%695.3305$iN5.811927@ptah.visi.com>
In article <············@nnrp1.deja.com>, SRS  <·····@my-deja.com> wrote:
>In article <··············@mycroft.actrix.gen.nz>,
>  Paul Foley <·······@actrix.gen.nz> wrote:
>> Argh!  I am the only one that's bothered by this godawful Schemish use
>> of `?' in symbols for "predicate" functions/values?
>
>Starting predicates with "is" or "has" (like java does) avoids this
>problem altogether: e.g. is-present instead of present{-p|p|?|whatever}
>
Sigh.

Anybody got another standard to propose, to add to the existing ones?

How about putting a capital Q in the middle of the symbol?  Of course,
this standard has problems with symbols with an odd number of characters.

Alternatively, of course, I suppose we could go over to Java newsgroups
and tell them that they can get rid of those annoying is- prefixes by
replacing them with -p suffixes.



--
David H. Thornley                        | If you want my opinion, ask.
·····@thornley.net                       | If you don't, flee.
http://www.thornley.net/~thornley/david/ | O-
From: Robert Monfera
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395AAB7D.3AC20E29@fisec.com>
Friedrich Dominicus wrote:

> CL-USER 9 : 1 > (multiple-value-bind (item present?)
>                     (gethash 2 ht)
>                   (list item present?))

Shortcut: (multiple-value-list (gethash 2 ht))

Robert
From: Pierre R. Mai
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87hfacxtnk.fsf@orion.dent.isdn.cs.tu-berlin.de>
Robert Monfera <·······@fisec.com> writes:

> Friedrich Dominicus wrote:
> 
> > CL-USER 9 : 1 > (multiple-value-bind (item present?)
> >                     (gethash 2 ht)
> >                   (list item present?))
> 
> Shortcut: (multiple-value-list (gethash 2 ht))

Or (multiple-value-call #'list (gethash 2 ht))  ;)

This is more useful of course when you want to call some other
constructor, like #'cons, or some BOA structure constructor, etc.

Regs, Pierre.

-- 
Pierre Mai <····@acm.org>         PGP and GPG keys at your nearest Keyserver
  "One smaller motivation which, in part, stems from altruism is Microsoft-
   bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
From: Robert Monfera
Subject: Re: Access the the second return value?
Date: 
Message-ID: <395C05B5.982FCBAD@fisec.com>
"Pierre R. Mai" wrote:

> Or (multiple-value-call #'list (gethash 2 ht))  ;)

I initially thought of multiple-value-call as a function that would
return two values (8 and 2) instead of 10 in this case:

(multiple-value-call #'+ (floor 7 3)(floor 13 2)) => 8 2

Would not it be more reasonable?

Robert
From: Martti Halminen
Subject: Re: Access the the second return value?
Date: 
Message-ID: <3959BD30.70B59C18@solibri.com>
Richard James Panturis Giuly wrote:
> 
> For some reason I can't find how to access the second return
> value of a function like gethash. Could someone help me out?

multiple-value-bind, multiple-value-call, multiple-value-setq
etc.

--
From: Tim Bradshaw
Subject: Re: Access the the second return value?
Date: 
Message-ID: <ey3snty117z.fsf@cley.com>
* Martti Halminen wrote:

> multiple-value-bind, multiple-value-call, multiple-value-setq
> etc.

Also nth-value is very useful

--tim
From: Pierre R. Mai
Subject: Re: Access the the second return value?
Date: 
Message-ID: <87r99it24b.fsf@orion.dent.isdn.cs.tu-berlin.de>
Martti Halminen <···············@solibri.com> writes:

> Richard James Panturis Giuly wrote:
> > 
> > For some reason I can't find how to access the second return
> > value of a function like gethash. Could someone help me out?
> 
> multiple-value-bind, multiple-value-call, multiple-value-setq
> etc.

Or, in the unlikely event that you only need the second (and not the
first value), you can use nth-value, as in

(defun key-presentp (key hash)
  "Check whether the given key is present in the given hash table."
  (nth-value 1 (gethash key hash)))

Regs, Pierre.

-- 
Pierre Mai <····@acm.org>         PGP and GPG keys at your nearest Keyserver
  "One smaller motivation which, in part, stems from altruism is Microsoft-
   bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]