On Thu, 10 Jan 2008, Martin Rubey wrote: | Dear Gaby, | | I saw you implemented map!$Stack as follows: | | map!(f: S -> S, s: %) == -- from HOAGG | map!(f, deref s)$List(S) | s | | I have two questions: | | 1) why didn't you say | | map!(f: S -> S, s: %) == ref map!(f, deref s)$List(S)
Each call to `ref' creates a new cell. | 2) isn't | | map!(f: S -> S, s: %) == -- from HOAGG | map!(f, deref s)$List(S) | s Because | | assuming that map! stores its result in s? I'm not sure whether this is ok: | | pro: the documentation says: | | map!(f,u) destructively replaces each element x of u by \axiom{f(x)}. | | which could be interpreted as "map! stores its result in s" | | con: it might well be possible to have an implementation where this is | undesirable, i.e, although one which is destructive to s, but where s | does not contain the result of map! afterwards. If I recall correctly, | sort! works that way: | | (14) -> l := [1,16,81,1] | | (14) [1,16,81,1] | Type: List PositiveInteger | (15) -> sort! l | | (15) [1,1,16,81] | Type: List PositiveInteger | (16) -> l | | (16) [1,16,81] | Type: List PositiveInteger | | | comments? I suspect it depends on the intepretation of `in-place' update. Which is the most common interpretation in the current implementations. -- Gaby ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel