If I type something like this in a messagebox:
list +1 +1 +1 -1 -1 -1 -1 +1
then should the +1 be floats or symbols?
(currently, they're symbols)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
Dunno which is should be, but the 'c' language doesn't allow unary '+' in front of numerical literals... so I followed that lead.
cheers Miller
On Wed, Dec 27, 2006 at 09:05:09PM -0500, Mathieu Bouchard wrote:
If I type something like this in a messagebox:
list +1 +1 +1 -1 -1 -1 -1 +1
then should the +1 be floats or symbols?
(currently, they're symbols)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - t?l:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montr?al QC Canada
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Wed, 27 Dec 2006, Miller Puckette wrote:
Dunno which is should be, but the 'c' language doesn't allow unary '+' in front of numerical literals... so I followed that lead.
I don't know which C language you are talking about. Try compiling the following program with options -ansi -pedantic-errors:
#if + +1 int main (void) { int foo[+ +1] = { + + + + + + + + + + +1 }; return foo[0]; } #endif
This demonstrates that unary + works in front of numerical literal, both in the main language and in the preprocessor. I don't know of a way to test whether the last + before the 1 is actually considered part of the literal or not. However, both scanf() and strtod() consider + as part of a float literal (was there ever a time that they didn't? really?).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Dec 28, 2006, at 12:03 AM, Mathieu Bouchard wrote:
On Wed, 27 Dec 2006, Miller Puckette wrote:
Dunno which is should be, but the 'c' language doesn't allow unary '+' in front of numerical literals... so I followed that lead.
I don't know which C language you are talking about. Try compiling
the following program with options -ansi -pedantic-errors:#if + +1 int main (void) { int foo[+ +1] = { + + + + + + + + + + +1 }; return foo[0]; } #endif
This demonstrates that unary + works in front of numerical literal,
both in the main language and in the preprocessor. I don't know of
a way to test whether the last + before the 1 is actually
considered part of the literal or not. However, both scanf() and
strtod() consider + as part of a float literal (was there ever a
time that they didn't? really?).
What would be the advantages/disadvantages of either way? My
intuition says that +1 should be a symbol, perhaps because it is
rare to write positive numbers in math with a leading +.
Maybe the errant newbie might be confused when +1 turns out to be a
symbol. But if Pd starts removed + signs upon save, then that could
also be annoying.
.hc
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC
Canada_______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
As we enjoy great advantages from inventions of others, we should be
glad of an opportunity to serve others by any invention of ours; and
this we should do freely and generously. - Benjamin Franklin
This demonstrates that unary + works in front of numerical literal,
both in the main language and in the preprocessor. I don't know of
a way to test whether the last + before the 1 is actually
considered part of the literal or not. However, both scanf() and
strtod() consider + as part of a float literal (was there ever a
time that they didn't? really?).What would be the advantages/disadvantages of either way? My
intuition says that +1 should be a symbol, perhaps because it is
rare to write positive numbers in math with a leading +.
well, pd is not the only program, that has to handle string to float conversions ... most parsers i know, would allow a leading '+' char for parsing floats ...
Maybe the errant newbie might be confused when +1 turns out to be a
symbol. But if Pd starts removed + signs upon save, then that could
also be annoying.
maybe the newbie is confused by +1 being a symbol? or, if he's not confused by +1 being a symbol, then probably by 1e+2, being a float ..
t
-- tim@klingt.org ICQ: 96771783 http://www.mokabar.tk
There's no such entity as "most people". These are generalities. All generalities are meaningless. You've got to pin it down to a specific person doing a specific thing at a specific time and space. William S. Burroughs
On Thu, 28 Dec 2006, Hans-Christoph Steiner wrote:
My intuition says that +1 should be a symbol,
Intuition is something that is trained. If you trained that part of your intuition using pd and not much else, you may get to see "+1 is a symbol" as something normal, obvious, and the way it should be. People with different experience may get to think otherwise. The leading + is recognised in float literals in almost all programming languages; actually, only pd works like that, if I think only of contemporary languages that were designed for doing real work.
But if Pd starts removed + signs upon save, then that could also be annoying.
Pd already removes a lot of things. e.g. 1000001 becomes 1e+6, and so does 1000002, ...
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada