just to revive this discussion: i have submitted a patch to the tracker, which enables the expansion of $# (argc) and $@ (argv).
[$#( could be considered as an implementation of [list length] (and vice versa)
$@ is more useful, as it allows you to pass variable argument lists to nested abstractions. all other implementations i could think of have the problem that they only work with 1st level abstractions, like iemlib's [dollarg].
the only important thing left i am aware of, if the possibility to get the selector in messages / the object-name in objects.
mfg.asdr IOhannes
IOhannes m zmoelnig wrote:
just to revive this discussion: i have submitted a patch to the tracker, which enables the expansion of $# (argc) and $@ (argv).
[$#( could be considered as an implementation of [list length] (and vice versa)
which basically means, that [$#( is redundant, as soon as there is a [list lenght]. the latter would be more robust regarding incoming messages. i just did it for completeness.
$@ is more useful, as it allows you to pass variable argument lists to nested abstractions. all other implementations i could think of have the problem that they only work with 1st level abstractions, like iemlib's [dollarg].
which makes me think, that $@ is really a MUST.
mfg.asdf IOhannes
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
IOhannes m zmoelnig wrote:
just to revive this discussion: i have submitted a patch to the tracker, which enables the expansion of $# (argc) and $@ (argv).
which makes me think, that $@ is really a MUST.
I'm still undecided if "$@" or "$*" would be the preferred name, though. Both mean similar things in bash, but maybe $* would be easier to understand for the common Pd user, as the asterisk is in use not only in bash, but as a wildcard character in general.
OTOH $@ would have the mnemonics of meaning "dollar-@ll". But I think I would still prefer $* though.
Ciao
On Tue, 22 Aug 2006, Frank Barknecht wrote:
I'm still undecided if "$@" or "$*" would be the preferred name, though. Both mean similar things in bash, but maybe $* would be easier to understand for the common Pd user, as the asterisk is in use not only in bash, but as a wildcard character in general.
If you are not against introducing nested lists later on, and prefer staying close to bash than not, then $@ should be the one that expands the complete arglist inserted as separate arguments. The $* should be reserved for expands the arglist as one argument of type A_LIST (nested list).
(Btw, do OSX users generally know what's a * wildcard?)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Tue, 22 Aug 2006, IOhannes m zmoelnig wrote:
which basically means, that [$#( is redundant, as soon as there is a [list lenght]. the latter would be more robust regarding incoming messages. i just did it for completeness.
What does "completeness" mean here, considering that if [$#( is redundant, then the feature that it represents is already "complete" under another form?
which makes me think, that $@ is really a MUST.
What about a variation on $@ that passes all the arguments starting with one of your choice? I would like to be able a non-dynamic abstraction that can take some fixed number of arguments and then take the rest of its arguments as the contents of an objectbox. e.g. if I write:
[about 42 blah blah blah]
it could be equivalent to:
[- 42] | [blah blah blah] <- variable number of arguments taken starting with $2 | [+ 42]
does that sound useful?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
Mathieu Bouchard wrote:
On Tue, 22 Aug 2006, IOhannes m zmoelnig wrote:
which basically means, that [$#( is redundant, as soon as there is a [list lenght]. the latter would be more robust regarding incoming messages. i just did it for completeness.
What does "completeness" mean here, considering that if [$#( is redundant, then the feature that it represents is already "complete" under another form?
"completeness" in my sense is not to be understood in gödel's sense. it is rather an emotion.
as for redundance: i see that [list length] is not yet in pd-0.40.0test3, so there is no "native" (as "built into pd") redundance present. however, the behaviour of $# expansion can be implemented by simple [object]s, as soon as there is a $@ (or whatever it is called)
which makes me think, that $@ is really a MUST.
What about a variation on $@ that passes all the arguments starting with one of your choice? I would like to be able a non-dynamic abstraction that can take some fixed number of arguments and then take the rest of its arguments as the contents of an objectbox. e.g. if I write:
[about 42 blah blah blah]
it could be equivalent to:
[- 42] | [blah blah blah] <- variable number of arguments taken starting with $2 | [+ 42]
does that sound useful?
well kind of. however to a limited extent, you could mimick this behaviour with
[loadbang] | [list append $@] | | [- $1] [list split 2] | | [$2 ] | [+ $1] |
(obviously this does not work for several stacked abstractions with similar behaviour)
but then i was always for a really havy beast like ${} which would allow to stack $-expansions and/or do operations on the arguments before they get expanded. (e.g. [f ${${1}/2}] or something...)
i have been convinced that this is bloated at the least.
mfg.adsr. IOhannes