[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: anonymous lists



> Sorry -- I slipped back into rc notation which obviously caused some
> confusion.

understandable; they're so close that confusion is too easy.

> (a) I don't want heirarchical lists.  (Well, I do but that wasn't what
> I was suggesting.)

i don't.  not in a shell that has to interact with unix execs and
the flat argvs.

> (b) Why are the following different?  Why is a list treated one way on
> the RHS of assignment, but instantly flattened in any other context?
> 	; bar = (a b c d); foo bar
> 	; foo (a b c d)

i assume you mean ``foo $bar''.  lists are not treated differently in
assigments:  they are always flattened.

> (c) Consequently, I want the following to behave differently:
> 	; foo a b c d			# pass 4 args: a, b, c, and d
> 	; foo (a b c d)			# pass 1 arg: the list (a b c d)

that's heirarchical lists.  tell me what this means if foo is an external
program rather than an es function.

> I only want lists to be flattened if I EXPLICITY ask for it with $.  I
> think this is both more useful and more consistent.

right now, $ means variable dereference and nothing else.  i think you're
confused about es notation.

> (d) I'm not sure if I want:
> 	; foo $(a b c d)
> to be the same as:
> 	; foo 'a' 'b' 'c' 'd'
> or:
> 	; foo 'a b c d'

how about
	; echo $(a b c d)
	multi-word variable name
	; 
which are the current semantics?

> Perhaps we could introduce another flattening operator, so that $(a b
> c d) returns 'a' 'b' 'c' 'd', and %(a b c d) returns 'a b c d'.
> Notice the change in terminology: $ is now a flattening operator
> rather than an evaluation operator, as it is the only way to flatten a
> list (other than picking the elements out one by one).

if a language has hierarchical lists, it needs a flattening operator
or function.  since es doesn't, it doesn't.

> (e) More radically, I would like to see `{...} return a list, for
> example:
> 	`{ echo a; echo b ; echo c ; echo d }
> returns (a b c d), and needs to be explicitly flattened:

it already does; nothing radical about that.
	; x = `{ echo a; echo b ; echo c ; echo d }
	; echo $#x
	4
	; echo $x
	a b c d
	; 

> In summary, I'm suggesting making the primary data-type of es the list
> rather than the string.  No list should be flattened unless EXPLICITY
> preceded by $ (or %).

it is already the list, but the elements of the list can only be strings
and code fragments (or their first cousin, lambdas).

> Am I making myself any clearer, or is this still not making any sense?

actually, not much.  i think you're confused by what the es documentation
(such as it is) means by flat lists:  lists that have multiple elements,
not strings.  a list can be further flattened into a string, but that's
a whole 'nother story.

i'm sure that this didn't resolve your question, but maybe we're close to
similar terminology now.

paul