Page 1 of 1

Namelists or Structured Arguments?

Posted: Mon Jun 13, 2011 10:42 am
by Dick Bowman
This is something that I seem to think could be useful from time to time, and I need reminding why it's a bad idea...

At present we can specify defined function right arguments and results as (flat) namelists. Hence

(a b c)←foo(x y z)

is a valid function header.

But there's a more flexible opportunity for individual statements...

a(b c)←1 (2 3)

Since namelist-as-right-argument saves us the tedium of unpicking a list of names, I'm wondering (because I just wanted to do it) whether we might also benefit by being able to put a nesting structure into defined function argument and result headers, as in

(a (b c))←foo(x (y z))

I'm sure we've been down this route before and I just need reminding why it's a really stupid idea. I can already see that it's "limited" - but I do think it might sometimes be useful.

Re: Namelists or Structured Arguments?

Posted: Mon Jun 13, 2011 11:14 am
by JohnS|Dyalog
Hi Dick,
I don't think this is a bad idea; in fact APL# is heading in this direction.
I have logged your suggestion as RFE[7368].

Here's a rather outrageous example of a 0-line tradfn to rotate a binary tree:

      ∇ (a(b c))←rrot((a b)c) ∇     ⍝ right-rotation of binary tree

(0 1)(2(3 4)) ≡ rrot ((0 1)2)(3 4)
1

John.