Skip to content

Commit

Permalink
Any: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Mar 2, 2015
1 parent f776ede commit 425976f
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions lib/Type/Any.pod
Expand Up @@ -22,25 +22,54 @@ List or a list-like type.
Returns C<True> if C<$other === self> (i.e. it checks object identity).
Many built-in types override this for more specific comparisons
=head2 method any
Interprets the invocant as a list and creates an C<any>-Junction from it.
method any() returns Junction:D
Interprets the invocant as a list and creates an
C<any>-L<Junction|/type/Junction> from it.
say so 2 == <1 2 3>.any; # True
say so 5 == <1 2 3>.any; # False
=head2 method all
Interprets the invocant as a list and creates an C<all>-Junction from it.
method all() returns Junction:D
Interprets the invocant as a list and creates an
C<all>-L<Junction|/type/Junction> from it.
say so 1 < <2 3 4>.all; # True
say so 3 < <2 3 4>.all; # False
=head2 method one
Interprets the invocant as a list and creates an C<one>-Junction from it.
method one() returns Junction:D
Interprets the invocant as a list and creates an
C<one>-L<Junction|/type/Junction> from it.
say so 1 == (1, 2, 3).one; # True
say so 1 == (1, 2, 1).one; # False
=head2 method none
Interprets the invocant as a list and creates an C<none>-Junction from it.
method none() returns Junction:D
Interprets the invocant as a list and creates an
C<none>-L<Junction|/type/Junction> from it.
say so 1 == (1, 2, 3).none; # False
say so 4 == (1, 2, 3).none; # True
=head2 method list
Interprets the invocant as a list, and returns that list.
Interprets the invocant as a list, and returns that L<List|/type/List>.
say so 42.list.^name; # List
say so 42.list.elems; # 1
=head2 method flat
Expand All @@ -54,15 +83,23 @@ Interprets the invocant as a list, flattens it, and returns that list.
Interprets the invocant as a list, evaluates it eagerly, and returns that
list.
say (1..10).eager; # 1 2 3 4 5 6 7 8 9 10
=head2 method elems
Interprets the invocant as a list, and returns the number of elements in the
list.
say 42.elems; # 1
say <a b c>.elems; # 3
=head2 method end
Interprets the invocant as a list, and returns the last index of that list.
say 6.end; # 0
say <a b c>.end; # 2
=head2 sub exit
sub exit(Int() $status = 0)
Expand Down

0 comments on commit 425976f

Please sign in to comment.