Nice poem!  Linda

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Sunday, August 10, 2014 10:28 AM
To: Programming forum
Subject: Re: [Jprogramming] Multiple Assignments

Here's another multiple assignment example:

   poem=: ;:;._2]0 :0
desert morning
a coyote licks ice
on the tumbleweed
)
   poem
┌──────┬───────┬──────────┬───┐
│desert│morning│          │   │
├──────┼───────┼──────────┼───┤
│a     │coyote │licks     │ice│
├──────┼───────┼──────────┼───┤
│on    │the    │tumbleweed│   │
└──────┴───────┴──────────┴───┘
   'a b c'=: poem
   a
desert
morning


   b
a
coyote
licks
ice
   c
on
the
tumbleweed



Thanks,

-- 
Raul

P.S. poem borrowed from http://tinywords.com/2010/02/16/396/





On Sun, Aug 10, 2014 at 9:31 AM, Henry Rich <[email protected]> wrote:

> I recommend reading about multiple assignment in NuVoc.
>
> http://www.jsoftware.com/jwiki/Vocabulary/Assignment
>
> Multiple assignment can assign different values, as Raul points out.  It
> also removes one level of boxing:
>
>    'a b' =: <5
>    a
> 5
>    b
> 5
>    a =: b =: <5
>    a
> +-+
> |5|
> +-+
>    b
> +-+
> |5|
> +-+
>
> Henry Rich
>
>
> On 8/10/2014 12:50 AM, Jon Hough wrote:
>
>> A Quick Question:
>> Is there any difference between:
>> ' var1 var2' =: 10
>>
>> and
>> var1 =: var2 =: 10
>> ?
>> JforC breifly mentions the handy multiple assignment (the former, above)
>> http://www.jsoftware.com/help/jforc/more_verbs_for_boxes.htm
>> but doesn't mention the two are equivalent. From my brief experimenting
>> it seems they are. I'm guessing for a long list of variables the former is
>> neater.
>> ----------------------------------------------------------------------
>> 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