> 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 ;-)
* Paul Foley <mycr...@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.
Martti Halminen <Martti.Halmi...@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 <p...@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]
> 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.
* Johan Kullstam <kulls...@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.
Erik Naggum <e...@naggum.no> writes: > * Johan Kullstam <kulls...@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 <kulls...@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 <kulls...@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.
Erik Naggum <e...@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.
Johan Kullstam <kulls...@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 <r...@grc.nasa.gov> Never get involved in a land war in Asia.
Erik Naggum <e...@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.
> 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, lijnz...@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
> Johan Kullstam <kulls...@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.
> 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 <r...@grc.nasa.gov> Wizard shot the food.
* 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)
Paul Foley <mycr...@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.
Paul Foley <mycr...@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.
Joe Marshall <jmarsh...@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.
Philip Lijnzaad <lijnz...@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.