Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make Any.elems==1 and Any.list==(Any)
... as discussed with jnhtn and others. This fixes the issue that you were
not able to iterate over a single type object.
  • Loading branch information
FROGGS committed Aug 28, 2015
1 parent 30cc6a3 commit 348886d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/Any.pm
Expand Up @@ -64,7 +64,7 @@ my class Any { # declared in BOOTSTRAP
}

proto method list(|) is nodal { * }
multi method list(Any:U:) { infix:<,>() }
multi method list(Any:U:) { infix:<,>(self) }
multi method list(Any:D:) { infix:<,>(self) }

proto method flat(|) is nodal { * }
Expand All @@ -90,11 +90,11 @@ my class Any { # declared in BOOTSTRAP
multi method Hash() { self.hash.Hash }

proto method elems(|) is nodal { * }
multi method elems(Any:U:) { 0 }
multi method elems(Any:U:) { 1 }
multi method elems(Any:D:) { self.list.elems }

proto method end(|) is nodal { * }
multi method end(Any:U:) { -1 }
multi method end(Any:U:) { 0 }
multi method end(Any:D:) { self.list.end }

proto method keys(|) is nodal { * }
Expand Down
2 changes: 1 addition & 1 deletion src/core/Str.pm
Expand Up @@ -957,7 +957,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $delim-str = $delimiter.Str;
my str $self-string = self;
my str $match-string = $delim-str;
return unless nqp::chars($self-string) || nqp::chars($match-string);
return ().list unless nqp::chars($self-string) || nqp::chars($match-string);

my int $l = nqp::istype($limit, Whatever) || $limit == Inf
?? nqp::chars($self-string) + 1
Expand Down

0 comments on commit 348886d

Please sign in to comment.