Content deleted Content added
No edit summary |
|||
Line 163:
::::Your references there are all about first-class functions, not about other kinds of first-class objects (types/classes, structs, arrays, etc.), which is what I was talking about in my comment above. --[[User:Macrakis|macrakis]] ([[User talk:Macrakis|talk]]) 14:07, 24 August 2009 (UTC)
::::: The first reference I gave there defines the notions in general. You are welcome to look for additional references covering topics like first-class types and classes. I gave a rewrite notice at [[first-class object]]; see [[WP:V]]. [[User:Pohta ce-am pohtit|Pcap]] [[User_talk:Pohta ce-am pohtit|<small>ping</small>]] 11:14, 27 August 2009 (UTC)
== Higher-order functions in Perl ==
(see M.J. Dominus. Higher Order Perl, 2005. pp 325, 333)
<source lang="perl">
$lambda = sub {$_[0] + 4};
print $lambda->(2), "\n"; # => 6
</source>
|