This does not apply for the first example, nor for the general case of the
third example.  Not sure about the second example.  In any case you can get
answers to these questions yourself by doing some experiments and checking
the space consumed.



On Wed, Nov 23, 2011 at 10:35 PM, Ben Gorte - LR <[email protected]>wrote:

> Thanks for the explanation. Would this also apply to
>
> 'a b c' =. abc =. i.3 4 5
>
> or to
>
> 'n m' =. nm =. 12; 'monkeys'     ?
>
> In that case it is perhaps not so expensive to pass more than two things
> to a verb and separate these inside it wilh
>
> 'p q r' =. y    (?)
>
> Ben
> ________________________________________
> From: [email protected] [[email protected]]
> on behalf of Roger Hui [[email protected]]
> Sent: Wednesday, November 23, 2011 3:36 PM
> To: Programming forum
> Subject: Re: [Jprogramming] One noun with two names
>
> Names are reference-counted so that if you say a=:b=: 123 the reference
> counts for a and b are each one more than if you'd said a=:123 and b=:123.
> Before the interpreter modifies an array it checks the reference count and
> if that count is not the minimum it will make a copy of the array before
> modifying it.
>
> > (but what would be the prupose?)
>
> Shorter code.   a=:b=:c=: blah  is a common construct, in many programming
> languages.
>
>
>
> On Wed, Nov 23, 2011 at 6:16 AM, Ben Gorte - LR <[email protected]
> >wrote:
>
> >
> > Dear J forum,
> >
> > To my surprise I found out that
> >
> >    a =. b =. 480 640$0
> >
> > is not the same as
> >
> >    a =.  480 640$0
> >    b =.  480 640$0
> >
> > as the first gives you two names pointing to the same data. I guess that
> > should be ok, and it saves space (but what would be the prupose?)
> >
> > I passed both as pointers to a DLL (a .so in linux), which was supposed
> to
> > put two different images in a and b, and then the first is not ok. It
> only
> > works with the second variant :-)
> >
> > Greetings from Cape Town,
> > Ben
> >
> > ----------------------------------------------------------------------
> > 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