[PD] (breaking symbols) was Re: find a list of numbers in a text file
Mathieu Bouchard
matju at artengine.ca
Sun Sep 4 23:59:05 CEST 2011
On Sun, 4 Sep 2011, Jonathan Wilkes wrote:
>> From: Mathieu Bouchard <matju at artengine.ca>
>> I don't recall ever seeing any language or library swap the meaning of min
>> and max. It seems to be very standard.
> Why would any of them swap it?
Well, I figured that given that it's a very common confusion for people
learning pd, it would not be surprising if there were programming
languages (or libraries) that named them the other way around... yet I
haven't ever found any.
> Pd's syntax stands out against all those examples because it is the only
> one that explicitly shows only a single argument after the function
> name. So while I could write the Pd syntax as "max y", it really means
> something more like max(x, y) where x is visually represented by a small
> black rectangle to the top left of the word "max".
There are other examples where there aren't two args after the function
name (apart those that allow variable number of args). But I haven't
listed any.
Smalltalk has infix min and max written like :
x := 10 max: 20.
where "max:" is the selector, and 10 is the receiver.
Forth (and related) takes its arguments before the name of the function.
Currying means that you can pass to a function only part of the args, and
in that case you get another function that takes the rest of the args, and
you can pass that function around or store it. It's available in several
language families. this can mean that you can do stuff like :
foo = max(10)
print foo(20)
as an alternate form of
print max(10,20)
which means you can also do it like
print max(10)(20)
but the useful uses of this feature involve storing foo or passing it
around.
_______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
More information about the Pd-list
mailing list