On Thu, 28 Dec 2006, Nate Murray wrote:

> Hey Guys,
> I've been going through the video lectures "Structure and
> Interpretation of Computer Programs by Hal Abelson and Gerald Jay
> Sussman. " (
> http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/ ).
> The section on Higher-Order Procedures was a huge eye-opener for me and
> I wanted to condense down what I learned in Lisp to guys who program in
> Ruby. Now I know that for most of the experienced on this list this
> will be old-news, but I hope to provide a valuable tutorial of Abelson
> and Sussman's material to some guys who are just learning about this
> stuff in Ruby.
>
> Posted below is the straight text and code examples of what I have so
> far. ( I've also posted the pdf of slides here:
> http://tech.natemurray.com/2006/12/higher-order-procedures-in-ruby.html
> if you're interested. ) Now, I am not just trying to drive up traffic
> to my site. My purpose in posting this here is two-fold:
>
> 1) To submit it for peer review. I'd like to know if you guys have any
> suggestions or improvements on the code examples and/or copy. For
> example a part that seems particularly ugly to me is the
>
>  cube = self.method(:cube).to_proc
>  cube.call(3)
>
> part. Any suggestions on how to make this a little more transparent or
> simplified?

   method('cube')[ 3 ]

>
> 2) To provide a valuable introductory tutorial to the power of
> higher-order procedures and how to implement them in Ruby.
>
> The text below can be copied and pasted into a file. It should run with
> no problems.
>
> DISCLAIMER: As mentioned above and below the copy is taken mainly from
> "Structure and Interpretation of Computer Programs by Hal Abelson and
> Gerald Jay Sussman. " (
> http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/ ). A
> few paraphrases and examples were added and the code was converted to
> Ruby.
>
> enjoy,
> Nate Murray
> http://www.natemurray.com

btw.

   harp:~ > cat a.rb
   def sum_integers(a, b)
     return 0 if a > b
     a + sum_integers((a + 1), b)
   end

   p sum_integers(10, 10)

   harp:~ > ruby a.rb
   10

and similar errors.

you could post this on http://sciruby.codeforpeople.com/ if you wanted.

regards.

-a
-- 
if you find yourself slandering anybody, first imagine that your mouth is
filled with excrement.  it will break you of the habit quickly enough. - the
dalai lama