Jump to content

VList: Difference between revisions

m
(J)
Line 999:
=={{header|J}}==
 
A vlist preallocates storage in increasing powers of 2. The "head" of the vlist is in the last (largest) storage block. Here we define a class with methods <code>unshift</code> (which adds to the "head" of the vlist), <code>shift</code> (which removes from the "head" of the vlist), <code>size</code> (which tells us how many elements the vlist currently contains), and <code>get</code> (which retrieves the nth element from the vlist):
 
<lang J>coclass 'vlist'
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.