That helps a lot.

This showed me that x2jElm is a conjunction.

   x2jElm
2 : 0
  x2jElmLoc=: x2jElmLoc,<,m
  x2jElmDef=: x2jElmDef`(v f.)
)

And this showed me that the next result is a new verb's atom representation.
I am still way thinking about how the line ` '/' x2jElm (3 : 0)` which has
no `=:` at the end, can produce a useful result. In a similar manner the
code I could not make work had no `:=` at the end of the first line, but
produced a useful result. I am struggling to understand that concept. That
is still mind blowing for me. I mean, I see the `=:` inside the conjunction
x2jElm, and I suppose that is where the assignment is being done, but that
is some fancy code.

Thanks for your clarifications.

   '/' x2jElm (3 : 0)
Result
:
Result=: ''
)
+---------------------------+
|+-+-----------------------+|
||:|+-----+---------------+||
|| ||+-+-+|+-+-----------+|||
|| |||0|3|||0|Result     ||||
|| ||+-+-+|| |:          ||||
|| ||     || |Result=: ''||||
|| ||     |+-+-----------+|||
|| |+-----+---------------+||
|+-+-----------------------+|
+---------------------------+



On Wed, Feb 12, 2014 at 4:29 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> Ok, let's recap.
>
> Here's the code you quoted:
>
>    x2jDefn_nifxml_
> 1 : 0
>   for_i. <;._2 (0 : 0) do.
>     'nm df'=. ':=' splitstring >{.'NB.' splitstring >i
>     'mn dy'=. dltb each 2 {. ' : ' splitstring df
>     nm=. dltb nm
>         if. 0=#dy do. nm x2jChar (3 : mn)
>     elseif. 0=#mn do. nm x2jElm  (4 : dy)
>     elseif.       do. nm x2jElm  (3 : (mn;':';dy)) end.
>   end.
>   i.0 0
> )
>
>    'Items'x2jDefn_nifxml_
> /        := Result : Result=: ''
> compound := cEnd y : x cStart y
> add      := aEnd y : x aStart y
> add      := aChr y
> )
>
> The consequence of executing this code is something like this:
>
> '/' x2jElm (3 : 0)
>   Result
> :
>   Result=: ''
> )
>
> 'compound' x2jElm (3 :0)
>   cEnd y
> :
>   x cStart y
> )
>
> 'add' x2jElm (3 :0)
>   aEnd y
> :
>   x aStart y
> )
>
> 'add' x2jChar (3 :0)
>   aChr y
> )
>
> Put differently, the x2jElm code runs for the specified elements. The
> monadic definition runs for the close of the element and the dyadic
> definition runs for the opening element. The '/' gives basically the same
> effect as a startDocument/endDocument pair.
>
> Meanwhile, the x2jChar code gets the characters inside the element (inside
> the <add> element, in this case).
>
> Does that help? Or am I missing your question?
>
> Thanks,
>
> --
> Raul
>
> --
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to