[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
what is "expr" in serialization methods of collections?
From: |
Paul Johnson |
Subject: |
what is "expr" in serialization methods of collections? |
Date: |
Sat, 02 Mar 2002 19:14:34 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020212 |
Jordan Erenreich sent me some new material that we can use in Swarm to
allow serialization of Arrays. I'm trying to see how this can be
finalized and I'm looking at List.m and Map.m and trying to understand
the way the serialization methods are used. I suppose if I was in a
research team we would talk this over at lunch, but I'm not, so I ask
here for open opinions.
In many methods of swarm's collections library, such as lispIn: or
lispInCreate:, the input is "expr". Is expr always a Swarm List? I
trace the calls on this back to defobj.m, but I don't understand how to
predict what exactly expr is.
Why is it worth knowing?
To do Lisp input in Array.m, suppose I want to adapt the lispIn: method
from List.m. We want to iterate over the elements of expr, and ignore
the ones that are keyword flags, and put the other objects into our
Array. I have to expand the Array for each item to be added, but I keep
thinking there's got to be a way to get the "expr" to tell me how many
objects it has. If I could be sure there was exactly one keyword, for
example, I could resize the Array in a single shot:
- lispIn: expr
{
id index, member;
int c_count = count; //n of objects currently in Array
int expr_count = [expr getCount]; //n in expr
index = [(id) expr begin: scratchZone];
//expand array (self) for new members
//minus one is for the keyword, if there were only one
[self setCount: ([self getCount] + expr_count -1 )];
for (member = [index next]; [index getLoc] == Member; member = [index
next])
if (keywordp (member))
[index next];
else {
block[c_count] = lispIn ([self getZone], member)];
c_count++;
}
[index drop];
return self;
}
I suppose the worst case scenario is that I resize the Array once to
have count+expr_count elements, and then after I go over the set of
inputs, I can shorten the Array back down to count+c_count.
Totally off base?
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- what is "expr" in serialization methods of collections?,
Paul Johnson <=
- Re: what is "expr" in serialization methods of collections?, Marcus G. Daniels, 2002/03/03
- gcc3.0.1, swarm-2002-01-31, Marcello Gallucci, 2002/03/03
- Re: gcc3.0.1, swarm-2002-01-31, Marcus G. Daniels, 2002/03/03
- Re: gcc3.0.1, swarm-2002-01-31, Paul Johnson, 2002/03/03
- Re: gcc3.0.1, swarm-2002-01-31, Marcello Gallucci, 2002/03/03
- Re: gcc3.0.1, swarm-2002-01-31, Paul Johnson, 2002/03/03
- Re: gcc3.0.1, swarm-2002-01-31, Marcello Gallucci, 2002/03/03