Re: [iterate-devel] Fwd: if-first-iteration, a little better vers ion as an arch patch
Hi,
The user API looks ok, however the way you change add-binding removes safety checks: several uses must have the same default initialization and type, etc. This could cause future extensions to break.
I don't really see what you mean here (newbie warning repeated :)
I modified add-binding to accept an optional keyword param,
Add-binding was previously used only via make-binding-internal. Your patch bypasses all the checks that the make-* functions do, and the functionality they provide. Is that clearer?
Maybe a make-shared-binding is what's missing? Indeed something seems missing, e.g. "create only if not existing already, but I don't know the name of the possibly existing binding".
- attila (alias 101 on irc &no 'its not lisp code :) I was introduced to IRC in the late eighties but never felt comfortable with it: Too many concurrent discussions, despite threading GUI clients, and lots of bots & kicking. I very much prefer usenet news.
Regards, Jörg Höhle.
Add-binding was previously used only via make-binding-internal. Your patch bypasses all the checks that the make-* functions do, and the functionality they provide. Is that clearer?
yep, please find the new version of the patch attached.
Maybe a make-shared-binding is what's missing? Indeed something seems missing, e.g. "create only if not existing already, but I don't know the name of the possibly existing binding".
for now i simply used make-accum-var-binding as you suggested in a few mails before. some doc fragmants: FIRST-TIME-P evaluates to true for the first time it is evaluated, otherwise to nil. It works like that even inside conditionals, only the first evaluation counts. Example: (iter (for el in '("a" 1 2 3 "b")) (when (numberp el) (unless (first-time-p) (princ ", ")) (princ el))) prints "1, 2, 3" FIRST-ITERATION-P evaluates to true inside the loop body in the first loop cycle, otherwise to nil. hope it helps, - attila (alias 101 on irc &no 'its not lisp code :)
for now i simply used make-accum-var-binding as you suggested in a few mails before.
sorry for the flood, bu i couldn't stand that. here's a version that introduces make-shared-binding and uses a shared gensym-ed variable for first-iteration-p all the tests run ok. but now it's sleep time, - attila (alias 101 on irc &no 'its not lisp code :)
participants (2)
-
Attila Lendvai
-
Hoehle, Joerg-Cyril