From: Travis Whitton Date: 2003-01-23T05:41:23+09:00 Subject: Applying an operator to a list Hello all, I have a quick question: Is it possible to create a Lisp style apply function with Ruby, and would I have to use eval to create one? The function would work as follows: [1, 2, 3].apply('+'.intern) # => 6 [2, 3, 4].apply('*'.intern) # => 24 I know I could easily sum a list like so: [1, 2, 3].inject(0) {|n, value| n + value} So, I guess this is just a curiosity question. - Travis Whitton