From: Eduardo O. <edu...@gm...> - 2024-10-13 18:58:36
|
On Sun, 13 Oct 2024 at 14:25, Stavros Macrakis <mac...@gm...> wrote: > I don't understand the problem. > > Why would you expect *subst* to evaluate the variables *b* and *c *inside > a quoted expression? > Hi Stavros, consider these eight "cases", that I will refer to as "Ev 1" to "Subst 4": [a:b, b:c, c:d]; ev ('[a,b,c], a=42); /* [42,c,d] - "Ev 1" */ ev ('[a,b,c], 'a=42); /* [42,c,d] - "Ev 2" */ ev ('[a,b,c], b=42); /* [b,42,d] - "Ev 3" */ ev ('[a,b,c], 'b=42); /* [b,42,d] - "Ev 4" */ subst( [ a=42], [a,b,c]); /* [42,c,d] - "Subst 1" */ subst( ['a=42], [a,b,c]); /* [b,c,d] - "Subst 2" */ subst('['a=42], [a,b,c]); /* [b,c,d] - "Subst 3" */ subst('[ a=42], [a,b,c]); /* [b,c,d] - "Subst 4" */ and these three diagrams: [a,b,c] a=42 [a,b,c] a=42 [a,b,c] a=42 | | | | |_______| e1 | | e2 | | e3 s4 | v | v | v [b,c,d] | [b,c,d] b=42 [42,b,c] |________| |________| | s1 | s2 | e4 | v v v [b,c,d] [42,c,d] [42,c,d] Diagram 1 Diagram 2 Diagram 3 I'm pretty sure that: Subst 1 corresponds to Diagram 2, Subst 2 corresponds to Diagram 1, Subst 3 corresponds to Diagram 1, Subst 4 corresponds to Diagram 1, but I don't know how to interpret "Ev 1" and "Ev 2"... I have two diagrams - Diagram 2 and Diagram 3 - that go from [a,b,c] and a=42 to [42,c,d], but in my mental model the quote in the "'a=42" should rule out the passage e3 in the Diagram 2... so "Ev 2" should correspond to the Diagram 3... but "Ev 1" and "Ev 2" are not so different, so "Ev 1" should correspond to Diagram 3, too. In other words: my current guess is that in this smaller program [a:b, b:c, c:d]; ev ('[a,b,c], a=42); /* [42,c,d] - "Ev 1" */ ev ('[a,b,c], 'a=42); /* [42,c,d] - "Ev 2" */ subst( [ a=42], [a,b,c]); /* [42,c,d] - "Subst 1" */ we get the same result, [42,c,d], in all three cases by a coincidence, because the order of evaluation is different... "Ev 1" and "Ev 2" follow the order of the Diagram 3, and "Subst 1" follows the order of the Diagram 2... Is that right? I think that I understand subst, but I don't understand well how ev works, and I'm just guessing its behavior... Cheers =/, Eduardo Ochs |