Skip to content

Commit fc3b34c

Browse files
committed
No need to define the empty set (thanks @lizmat)
Also adds some text to the data structures on using eager for early reification.
1 parent 41107b7 commit fc3b34c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

doc/Language/math.pod6

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Perl 6 includes the L<Set> data type, as well as support for L<most set operati
1111
=begin code
1212
my @arbitrary-numbers = ^100;
1313
my \U = @arbitrary-numbers.Set;
14-
my \Ø = ().Set;
1514
1615
my @sets;
1716

doc/Language/structures.pod6

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ statements inside of it would've been printed right away.
381381
382382
Another way to fully-reify a list, is by calling L«C<.elems>|/routine/elems» on
383383
it. This is the reason why checking whether a list contains any items is best
384-
done by using C<.Bool> method (or just using C<if @array { … }>), since you don't
385-
need to reify I<all> the elements to find out if there are C<any> of them.
384+
done by using C<.Bool> method (or just using C<if @array { … }>), since you
385+
don't need to reify I<all> the elements to find out if there are C<any> of them.
386386
387-
There are times where you I<do> want to fully-reify a list before doing something.
388-
For example, the L«C<IO::Handle.lines>|/type/IO::Handle#method_lines» returns
389-
a L<Seq>. The following code contains a bug; keeping reification in mind, try to
390-
spot it:
387+
There are times where you I<do> want to fully-reify a list before doing
388+
something. For example, the L«C<IO::Handle.lines>|/type/IO::Handle#method_lines»
389+
returns a L<Seq>. The following code contains a bug; keeping reification in
390+
mind, try to spot it:
391391
392392
=for code
393393
my $fh = "/tmp/bar".IO.open;
@@ -423,6 +423,14 @@ say "Read $lines.elems() lines"; #reifying before closing handle
423423
close $fh;
424424
say $lines[0]; # no problem!
425425
426+
Using L<eager|/routine/eager> will also reify the whole sequence:
427+
428+
=for code
429+
my $fh = "/tmp/bar".IO.open;
430+
my $lines = eager $fh.lines; # Uses eager for reification.
431+
close $fh;
432+
say $lines[0];
433+
426434
=head1 Introspection
427435
428436
Languages that allow

0 commit comments

Comments
 (0)