Re: Domains? [Re: r28597 - docs/Perl6/Spec/S32-setting-library]

2009-10-13 Thread Ville Koskinen
On Tue, 13 Oct 2009 09:21 +0200, Michael Zedeler mich...@zedeler.dk
wrote:
 'a' .. 'z' followed by 'ä', 'ö', 'å' (Swedish)

'a' .. 'z', 'å', 'ä', 'ö' (Finnish)
'a' .. 's', 'š', 'z', 'ž', 't' .. 'w', 'õ', 'ä', 'ö', 'ü', 'x', 'y'
(Estonian)

So yes, you are definitely on the right track with Domains.

Regards,
Ville Koskinen




Assigning duplicate values to several hash keys using junctions?

2009-06-08 Thread Ville Koskinen
Hello all,

I was curious if this is possible in Perl 6:

%hash{ 'foo'  'bar' } = 'some value';
# %hash{'foo'} eq 'some value' and %hash{'bar'} eq 'some value'

or perhaps

%hash{ 'foo' | 'bar' } = 'some value';

In other words, is it possible to assign the same value to multiple hash
keys simultaneously using junctions (or some other new mechanism)? In
Perl 5, I would do

$hash{'foo'} = $hash{'bar'} = 'some value';

which gets tedious with more than one hash key. An alternative is always

@hash{qw(foo bar)} = ('some value') x 2;

which is probably

%hashfoo bar = ('some value') x 2;

in Perl 6, but you always need to take care to write the correct integer
in the list replication. The best way is, of course, (in Perl 5)

{
   my @keys = qw(foo bar);
   @ha...@keys} = ('some value') x @keys;
}

but then you need the @keys array, which needs to be defined if you are
dealing with literal values. Reading the synopses, one possibility seems
to be 

%hashfoo bar = 'some value';

using hyper operators, but is that really the best way?

Regards,
Ville Koskinen