Update: Yes, not everything is a closure. It's actually a bunch of misdirection. I hope.#!/usr/bin/perl # Everything is a closure! use strict; use warnings; sub z(@); sub zz(&); z(map { my $z = $_; sub { $z } } map ord, split(//, zz { substr(scalar <DATA>, 2) }))->(); sub z(@) { my @z; my $z = sub($) { chr shift }; my $zz = sub($) { push @z, do { sub($) { my $zzz = shift; sub { $z->($zzz) }; } } ->(shift); }; do { my @z = @_; sub { foreach my $z ( @z ) { $zz->($z->()); } } }->(@_); do { sub { foreach my $z (@z) { print $z->(); } } }; } sub zz(&) { seek DATA, 0, 0; readline DATA; + shift->(); + } __END__ Everything is a closure!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Everything is a closure
by merlyn (Sage) on Jan 20, 2005 at 20:04 UTC | |
by Dylan (Monk) on Jan 21, 2005 at 16:14 UTC | |
|
Re: Everything is a closure
by BrowserUk (Patriarch) on Jan 20, 2005 at 16:24 UTC | |
by holli (Abbot) on Jan 20, 2005 at 19:54 UTC | |
by BrowserUk (Patriarch) on Jan 20, 2005 at 19:56 UTC | |
by Aristotle (Chancellor) on Jan 21, 2005 at 12:11 UTC | |
by BrowserUk (Patriarch) on Jan 21, 2005 at 12:14 UTC |