Re: Another quick sequence feature request!

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

Kat wrote:
> 
> On 23 Sep 2004, at 19:42, William Heimbigner wrote:
> 
> > 
> > Hey Rob, could you implement the following:
> > 
> > x[*][1]
> > 
> > would be:
> > 
> > {x[1][1],x[2][1],x[3][1], etc etc etc}
> > 
> > I don't know what that would do to the e2c translator abilities, but it
> > would be nice if its possible...
> 
> William, it will be a cold day somewhere before RDS makes that happen. 
> But you can do it with Jiri's associated lists easily enough. To do it with
> the
> native Eu vars, you would need access to the var list, and Rob said that 
> won't happen, sorry.

Isn't this the old vertical slice request yet again? That is, the ability
to specify all the elements in a column of a 2-d table. You do not need
access to Euphoria's internals for that nor does one need associated lists.

  function getColumn(sequence x, integer colnum, object defval)
   sequence column
   -- One entry for each row.
   column = repeat(0, length(x))
   -- Grab each value in the specified column
   for i = 1 to length(x) do
    if atom(x[i]) or length(x[i]) < colnum then
     column[i] = defval
    else
     column[i] = x[i][colnum]
    end if
   end for
   return column
  end function

 puts(1, getColumn( {"def", " ab", "rst", "xyz", "!"}, 2, '?'))

should show "easy?" -- {'e','a','s','y','?'}


However, I agree that RDS won't we making this addition.

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu