If you are splitting y on x, shouldn't the answer of
'tr' split 'tratatrittetratas'
be
++---+----+----+
||ata|itte|atas|
++---+----+----+
rather than
+---+----+----+
|ata|itte|atas|
+---+----+----+
----- Original Message -----
From: Arved Sandstrom <[EMAIL PROTECTED]>
Date: Sunday, December 31, 2006 3:58 am
Subject: [Jprogramming] Boxing/unboxing
> Best of the New Year to all,
>
> I'm having some problems getting a handle on boxing and unboxing.
> I am still
> in the novice stages with J - I don't have much time to devote to the
> language, unfortunately, and sometimes go a few weeks at a time
> withoutlooking at it. The holidays gave me an opportunity to spend
> some hours to
> tackle J again.
>
> I usually take a set of basic problems to tackle when learning a new
> language, and one of them is splitting a string on another string, no
> regular expressions involved. Example:
>
> 'tr' split 'tratatrittetratas'
>
> should return
>
> 'ata' 'itte' 'atas'
>
> I have the J code to the point that for the above example I generate
>
> --------------------------------
> | 2 3 4 | 7 8 9 10 | 13 14 15 16 |
> --------------------------------
>
> and any of the three boxes, when unboxed and applied to the string
> with {,
> gives me the substring I need.
>
> What's causing me problems is fills. I have not happened on a
> combination of
> < and > that would allow me to return
>
> ---------------------------
> | a t a | i t t e | a t a s |
> ---------------------------
>
> Instead I might get
>
> atat
> itte
> atas
>
> which is frustrating. Any ideas?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm