Comments on: Readability? http://blog.ra66i.org/archives/informatics/2007/05/06/readability/ blog of raggisms and random musings, by raggi™ Thu, 01 May 2008 16:33:48 +0000 http://wordpress.org/?v=2.5.1 By: raggi http://blog.ra66i.org/archives/informatics/2007/05/06/readability/#comment-1559 raggi Thu, 25 Oct 2007 18:56:19 +0000 http://blog.ra66i.org/?p=68#comment-1559 I should also note that a friend, who was an ex-Java now corporate web management head, found the Lisp style most readable!? We prefer the ruby style, with downto. I should also note that a friend, who was an ex-Java now corporate web management head, found the Lisp style most readable!?

We prefer the ruby style, with downto.

]]>
By: raggi http://blog.ra66i.org/archives/informatics/2007/05/06/readability/#comment-1558 raggi Thu, 25 Oct 2007 18:53:39 +0000 http://blog.ra66i.org/?p=68#comment-1558 Missed a lightly optimised version: <pre> def factorial n r = 1 n.downto(2) { |i| r *= i } r end </pre> and missed a ruby classic (Slower): <pre> def factorial n (2..n).inject(1) { |r, i| r *= i } end </pre> Missed a lightly optimised version:

def factorial n
  r = 1
  n.downto(2) { |i| r *= i }
  r
end

and missed a ruby classic (Slower):

def factorial n
  (2..n).inject(1) { |r, i| r *= i }
end
]]>