Nat Pryce <nat.pryce / b13media.com> wrote:
> factorial = proc do |x|
>     (x == 1) ? 1 : (x * factorial.call( x-1 ))
> end

That certainly works, and serves to show why a truly anonymous
recursive Proc would be a small improvement at best, but it would
still be nice to have one with true anonymity (in both scopes), as in
CL:

(lambda (arg)
  (labels ((factorial (n) 
		      (if (= n 1) 
			  1 
			(* n (factorial (- n 1))))))
	  (factorial arg)))

If only to simplify garbage collection issues between a function
generating factory class and its receiver.  Or if for no other reason
to be able to list it as a feature on some checklist ;-).


jweirich / one.net wrote:
> you should see the version done in Java using inner classes!

I looked at the links you provided (including the perl version), and I
am glad I found ruby.  Just prooves you have to be careful what you
wish for in newsgroups. :-)