From 4786eb8a48d17e670db6969f090bee0d1649bb3a Mon Sep 17 00:00:00 2001 From: pmichaud Date: Sun, 9 Aug 2009 18:25:49 -0500 Subject: [PATCH] Move .end() from builtins (PIR) into setting (P6). Demonstrated at YAPC::EU 2009 presentation. --- src/builtins/any-list.pir | 18 ------------------ src/setting/Any-list.pm | 2 ++ 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/builtins/any-list.pir b/src/builtins/any-list.pir index cd78d877969..082fb0a8371 100644 --- a/src/builtins/any-list.pir +++ b/src/builtins/any-list.pir @@ -18,12 +18,6 @@ the size of that file down and to emphasize their generic, =cut -.namespace ['Any'] -.sub 'onload' :anon :init :load - $P0 = get_hll_namespace ['Any'] - '!EXPORT'('end', 'from'=>$P0) -.end - =item elems() =cut @@ -42,18 +36,6 @@ the size of that file down and to emphasize their generic, .return ($I0) .end -=item end - -=cut - -.namespace ['Any'] -.sub 'end' :method :multi(_) - .local pmc list - list = self.'list'() - $I0 = list.'elems'() - dec $I0 - .return ($I0) -.end =item keys() diff --git a/src/setting/Any-list.pm b/src/setting/Any-list.pm index 1715ebdc2a4..8d697af127d 100644 --- a/src/setting/Any-list.pm +++ b/src/setting/Any-list.pm @@ -1,4 +1,6 @@ class Any is also { + multi method end() is export { $.list.elems - 1; } + multi method first(Code $test) { return $_ if $test($_) for @.list;