How about this (or do you really need the binary list?
boxedtoken1=: (<;. 2)@lr
,.(boxedtoken1,<@lr) 'fetch'
+-----------------------------+
|>@({&>/)@(<"0@|....@[ , <@])"1 _|
+-----------------------------+
|>@({&>/)@(<"0@|....@[ , <@])"1 _|
+-----------------------------+
=@@i
Brian Schott schreef:
> I have the following verb defintions, which produce
> two slightly different results: there are extra spaces in
> the `;@boxedtoken` result, which I want to re-introduce into
> a later spinoff of a result that resembles the `lr` result
> when both are applied to the same argument..
>
> lr =: 5!:5&<
> boxedtoken =: ;:@lr
>
> For example, consider the verb fetch defined as
> follows in the dictionary d621.htm .
>
> fetch=: >@({&>/)@(<"0@|....@[ , <@]) " 1 _
>
> I hope you can see the extra spaces by looking at
> the following results.
>
> ,.(;@boxedtoken ;lr) 'fetch'
> +-----------------------------+
> |>@({&>/)@(<"0@|....@[,<@])"1 _ |
> +-----------------------------+
> |>@({&>/)@(<"0@|....@[ , <@])"1 _|
> +-----------------------------+
>
> ,.(;@boxedtoken ;&(' '&=)lr) 'fetch'
> +---------------------------------------------------------+
> |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 |
> +---------------------------------------------------------+
> |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0|
> +---------------------------------------------------------+
>
> How can I generate a binary list that can be applied
> to the result of `;@boxedtoken 'fetch'` to expand it by
> inserting the two missing spaces so that it matches the
> result of `lr 'fetch'`?
>
> To simplify: For example if the two results were
> "abc" and "a bc" then the mask would be "1j1 1 1" because as
> shown in the following, the expanded result is produced.
>
> 1j1 1 1#'abc'
> a bc
>
> The correct expansion list for my example is the
> following, but I am looking for a code snippet which uses
> the results of `;@boxedtoken 'fetch'` and `lr 'fetch'` to
> produce the resulting list.
>
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1j1 1j1 1 1 1 1 1 1 1 1
>
> Thanks,
>
> --
>
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm