From: William James Date: 2008-11-07T12:33:11+09:00 Subject: Re: Redefine while Pascal J. Bourguignon wrote: > Emil Sandin writes: > > > Jason Roelofs wrote: > >> On Thu, Nov 6, 2008 at 10:00 AM, Emil Sandin > wrote: >>> yield if condition > >>> -- > >>> Posted via http://www.ruby-forum.com/. > > > > > > > > > >> > >> Not possible. 'while' is a keyword, not a method. > >> > >> Jason > > > > Too bad. I thought you could do anything with ruby ;) > > No. You'd need a non-broken lisp to do that. No, you wouldn't. For real extensibility, you need Forth. > > In Common Lisp: A.k.a. Commune Lisp, Committee Lisp, and COBOL Lisp. > > (shadow 'while) > (defmacro while (condition &body body) > `(progn > (format t "In redefined while~%") > (when ,condition > ,@body))) > > (while t > 'hi) > In redefined while > HI GForth: variable x : try1 2 x ! begin x @ 9 < while x @ . 1 x +! repeat ; : repeat 2drop drop postpone then ; immediate : try2 2 x ! begin x @ 9 < while x @ . 1 x +! repeat ; try1 cr try2 2 3 4 5 6 7 8 redefined REPEAT with repeat 2