TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Implementing Set#to_proc and Hash#to_proc in Ruby

28 pointsby mudgemeisterover 10 years ago

1 comment

steventhedevover 10 years ago
FYI - the ampersand syntax is only in function calls, so the following will fail:<p><pre><code> &amp;set.call(1) </code></pre> Whereas this will not:<p><pre><code> (1..30).select(&amp;set) </code></pre> Generally speaking, &amp; is syntactic sugar for .to_proc, but only within function calls.
评论 #8671798 未加载