It's a list! It's an array! No, it's...

Dar Scott dsc at swcp.com
Sat Dec 7 13:08:01 EST 2002


On Saturday, December 7, 2002, at 04:08 AM, miscdas at boxfrog.com wrote:

>> I'm working on a way to pack some values together and take them apart.
>
> Seems to me you just found your name and function names.
> The object is a package.
> The functions are pack and unpack.
> To string them together or unstring, tie and untie.

Great idea!

One problem is the 7 letters.  Maybe box is better for sticking into 
function names.  And it can be a noun or a verb.  I think most of us can 
read names of the form xxxPkgyyyy, though.

Now this sequence of packages...  Is it a package string?  shipment?  
Pallet?  Multipackage?  Bundle?  12DaysOfChristmas?

I had thought of pack earlier.  It is a little misleading.  It doesn't 
make data representation smaller.  If readability options are used, it 
makes them larger.  Even so, one can have _one_ value that contains lots 
of things, so with that kind of path, it is pack.

More...

page and book       (Page might work as the next higher chunk name, 
right above line)
page and pages
envelope and ???

box and boxes

Hmmm.

box(val)  ==> box
box(val, typeCode)  ==> box
unbox(box)  ==> val
unbox(boxes)  ==> val of first

boxOf(boxes, index)  ==>  box
boxOf(boxes, indexStart, indexEnd)  ==> boxes or box

unBoxOf(boxes, index)  ==> val

put empty into noBoxes
put box1 & box2 into myBoxes

deleteBoxOf(boxesRef, index)
deleteBoxOf(boxesRef, indexStart, indexEnd)

putBoxOf(newBox2, myBoxes, -1)  -- Replaces last box of myBoxes with new 
box(es)

function dequeue
   global myQ
   local temp
   put boxOf(myQ,-1) into temp
   deleteBoxOf(myQ,-1)
   return unbox(temp)
end dequeue

on enqueue val
   global myQ
   put box(val) & myQ into myQ
end dequeue

Does that sound right?

Dar






More information about the use-livecode mailing list