From: Adriano Ferreira Date: 2006-01-13T20:26:47+09:00 Subject: Re: ABS |ruby| On 1/13/06, Alex Combas wrote: > In math the absolute value is typically > the double pipe: > |x| = 27 > > This reminds me stuff like: > Stuff.each { |x| puts 'hello '+x } > > Are these two related in any way? IIRC, the block syntax in Ruby is reminiscent to Smalltalk syntax, which used blocks like this: [ :x | Transcript show: 'hello ', x ] "the equivalent of Ruby block { |x| puts 'hello '+x }" and used | vars | to declare some temporary variables in a piece of code. | x y | ^ x + y Square brackets are not square anymore (as they are used in Ruby for indexing purposes - C inheritance). The odd variable names with markers (:x) were replaced by the delimited block of names (| x |) and voil�. Regards, Adriano.