Revision history for Sub-Nary
+0.02 2008-08-05 16:20 UTC
+ + Add : Support for matches, eval, keys, values, each readline, stat,
+ localtime, gmtime, caller, get{pw,gr,host,net,proto,serv}*,
+ constant ranges.
+ + Doc : POD nits.
+ + Fix : Array assignment count.
+ + Tst : More of them, lots.
+ + Tst : All op tests now go in t/24-ops.t.
+
0.01 2008-08-04 16:35 UTC
First version, released on an unsuspecting world.
list context.
VERSION
- Version 0.01
+ Version 0.02
SYNOPSIS
use Sub::Nary;
"new"
The usual constructor. Currently takes no argument.
- "nary $coderf"
+ "nary $coderef"
Takes a code reference to a named or anonymous subroutine, and returns a
hash reference whose keys are the possible numbers of returning scalars,
and the corresponding values the "probability" to get them. The special
1/4", 3 with probability "1/2 * 1/2 + 1/2 * 1/2 = 1/2" and 4 with
probability "1/4" too.
- * The 'list' state is absorbant in regard of all the other ones.
+ * If a core function may return different numbers of scalars, each kind
+ is considered equally possible.
+ For example, "stat" returns 13 elements on success and 0 on error.
+ The according probability will then be "{ 0 => 0.5, 13 => 0.5 }".
+
+ * The "list" state is absorbing in regard of all the other ones.
This is just a pedantic way to say that "list + fixed length =
list". That's why
return 1, simple(), @_
}
- is considered as always returning an unbounded list. The convolution
- law also does not behave the same when "list" elements are involved
- : in the following example,
+ is considered as always returning an unbounded list.
+
+ Also, the convolution law does not behave the same when "list"
+ elements are involved : in the following example,
sub oneorlist {
if (rand < 0.1) {