Perl 6 Perl 6 Lists, Arrays, and Hashes vivified #32

A note about .elems

> say @a.elems;

The elems function tends to make things non-lazy

This includes unary + on arrays

Avoid things like:

if +@a { say '@a is not empty' }
# ...and it's no longer lazy!

Better:

if ?@a { say '@a is not empty' }
if  @a { say '@a is not empty' }

This is especially true for array parameters in subs

Copyright © 2011
http://www.pmichaud.com/2011/pres/