perl6-language
[Top] [All Lists]

Re: Closure vs Hash Parsing

To: Perl6 <perl6-language@perl.org>
Subject: Re: Closure vs Hash Parsing
From: "Carl Mäsak" <cmasak@gmail.com>
Date: Fri, 8 Aug 2008 07:32:52 +0200
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-language@perl.org
Delivered-to: perl6-language@perl.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=IEB/pKtPNs8lIe3hgqbGNfRkXQUVsXOCSlXo4NJL/Og=; b=wLlgp205coprlCjYGKeV40KGTeQ6uer+rspXGOT8v5WCAbn8OOMyLEuXbzn1blFnk0 pd2po3cHY7DN1LZlA9KGkzuC43DCgYhhhBWlIsBv0zdpNCurGQgre4aeyilJSDNAo7+B PTF0ybVpJi210j3PFY9eb6pbVtsNPDB5/tFio=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=LuLS5k9BdAvDalCUKm39CtvmRj9+WNEvL+ziBHSIkL4UguaNPWUcjIaF2ik82ERiyX db9vIiS5mUE3AiTYBjfEaJGb0+Z8WG0U3hBVSFAWji7acOiuO3wYaNg7gBW0+GNMjW1P YJRvW+YDeRB39+itWuSTlcPwU/OL5I6PluXPI=
In-reply-to: <489B59DF.2060001@jnthn.net>
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-language.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
References: <489B59DF.2060001@jnthn.net>
Jonathan (>):
> That this means the { $_ => uc $_; } above would end up composing a Hash
> object (unless the semicolon is meant to throw a spanner in the
> hash-composer works?) It says you can use sub to disambiguate, but
>
> %ret = map sub { $_ => uc $_; }, split "", $text;
>
> Doesn't work since $_ isn't an automatic parameter for a sub, like it would
> be in just a block (in the implementation, and if I understand correctly in
> the spec too).

Out of curiosity, would this work?

%ret = map -> { $_ => uc $_; }, split "", $text;

Or this?

%ret = map { $^foo => uc $^foo; }, split "", $text;

-- 
Carl Mäsak


<Prev in Thread] Current Thread [Next in Thread>