Top all-time · #5820
Paul Cantrell
Personal blog · innig.netprogrammingculture
Paul Cantrell's personal blog at innig.net covers programming and culture. Since 2008, 14 different Hacker News readers have linked it 14 times, most often “Closures in Ruby”. The last post was in 2024, but the archive is still widely read.
Too few sampled comments (6) to say how often HN recommends it.?
Why HN links it
HN readers link Paul Cantrell's closures-in-ruby page as a reference on Ruby blocks, procs and lambdas, and on how Ruby's closures and anonymous functions compare with other languages.
Summarised by Claude from a sample of 6 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
The creative work of Paul Cantrell: composition, piano, software, poetry, and thoughts on teaching.
Most-linked posts?
- Closures in Ruby7 people · 7 mentions · first linked 2008-04-14
- What Liberal Arts Education Is For4 people · 4 mentions · first linked 2024-03-02
- Closures in Ruby2 people · 2 mentions · first linked 2012-04-19
What Hacker News says?
Python has no true anonymous functions. Ruby is just a mess in this regard,even if you can arguably do anything you want in the end : http://innig.net/software/ruby/closures-in-ruby.rb On the other hand, javascript has a simple, no bullshit syntax for functions. If you want a function to be anonymous, just don't give it a name. Erlang and Lua obviously have true anonymous functions and closure support.
Comment linking /software/ruby/closures-in-ruby.rb
on “JavaScript: It’s Not Just for Browsers Any More”Submitted Closures in Ruby as a story · 30 points
HN discussionOne small note, as pointed out in http://innig.net/software/ruby/closures-in-ruby.rb posted by arohner above: although in 1.8 proc is an alias for lambda, in 1.9 it's now an alias for Proc.new.
Comment linking /software/ruby/closures-in-ruby.rb
on “Ruby is not a callable orientated language”Submitted Closures in Ruby (run it and follow along) as a story · 8 points
HN discussion"Aside from the errors in this sentence (blocks, procs and lambdas are all just Proc objects" No, they're different: http://innig.net/software/ruby/closures-in-ruby.rb
Comment linking /software/ruby/closures-in-ruby.rb
on “Ruby is not a callable orientated language”Submitted Closures in Ruby as a story · 4 points
HN discussion"But I have yet to find a good, definitive guide out there." Really? I thought this was the definitive guide: http://innig.net/software/ruby/closures-in-ruby.rb It seems like a good guide to me.
Comment linking /software/ruby/closures-in-ruby.rb
on “Understanding Ruby Blocks, Procs and Lambdas”Submitted What Liberal Arts Education Is For as a story · 3 points
HN discussionHere's yet another stab at explaining closures using C. Hopefully this is clear. The confusion about closures happens because it doesn't exist in other languages. (There isn't a way to express it.) Let's look at a simple C function that uses a global variable: int a = 1; int a_plus_2() { return 2 + a; } This always returns 2 more than "a". Initially it will return 3. If "a" is set to 5 at some point in the future, "…
Comment linking /software/ruby/closures-in-ruby.rb
on “Reading On Lisp: Then and Now”Submitted What Liberal Arts Education Is for (2024) as a story · 2 points
HN discussionAbout the strange Ruby pipes when iterating thing... Ruby, like many languages, has support for anonymous functions (lambdas, procs, blocks, etc.) The pipes are the delimiters for the formal parameters that the function receives. Most languages use parentheses for that. For instance, you might expect something that looks like this: function_that_accepts_a_lambda(arg1, arg2, lambda(lambda_arg1, lambda_arg2) { lambda…
Comment linking /software/ruby/closures-in-rubyhttp://innig.net/software/ruby/closures-in-ruby
on “Ask HN: What language should I learn next?”Submitted What Liberal Arts Education Is For as a story · 2 points
HN discussionSubmitted What Liberal Arts Education Is For as a story · 2 points
HN discussionSubmitted Closures in Ruby as a story · 2 points
HN discussion