Ingo Blechschmidt iblech at web.de writes:
then it has a better chance of working, presuming someone has the
gumption to write .pick on hashes, which doesn't look entirely trivial
to do right.
thinking out loudI'm sure I overlooked something, but the following
seems to be correct
Hi,
Trey Harris wrote:
In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
What does pick return on hashes? Does it return a random value or a
random pair? (I suppose returning a pair is more useful.)
I'd assume in all cases that pick returns an *alias*, and in the case
of
On Tue, Apr 05, 2005 at 02:38:05PM +0200, Ingo Blechschmidt wrote:
: Hi,
:
: Trey Harris wrote:
: In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
: What does pick return on hashes? Does it return a random value or a
: random pair? (I suppose returning a pair is more useful.)
:
Hi,
Larry Wall wrote:
: Same for hashes:
[...]
: my %hash = (a = 1, b = 2),
: my $pair := %hash.pick;
: $pair = ...; # %hash changed
I'm not sure that works. We don't quite have pairs as first class
containers. Binding would try to use a pair as a named argument, and
would fail
Ingo Blechschmidt wrote:
I remembered Damian saying that pick does not only work on junctions,
but on arrays and hashes, too (and I even found his posting :):
http://groups.google.com/groups?selm=420DB295.3000902%40conway.org).
Are the following assumptions correct?
my $junc = 1|2|3;
print
In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
What does pick return on hashes? Does it return a random value or a
random pair? (I suppose returning a pair is more useful.)
I'd assume in all cases that pick returns an *alias*, and in the case of
hashes, an alias to the pair:
#
I'd assume you'd get an *alias* to a random pair:
# Test error-correction
for 1..$entropy_threshhold {
%hash.pick.value = rand $scribble_factor;
}
Trey
In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
Hi,
I remembered Damian saying that pick does not only work on
In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
What does pick return on hashes? Does it return a random value or a
random pair? (I suppose returning a pair is more useful.)
I'd assume in all cases that pick returns an *alias*, and in the case of
hashes, an alias to the pair:
#
Yikes. Sorry about the ressends... my email client kept dying and I
thought the mail was lost. Guess not. :-)
Trey
In a message dated Mon, 4 Apr 2005, Trey Harris writes:
In a message dated Mon, 4 Apr 2005, Ingo Blechschmidt writes:
What does pick return on hashes? Does it return a random