On Thu, 10 Jan 2008, Martin Rubey wrote: | | Ralf Hemmecke <[EMAIL PROTECTED]> writes: | | > On 01/10/2008 09:42 AM, 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) | > > 2) isn't map!(f: S -> S, s: %) == -- from HOAGG | > > map!(f, deref s)$List(S) | > > s | > > assuming that map! stores its result in s? I'm not sure whether this is | > > ok: | > | > Unfortunately 1) and 2) are not equivalent with the current implementation of | > the Reference domain. In boolean.spad.pamphlet one finds | > | > Reference(S:Type): Type with | > ref : S -> % | > ++ ref(n) creates a pointer (reference) to the object n. | > ... | > == add | > Rep := Record(value: S) | > p = q == EQ(p, q)$Lisp | > ref v == [v] | > ... | > | > That looks to me like that for | > | > a: Reference Integer := ref 1; | > b: Reference Integer := ref deref a; | > | > it does not hold | > | > a = b | | Quite possible. But I wouldn't need that in map! anyway, would I? | | the doc to map! only says | | map!(f,u) destructively replaces each element x of u by \axiom{f(x)}. | | and I think that should be interpreted as: | | the result of map!(f,u) is obtained by replacing each element x of u by | f(x). In this process, u may be destroyed. | | I think that would allow the implementation | | map!(f: S -> S, s: %) == ref map!(f, deref s)$List(S)
I'm not sure that would be correct; if s and t points to the same memory cell before call to map!, the should point to the same memory cell after call to map!. No? -- 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