develooper Front page | perl.perl6.users | Postings from April 2021

gather take eager syntax

Thread Next
From:
Norman Gaywood
Date:
April 20, 2021 05:39
Subject:
gather take eager syntax
Message ID:
CAHJ-_U7ZN-z8fsYv8s8SDULjUkXZ70_NA0tkEqsy7JENRsFYKA@mail.gmail.com
Hi, I can't figure out why the last line here is failing.
Version 2020.07

$ raku
To exit type 'exit' or '^D'
> my %h = gather { take "foo"=>1; take "bar"=>2;}
{bar => 2, foo => 1}
> my %h = gather { take "foo"=>1}
{foo => 1}
> my %h = gather { take eager "foo"=>1; take "bar"=>2;}
{foo 1 => bar => 2}
> my %h = gather { take eager "foo"=>1}
Odd number of elements found where hash initializer expected:
Only saw: $(:foo(1),)
  in block <unit> at <unknown file> line 1

-- 
Norman Gaywood, Computer Systems Officer
School of Science and Technology
University of New England
Armidale NSW 2351, Australia

ngaywood@une.edu.au  http://turing.une.edu.au/~ngaywood
Phone: +61 (0)2 6773 2412  Mobile: +61 (0)4 7862 0062

Please avoid sending me Word or Power Point attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About