Cute examples of under:
dfh=. 16&#. @ ('0123456789ABCDEF'&i.) NB. decimal from hex
hex=. &. dfh
'FEED' + hex 'B'
FEF8
http://www.jsoftware.com/papers/elegant.htm
((i.4 4)+])&.(a.&i.) 'A'
ABCD
EFGH
IJKL
MNOP
2006/12/31, June Kim <[EMAIL PROTECTED]>:
What you need is "under".
s=. 'tratatrittetratas'
i=.2 3 4;7 8 9 10;13 14 15 16
{&s each i
+---+----+----+
|ata|itte|atas|
+---+----+----+
each is pre-defined as &.>
2006/12/31, Arved Sandstrom <[EMAIL PROTECTED]>:
> 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 without
> looking 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?
>
> AHS
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm