On Thu, May 1, 2014 at 12:49 PM, Raul Miller <[email protected]> wrote:
>
>
> I would like to take this opportunity to provide a friendly reminder
> that in Chrome you should always use "paste as plain text" to paste
> from a J session into the browser. (This is Ctrl+Shift+V on windows
> and probably Cmd+Shift+V on mac and perhaps also in Safari.)


Thanks for the reminder. I'll repost the function below. I'll also
suggest posting in Plain Text Mode -- I realized that it had gotten
turned off. With plain text mode on, Chrome will give you a visual cue
that it's adding extra line feeds.

template_log_ =: 0 : 0
Log=:Log,<('F MONAD (y=',(":y),')')
Last=: {: Log
5!:5 <'Last'
:
Log=:Log,<('F DYAD (y=',(":y),' x=',(":x),')')
Last=: {: Log
5!:5 <'Last'
)


NB. replaces value in template
lr_log_=:template_log_ rplc 'F';]

NB. adverb to return logging verb
lf=: 1 : '3 : (lr_log_ u)'


>
> Often it's just easier to focus on practical uses rather than the
> details of just how simple this actually is.

I think beginners may be more interested in the execution instead of
the parsing.

Compare the following:

trace '+/ i.5'
 --------------- 3 Adverb -----
 +
 /
 +/
 --------------- 1 Monad ------
 i.
 5
 0 1 2 3 4
 --------------- 0 Monad ------
 +/
 0 1 2 3 4
 10
 ==============================
10

To:

> Log [ ( '+'lf/ i.5 )[ (Log=:'')
+ DYAD (y=4 x=3)
+ DYAD (y=<'+ DYAD (y=4 x=3)' x=2)
+ DYAD (y=<'+ DYAD (y=<''+ DYAD (y=4 x=3)'' x=2)' x=1)
+ DYAD (y=<'+ DYAD (y=<''+ DYAD (y=<''''+ DYAD (y=4 x=3)'''' x=2)'' x=1)' x=0)

For someone who is wondering what insert does, I think this more
clearly illustrates it. I realize there's opportunity to clean up the
output in my version.

Thanks for the feedback
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to