Here's strand with adverb and globals
s=: 1 : 0
ss=: ,<m
sz=: 1 : ('if. a:-:m do.ss return.end.';'ss=: (<m),ss';'sz')
)
a:(4)(3)(2)(1) s
+-+-+-+-+
|4|3|2|1|
+-+-+-+-+
a:'one' 'two' 'three' s
+---+---+-----+
|one|two|three|
+---+---+-----+
> From: Dan Bron <[email protected]>
>
> bill lam wrote:
> > sequence of noun noun is already is a syntax error. Also how
> > does it be extended to 5, 6 or more arguments?
>
> You know, I never thought about it before, but it would be pretty easy to add
> strand notation (noun juxtaposition ) to J, provided
> we accept some enclosing syntax:
>
> strand =: 2 : ' if. _. = m do. n else. strand (n,~
> S =: strand ''
>
> _. 'this' 'is' 'strand' 'notation' 0 a: (a.{~97+i.10) S
> +----+--+------+--------+-+--+----------+
> |this|is|strand|notation|0|++|abcdefghij|
> | | | | | |||| |
> | | | | | |++| |
> +----+--+------+--------+-+--+----------+
>
>
> Of course we could change the enclosing markers -- S is just a name, and
> _.
> could be any noun, verb, or proverb. But we
> should pick one that is unlikely for someone to want to include in the result
> (or, in the case of a [pro]verb, one that someone is
> unlikely to want to apply to the result).
>
> It would also be easy to extend the utility to permit verbs and proverbs in
> the
> strand notation (which would be included in the
> result as their atomic representation).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm