Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Chain {*}

5 views
Skip to first unread message

Harald Oehlmann

unread,
Aug 20, 2010, 5:04:47 AM8/20/10
to
(How) is it possible to apply the thedelist operator {*} twice (say
dematrix operator) ?
% set m {{1 2}}
% format "%d %d" {*}{*}$m
extra characters after close-brace

APN

unread,
Aug 20, 2010, 5:51:03 AM8/20/10
to

Maybe

format "%d %d" {*}[concat {*}$m]

{*}[join $m] might do as well but that's documented to actually return
a space separated string which will be implicitly converted back to
list. Not sure if that's will give the exact same results in all cases.

Harald Oehlmann

unread,
Aug 20, 2010, 9:52:24 AM8/20/10
to

On 20 Aug., 11:51, APN <palm...@yahoo.com> wrote:
> On Aug 20, 2:04 pm, Harald Oehlmann <wortka...@yahoo.de> wrote:
> > (How) is it possible to apply the thedelist operator {*} twice (say
> > dematrix operator) ?
> format "%d %d" {*}[concat {*}$m]

Hi APN,
thak you for the reply !

Concat is a good idea and will work.
---
I often find myself to write somthing like:
% format "%d %d" {*}[lindex $m 0]
(with [llrngth $m] ==1) and I would find it more elegant to write a
double delist operator.

Alexandre Ferrieux

unread,
Aug 20, 2010, 11:07:20 AM8/20/10
to

A "double-delist" (like the {*}[concat {*}] suggested by Ashok) will
also flatten something like {{1 2} {3 4}}, so it's a bit of
overgeneralization.
IMO, {*}[lindex] is a more pertinent method here.

-Alex

Harald Oehlmann

unread,
Aug 23, 2010, 2:21:00 AM8/23/10
to
Thank you for your answers. Was nice discussing it,
Harald
0 new messages