News for hackers. Stuff that matters.
Re:Ten Years of Purely Functional Data Structures (2008) by DanWaterworth on Tuesday May 14, 2013 @05:31AM (#5703782)
You're right, I should have backed up that assertion.

The reason I say that functions aren't first class is that if you create a function:

    def factorial(n)
      if n > 0
        n * factorial(n - 1)
      else
        1
      end
    end
You can't pass it into another function without creating an object for it. ie, using Kernel.method(:factorial). It's the same with blocks, they aren't first class, in order to construct values, you have to construct objects that holds them.
Re:Ten Years of Purely Functional Data Structures (2008) by stouset on Monday May 20, 2013 @09:20PM (#5741339)
So? I can easily write

    >> Y   = ->(&x) { ->(f) { f[f] }[ ->(g) { x[ ->(*n) { g[g][*n] } ] } ] }
    >> fac = Y.call {|this| -> (n) { n > 0 ? n * this[n - 1] : 1 } }
    >> fac[5]
    => 120
You can argue that Ruby doesn't lend itself towards higher-order functional programming, but I asserting that Ruby isn't a function language isn't a tenable position.
Re:Ten Years of Purely Functional Data Structures (2008) by DanWaterworth on Friday May 24, 2013 @10:29AM (#5762975)
Do you deny that factorial, as I implemented it, is a function? Do you deny that I can't pass factorial into another function without creating an object to hold it? It doesn't matter what else is true. These facts alone mean that ruby's function's aren't first class.