Brian Schott had a problem reproducing my "strand" results, because we can't
rely on _.=_. to be true. Choosing the unreliable
_. as a marker was silly of me (though one reason I chose it is because it's
"useless", and so unlikely for someone to want to
include it in the strand).
So, instead, I've given the user the ability to select his own "end of strand"
marker. Or, rather "beginning of strand" marker:
| 'this is' 4 'words' 'of strand notation' s|
+-------+-+-----+------------------+
|this is|4|words|of strand notation|
+-------+-+-----+------------------+
I futhermore support a "fancy" version of strand, where the markers are
symmetric, e.g.:
[ 'this is' 6 'words' 'of strand notation, which is ' > 4 fs]
+-------+-+-----+-----------------------------+-+-+
|this is|6|words|of strand notation, which is |>|4|
+-------+-+-----+-----------------------------+-+-+
And, for those who don't want to bother, I've included a convenience utlity t
, where the marker is set to __ (which should be
dependable):
__ hello there t
+-----+-----+
|hello|there|
+-----+-----+
See http://www.jsoftware.com/svn/DanBron/trunk/environment/strand.ijs for
full details (examples at the end of the script).
Bill Lam wrote:
> At any rate Dan's method still use box array and from the POV of
> the verb, there is at most 2 arguments.
This would be easy to change -- for explicit verbs, we could have utilities
that assigned, e.g. y0 y1 y2 etc. For tacit
verbs, we could assign y0 =: 0 {:: ] , y1 =: 1 {:: [ etc, as Raul pointed
out. See, for example,
http://www.jsoftware.com/svn/DanBron/trunk/environment/parameterized_verbs.ijs
.
Though this is not what Neville is asking for (though I sympathize with him; I
also would like an easy way to write tacit
operators, though I'm not convinced that's possible without serious backward
incompatibility). I think the question of "more than
2 arguments" is a red herring [1].
> If one can be happy with
> verb _. noun noun S
> why he can't stand
> verb noun ; noun
Ask the implementors of (strand notation in) APL. I know I've wanted this
syntax before (though mostly for pronouns, rather than
anonymous nouns). And I'm not alone -- there have been numerous requests for,
e.g., i j { y . I can pull examples from the
Forum archives, if you like.
And, even though it often takes the same amount of characters, noun noun
"feels" less cumbersome than noun ; noun . Finally,
it is often true that we could save characters with noun juxtaposition, and the
improvement would increase with the length of the
train. Compare:
(...)(...)(...)(...)(...)
to
(...);(...);(...);(...);(...)
where ... is an arbitrary noun phrase.
Having said all that, I admit that it's been a long time since I've wanted this
feature, and I can no longer remember my
motivations. On the other hand, it's been a long time since I've "really
worked" with J, or even "really played" with J.
Try searching the Forum archives for one of (. ). (: ): "noun
juxtaposition" "strand notation" etc.
-Dan
[1] We write J linearly (one-dimensionally, as opposed to 2D in math, eg).
So, in a [perhaps weak] sense, we are forever limited
to 2 arguments, even if those arguments come in (named) pieces.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm