"0"0_ should of course have been "0"_

On Mon, Sep 10, 2012 at 11:15 PM, Ian Clark <earthspo...@gmail.com> wrote:
> Have you tried it with "0"0_ and "0 in place of "_1 ?
>
>    t=: ;: 'alpha bravo charlie delta echo'      NB. a bit longer, for a 
> better test
>
>    ' ' (13 :' }.;;"_1 y') t
> alpha bravo charlie delta echo
>    ' ' (13 :' }.;;"0"_ y') t            NB. "_1 <==> "0"_ here
> alpha bravo charlie delta echo
>    ' ' (13 :' }.;;"0 y') t                      NB. Does it need "_ ? --no.
> alpha bravo charlie delta echo
>
> From the J Dictionary: http://www.jsoftware.com/help/dictionary/d600n.htm
>
>  A negative rank is complementary: m"(-r) y is equivalent to
> m"(0>.(#$y)-r)"_ y .
>
> ...For 1=(#$y), this means: "_1 <==> "0"_
>
> BTW: that last example: (13 :' }.;;"0 y')
> ...becomes km's offering: [: }. [: ; ;"0
>
>
> On Mon, Sep 10, 2012 at 10:29 PM, Linda Alvord <lindaalv...@verizon.net> 
> wrote:
>> Here's a little comic relief!
>>
>>     ;"_1 t
>> alph
>> bravo
>> chuck
>>    f=: 13 :';"_1 y'
>>    f
>> ;"_1
>>    f t
>> alph
>> bravo
>> chuck
>>
>>
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com 
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
>> Sent: Monday, September 10, 2012 4:56 PM
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramming] Flattening a list containing boxed elements
>>
>> This in pretty, too.  J figures out all the little extras for you!
>>
>>    h=: 13 :' }.;;"_1 y'
>>    LF h t
>> alph
>> bravo
>> chuck
>>    h
>> [: }. [: ; ;"_1
>>
>>
>>
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com 
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Peter B. 
>> Kessler
>> Sent: Monday, September 10, 2012 3:21 PM
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramming] Flattening a list containing boxed elements
>>
>> I'm still at the stage where I have to read the dictionary entry for most of 
>> the verbs, so I'm not even in the slow lane yet.  Looking at Stitch (dyadic 
>> ,.)[1] I was reminded of the explanation of u"_1, which suggested using Link 
>> (dyadic ;)[2]
>>
>>            g =:  }. @ (; @ (;"_1))
>>            ' ' g t
>>         alpha bravo chuck
>>            LF g t
>>         alpha
>>         bravo
>>         chuck
>>
>> if you like "pipelining" your verbs.  (The outer set of parens aren't needed 
>> in  g  , but that's a subtly different pipeline.)
>>
>>                         ... peter
>>
>> [1] http://www.jsoftware.com/docs/help701/dictionary/d321.htm
>> [2] http://www.jsoftware.com/docs/help701/dictionary/d330.htm
>>
>> Linda Alvord wrote:
>>> In the slow lane, here's a version without  @  or  &.  or even  inv .
>>>
>>>    t=: 'alpha' ; 'bravo' ; 'chuck'
>>>
>>>    }.@((<' ') ;@,. ]) t
>>> alpha bravo chuck
>>>    }: ; t,&.> ' '
>>> alpha bravo chuck
>>>    }.(<' ')([:;,.) t
>>> alpha bravo chuck
>>>
>>>
>>> Linda
>>>
>>>
>>> -----Original Message-----
>>> From: programming-boun...@forums.jsoftware.com
>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda
>>> Alvord
>>> Sent: Friday, September 07, 2012 4:07 PM
>>> To: programm...@jsoftware.com
>>> Subject: Re: [Jprogramming] Flattening a list containing boxed
>>> elements
>>>
>>> Thanks, After I sent the message it rankled me that it might be a problem 
>>> of rank.
>>>
>>> Linda
>>>
>>> -----Original Message-----
>>> From: programming-boun...@forums.jsoftware.com
>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan
>>> Bron
>>> Sent: Friday, September 07, 2012 12:35 PM
>>> To: programm...@jsoftware.com
>>> Cc: <programm...@jsoftware.com>
>>> Subject: Re: [Jprogramming] Flattening a list containing boxed
>>> elements
>>>
>>> Rank.  All definitions in the DoJ are subject to considerations of rank, 
>>> though this often -forgive the pun- tacit.
>>>
>>>       NB.                vi (v x) u (v y)
>>>       glue  =: dyad def '<  (> x) , (> y)'
>>>
>>>
>>>       NB.  Rank zero here is key
>>>       ; z glue"0 ' '
>>>    alpha bravo chuck
>>>
>>> -Dan
>>>
>>> Please excuse typos; composed on a handheld device.
>>>
>>> On Sep 7, 2012, at 11:22 AM, "Linda Alvord" <lindaalv...@verizon.net> wrote:
>>>
>>>> Now what am I missing?
>>>>
>>>>  ; z ,&.> ' '
>>>> alpha bravo chuck
>>>>
>>>>   NB.  x u&.v y ↔ vi (v x) u (v y)
>>>>
>>>>   ;<(>z),>' '
>>>> alpha
>>>> bravo
>>>> chuck
>>>>
>>>> Linda
>>>>
>>>> -----Original Message-----
>>>> From: programming-boun...@forums.jsoftware.com [mailto:programming-
>>>> boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
>>>> Sent: Friday, September 07, 2012 11:00 AM
>>>> To: programm...@jsoftware.com
>>>> Subject: Re: [Jprogramming] Flattening a list containing boxed
>>>> elements
>>>>
>>>> Chuck caused grief!
>>>>
>>>> -----Original Message-----
>>>> From: programming-boun...@forums.jsoftware.com
>>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan
>>>> Bron
>>>> Sent: Friday, September 07, 2012 9:24 AM
>>>> To: programm...@jsoftware.com
>>>> Cc: <programm...@jsoftware.com>
>>>> Subject: Re: [Jprogramming] Flattening a list containing boxed
>>>> elements
>>>>
>>>> There are more issues than that.  For example, try it with "chuck"
>>>> instead of "charlie".
>>>>
>>>> Also, since > is a scalar verb, the "0 is superfluous. Also, the ,' '
>>>> appends spaces not to the individual words, but to the entire array,
>>>> so that they all end up trailing, instead of interspersed as desired
>>>> (the spaces which separate the words in Linda's final result are an
>>>> [undependable] side-effect of >, and the experiment suggested above
>>>> may hint at their origin).
>>>>
>>>> But, like newcomer to a foreign tongue, Linda has certainly made
>>>> herself understood, and the idea is spot on, even if the words aren't 
>>>> exact.
>>>> Certainly we do want to:
>>>>
>>>>> get inside
>>>> "0 each box
>>>> ,' ' append a space
>>>> , and string the whole thing together.
>>>>
>>>> A native speaker might have said ; z ,&.>  ' '  (and a fastidious
>>>> speaker would prepend a }: ).
>>>>
>>>> -Dan
>>>>
>>>> Please excuse typos; composed on a handheld device.
>>>>
>>>> On Sep 7, 2012, at 8:02 AM, "R.E. Boss" <r.e.b...@planet.nl> wrote:
>>>>
>>>>>  z=: 'alpha' ; 'bravo' ; 'charlie'
>>>>>
>>>>>     ' '=,(>"0 z),' '
>>>>> 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1
>>>>>
>>>>>     ' '=;:^:_1 z
>>>>> 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0
>>>>>
>>>>>
>>>>> R.E. Boss
>>>>>
>>>>>
>>>>>> -----Oorspronkelijk bericht-----
>>>>>> Van: programming-boun...@forums.jsoftware.com
>>>> [mailto:programming-boun...@forums.jsoftware.com] Namens Linda Alvord
>>>>>> Verzonden: vrijdag 7 september 2012 12:50
>>>>>> Aan: 'Programming forum'
>>>>>> Onderwerp: Re: [Jprogramming] Flattening a list containing boxed
>>>>>> elements
>>>>>>
>>>>>> Did I miss this somewhere?  An alternative without inv.
>>>>>>
>>>>>>  ,(>"0 z),' '
>>>>>> alpha  bravo  charlie
>>>>>>
>>>>>> Linda
>>>>>>
>>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> -
>>>>> - For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>> ---------------------------------------------------------------------
>>>> - For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>>>
>>>> ---------------------------------------------------------------------
>>>> - For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>>>
>>>> ---------------------------------------------------------------------
>>>> - For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to