Just a quick note:

Newcomers to J tend to not be familiar with J's word formation rules.

You can see them using ;:'J sentence' but sometimes the bulk of that
result can be distracting.

An easy variation on this theme is to format the boxed sentence and
then take row #1 (which is where all the interesting stuff is).

   1{":;:'J sentence'
│J│sentence│
   1{":;:'0 0 ssmb S:0 b'
│0 0│ssmb│S:│0│b│
   1{":;:'/:~'
│/:│~│
   1{":;:'+/%#'
│+│/│%│#│

The vertical bars are still a bit noisy, but you could go:
   9!:7]11#' '

to make them be spaces. For example:

   1{":;:'/:~'
 /: ~

And then either 9!:7]16+i.11 or 9!:7'+++++++++|-' to put things back.

I would be tempted to put that into a cover function which is
sensitive to the starting state, but error handling and the global
character of 9!:7 makes that just a little messy. Still... messy has
never daunted me for too long, so:

jwords=:3 :0
  boxy=. (16+i.11)-:9!:6''
  9!:7]11#' '
  r=. deb 1{":;:y
  (16+i.11)9!:7@([^:boxy)'+++++++++|-'
  r
)

    jwords 4{::LF cut 5!:5<'jwords'
( 16 + i. 11 ) 9 !: 7 @ ( [ ^: boxy ) '+++++++++|-'

(boxy is a boolean rather than a literal result of 9!:6 because in
error cases (bad y, mostly) you wind up with 11 spaces for 9!:6'',
which can be confusing if you are looking for a boxed display. So this
way, you could just run jwords again to recover from that state.)

Still... this is way more complicated than something I would want to
throw at a beginner (who would probably not know to reach for
something named 'jwords' even if it were a builtin). So I would stick
with ;:'J sentence' and maybe give them the 1{": as an alternative if
they came back to me with complaints about the bulkiness of that
result...

...

Ok, this was *supposed* to be a quick note. Looks like I failed at that aspect.

Oftentimes things that seem simple when I think about them turn out to
be way more complicated when I try to express them.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to