7.7: adda/syntax/atoms equivalent to tuple singletons:
. does a function's arg need a parenthetical?
ie, can we say( f x ), instead of( f(x) )?
if (f x) can be the same as f(x),
then all atoms (such as x)
can be seen as singleton tuples (ie, x=(x) );
so, then there's no need for adda to copy
Python's singleton tuple syntax: ( (x,) ).
[8.8:
. I think Python's view is that
a tuple is a distinct datatype
that must have a distinct literal;
and, while Python could have assumed that
all atomics were singleton tuples,
that would have been rather wasteful;
because, in an oop system like Python,
where everything is type-tagged,
a singleton tuple would take up more space
than the atom it contains .
. adda's view is that explicit syntax
is not as helpful as simpler, cleaner, freer;
and since all objects have a declared datatype;
we'll know if something needs a tuple,
and can tuple-ize an atom as needed .
8.9:
. Python also has a situation like math
where ( f NotAParenthetical ) is reserved
as a pointer to function
and only ( f(x) ) is applying f to x .
. in Python you don't have to
declare f to be a function;
(eg, you can say:
if truth: f = lambda(...) else: f = 0
-- here f wasn't declared to be anything;
rather its type depends on
what value it's assigned);
so, it's important in Python
that the function application syntax be
unambiguous and very easy to spot .
. in adda, by contrast,
we can assume that functions are declared
(they are statically always functions);
so, if we expect f to be followed by
the arg it's being applied to,
and if we want to pass f without applying it,
we follow it with a syntactic terminal;
eg,( (f) ), or (f, ...) or (... f; ...) .]
mis:
. we can assume that binary operators (biops)
are declared to be biops before use;
. so, if x is not a biop,
then the expression ( x y )
has to mean either x*y or x(y)
or the syntax is invalid;
( x*y = x y ) can be true only if
x or y are numbers and not functions,
or x is a number while y is a dimension;
if none of that is true,
we can assume (x y) to mean x(y) .
--[8.8:
. in that paragraph,
I'm playing with the idea that
non-biop functions need not be declared;
but that would imply the confusing use of
completely optional parameters .
8.9:
. furthermore, that paragraph was
glossing over the complication that
all biops can be used in prefix mode:
f +(a,b,c) = f (a + b + c);
so, knowing what's a biop in a given context,
requires some look-ahead .]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment