> myedot =: dyad : '*/"1 x ="1 (#x) [\ y'
That's pretty good; it's the algorithm people
used before Boyer-Moore.
To get exactly the same result as E., modify
the defn to any of the following:
myedot =: dyad : '*/"1 x ="1 (#y) {. (#x) [\ y'
myedot =: dyad : 'x */ .=~ (#y) {. (#x) [\ y'
myedot =: dyad : 'x -:"1 (#y) {. (#x) [\ y'
myedot =: dyad : '(#y) {. (#x) x&-:\ y'
----- Original Message -----
From: Arved Sandstrom <[EMAIL PROTECTED]>
Date: Wednesday, January 3, 2007 6:44 pm
Subject: [Jprogramming] Splitting string on pattern [Reprise]
> I might add, I know why my J code was so verbose. I am not at the
> point yet
> where I even knew about E., for example, so I rewrote E.. :-)
>
> Actually, my E. ended up looking like
>
> myedot =: dyad : '*/"1 x ="1 (#x) [\ y'
>
> which for the first example given for E. in the Vocabulary,
> produces 1 0 1 0
> as opposed to E.'s 1 0 1 0 0. This for pattern 'co' and string
> 'cocoa'.
> Either would work - well, my "E." worked for me, but you just have
> to handle
> it differently subsequently.
>
> Am I the only person here who now views punctuation differently? :-
> ) Given
> that last, I'm even wondering how many emoticons
> (http://en.wikipedia.org/wiki/Emoticon) are actually legal J code...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm