David-
Now I know that I have to use double single quotes to define a blank in a
defined verb, but I can use single quotes in a implicit verb. I need to
remember that. Or I can just define blank as a named noun:

* bk=.' '*

* dab1 =. 3 :'y#~each-.each bk = each y'*

* dab1 a*

*┌──────────────┬──────┬───────────────┬────────────────────┐*

*│Thetimehascome│forall│goodmentocometo│theaidoftheircountry│*

*└──────────────┴──────┴───────────────┴────────────────────┘*

Pascal -
*    dab =: -.&' '*

* dab each a*

*┌────────────┬──────┬───────────────┬────────────────────┐*

*│Nowisthetime│forall│goodmentocometo│theaidoftheircountry│*

*└────────────┴──────┴───────────────┴────────────────────┘*
That is really cool! much simpler!

Don -
For my problem, I have to keep the string partitions in place. However, you
show that semicolon (Raze) removes boxes. Also semicolon, colon, semicolon
(;:;) partitions literals into boxes at spaces . Both are tricks that I
need to remember!

* a *

*┌─────────────────┬────────┬─────────────────────┬────────────────────────┐*

*│The time has come│ for all│ good men to come to │the aid of their
country│*

*└─────────────────┴────────┴─────────────────────┴────────────────────────┘*

* ;a*

*The time has come for all good men to come to the aid of their country*

* ;:;a*

*┌───┬────┬───┬────┬───┬───┬────┬───┬──┬────┬──┬───┬───┬──┬─────┬───────┐*

*│The│time│has│come│for│all│good│men│to│come│to│the│aid│of│their│country│*

*└───┴────┴───┴────┴───┴───┴────┴───┴──┴────┴──┴───┴───┴──┴─────┴───────┘*

* ;;:;a*

*Thetimehascomeforallgoodmentocometotheaidoftheircountry*

Cool!

Skip Cave
Cave Consulting LLC


On Sat, May 25, 2019 at 4:52 AM Skip Cave <s...@caveconsulting.com> wrote:

> Given a set of boxed literal strings:
>
> *]a=.'Now is the time';' for all';' good men to come to ';'the aid of
> their country'*
>
> *┌───────────────┬────────┬─────────────────────┬────────────────────────┐*
>
> *│Now is the time│ for all│ good men to come to │the aid of their country│*
>
> *└───────────────┴────────┴─────────────────────┴────────────────────────┘*
>
>
> I can remove all the blanks:
>
>
>
> *a#~ each -. each ' '= each a*
>
> *┌────────────┬──────┬───────────────┬────────────────────┐*
>
> *│Nowisthetime│forall│goodmentocometo│theaidoftheircountry│*
>
> *└────────────┴──────┴───────────────┴────────────────────┘*
>
>
> So I try to write a 'delete all blanks' (dab) verb:
>
> *dab =. 3 :'y#~ each -. each ' '= each y'*
>
> *|noun result was required*
>
> *| y#~each-.each*
>
> What is going wrong?
>
>
> Skip Cave
> Cave Consulting LLC
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to