You make a good point, which never occurred to me.  But in 'a b c =. y', the values are usually boxed & a virtual value would not be generated anyway.

What you may be remembering is that results of explicit definitions can now be inplaceable, which is not the same as virtual.

I had convinced myself that assigning/boxing virtual blocks was impossible for reasons other than space, but I am no longer sure about that.  I can't find anything in the commentary to explain why, and that's the sort of thing I would usually write down.  So I will try it, allowing an assignment to remain virtual if it has 90% of the atoms of the backer.  Watch this space.

Henry Rich

On 5/16/2020 9:25 PM, bill lam wrote:
in the context of explicit definition. y is always there, so it should be
harmless. I thought you had already done that. My memory no longer serve me?

On Sun, May 17, 2020, 9:16 AM Henry Rich <[email protected]> wrote:

No, because if y, a, and b are deleted, you are left holding y when all
you need is c.

Henry Rich

On 5/16/2020 8:52 PM, bill lam wrote:
but then the indirect assignment
'a b c'=. y
should use up entire y, just increasing usecount shouldn't be a problem.
I
think this is already implemented, am I right?

On Sun, May 17, 2020, 8:13 AM Henry Rich <[email protected]> wrote:

c =. 1 { a is problematic because if a is deleted, you are left holding
the entire a just to make one item available.  That would waste space.

b =. , a could perhaps increase the usecount of the backer, but I didn't
implement it that way, and I think I decided it wouldn't work to, but I
can't remember why.  Once you know about virtual blocks you might stop
writing b =. , a and use (,a) instead.

Henry Rich

On 5/16/2020 6:43 PM, bill lam wrote:
Shouldn't assignment like
b=. , a
c=. 1{a
just increase reference count of the mother instead of deep copy?


On Sun, May 17, 2020, 6:27 AM Henry Rich <[email protected]> wrote:

I wouldn't say so.  Reshape takes virtually no time/space, but boxing
or
assigning the reshaped result does.  If you do something like

+/ @: (,/) y

the result of ,/ is never realized and it would be wrong to charge it
with time/space not used.

Similarly

(}. - }:) y

the }. and }: create virtual results that are never realized.

You need to expand your mental model beyond time/space for a verb, to
include time/space for realization when that becomes necessary.

Henry Rich


On 5/16/2020 1:22 PM, 'Mike Day' via Programming wrote:
Oh... so one needs to, say, assign the result to see the real t/s?

Thanks,

Mike

Sent from my iPad

On 16 May 2020, at 17:05, Henry Rich <[email protected]> wrote:

The time/space numbers are telling you that (x $ y) produces a
virtual
result when it can, while (_2 ]\ y) doesn't (yet).  If you use the
result
immediately, the space saving is real.  If you box the result or save
it in
a name, the value will be realized and the space saving will vanish.
Henry Rich

On 5/16/2020 11:14 AM, 'Michael Day' via Programming wrote:
Much neater than what I was about to offer,  unless Raoul needs to
specify the fill,
in which case,  this alternative rather minimal amendment is worth
consideration:
       ($!._ ~2,~>.@-:@#) i.7
0 1
2 3
4 5
6 _

cf

       _2]\ i.7
0 1
2 3
4 5
6 0

Also, the time and space performance _might_ be important for large
inputs:
       ts' $ _2]\ list ' [list =: i.100000
0.000618 1.04986e6
       ts'($!._ ~2,~>.@-:@#) list'
2.7e_6 2304

Cheers,

Mike

On 16/05/2020 15:57, 'Rob Hodgkinson' via Programming wrote:
You could try Infix … here with NuVoc link…
https://code.jsoftware.com/wiki/Vocabulary/bslash#dyadic

        x u\ y where x is eg _2 means apply very b to successive
pairs
(_ for non-overlapping).
          _2 ]\ 1 2 3 4 5 6
1 2
3 4
5 6
          _2 ]\ 1 2 3 4 5 6 7
1 2
3 4
5 6
7 0

         _2 <\ 1 2 3 4 5 6
┌───┬───┬───┐
│1 2│3 4│5 6│
└───┴───┴───┘

HTH…/Rob

On 17 May 2020, at 12:42 am, Raoul Schorer <
[email protected]>
wrote:
Hello,

I am convinced that this must be trivial, but I wasn't able to
find
in the documentation how to reshape a list to a table without manually
extracting the length.
in summary, is there a more direct way of doing:

lst =. i. 6

((2,~2%~#) $ ]) lst

for a list of arbitrary length?

Thanks!

Raoul


----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by AVG.
https://www.avg.com


----------------------------------------------------------------------
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
--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to