HaloO,

Leon Timmermans wrote:
Still that doesn't solve the problem of his code example. If my
understanding of the synopses is correct, operations on junctions
generate a new junction, so `one(1,2,3) % 2 == 1` will collapse to
one(1 % 2 == 1, 2 % 2 == 1, 3 % 2 == 1), which is one(true, false,
true). If it collapses, it will be one(true, false), and thus true,
but if it doesn't collapse it will be false.

Hmm? The auto-threading is one operator at a time not the '% 2 == 1'
as a whole. The intermediate junctions are assembled according to
the general rule that duplicates are removed. Thus the steps here
are

   1) one(1,2,3) % 2 --> one(1,0,1) --> one(1,0)
   2) one(1,0) == 1 --> True

The comparison collapses the junction. Boolean context collapses
junctions as well because you can think of it as comparison to
True. That is, there is an overload &infix:<==>(Junction,Num-->Bool)
that is not auto-threaded.

BTW, would it be useful to have auto-threading for Set as well?
That is, Junction inherits it from Set.

Regards, TSa.
--

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to