machineghost schrieb:
> It turns out the problem is with both of our understanding of repeat

Ah, yes! Thanks for your analysis, now everything makes sense.

I could use the excuse that I usually program in Python, not in 
Javascript, but in fact repeat() does not behave differently there ;-)

To summarize, the Test2 code based on two subtle misconceptions. First, 
the implicit idea that in the expression repeat(BR()) the BR() is either 
evaluated on every repetition, or copies of the BR() object are created 
on every repetition, which both is of course not the case. Second, the 
idea that you don't need to care whether elements you're adding to the 
DOM are already used elsewhere ;-)

Your solution

var brAdder = function(x) { return [x, BR()]; }
appendChildNodes("test2", map(brAdder, text));

is nice. Alternatively, the Test2 code be fixed as follows:

appendChildNodes("test2", izip(text, imap(BR, repeat())));

Just to make use of repeat() against these odds...

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to