Re: Ideas for next Eu

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, 10 Nov 1999, Lewis Townsend wrote:

> Yes, that is a good ideah too. In fact I hope that this syntax
> is implemented before subscripting functions. However I don't
> think this is a complete workaround for subsciption. The point
> of which is to throw out anything that you don't need. While I'm
> on the subject here's some more subscription ideas I would like:
>
> object x
> x = {{1,2},{3,4},{5,6}}
> ? x [1..3][2] -- HERE'S THE TRICK
> -- output: {2,4,6}

This (I call it "vertical" slicing) would be very handy in any number of
places, especially when dealing with business programs. Anything from
extracting a sequence of names from a name, address, phone # list,
searching columns for certain values, or doing math on whole columns of figures
(!) would be simplified.

> object x
> x = {9,8,7,6}
> ? x [1,3]
> -- output: {9,7}

Very handy, especially  if find() or match() would return a sequence of matching
items from a list:
{1,3,12,55} , say, would mean the matching data was found in
record 1,3,12 and 55.  Which you could then proceed to extract into a new
sequence : matchingitems = masterlist[{1,3,12,55}]
In conjunction with "vertical" sliceing, this could be extremely powerful.
matchingnames = masterlist[{1,3,12,55}][NAME]

> Of course I would like these to work in combination and on
> functions as well. I know it's asking a lot but it makes
> sense to me.

A lot of sense. Most of this seems do-able. I'm not sure how difficult it would
be to subscript functions, or what side effects it would cause, but there are a
lot of places it would be very useful.

>There seem to be mixed feelings about indexing a function...
> Yes
> >(which I feel is a bit hard to follow as far as readability,
> No (IMO)

Agreed. For example, I think that date[YEAR] or perhaps date([YEAR])  or
maybe date.year is more useful and readable than the alternative:
create a sequence
 sequence x
assign
    x = date()
extract
    ? = x[YEAR]

especially if, somehow, date() _knows_ the names of its members, so you don't
have to declare them as constants, which will sooner or later collide with
another of your or someone else's  "YEAR", "MONTH", or "DAY".

Regards,
Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu