Elektrine lite

← Feed

@timotimo@peoplemaking.games

Post #2457470

2026-05-08 18:42 UTC

@wim_v12e@merveilles.town I missed these articles the first time, but perhaps I can shed some light? Junction is derived directly from Mu, and Any is derived directly from Mu as well, and this is actually how auto-threading is triggered: whenever parameter binding for a function call fails because a Junction was passed to a parameter that was typed Any or a sub-type of Any, the call is re-attempted with the values inside the Junction one at a time, and the result of the call is re-assembled into a new Junction of the same type. If you just want your original code to work without the need for a collapse operation, then you can just change pair to take Mu arguments instead of the default that you get when you don't put a type constraint on parameters which is Any. Then instead of pair (42^43),R doing pair(42, R)^pair(43, R) because the call gets autothreaded, you end up with actually a function that calls its argument with (4243) and R instead of a junction with two functions, and fst and snd "accidentally" work

Replies (2)

  • @timotimo@peoplemaking.games 2026-05-08 18:44

    @wim_v12e@merveilles.town based on my knowledge of the implementation of junctions, I would maybe say that it's not junctions that are syntactic sugar, but function calls (and method calls, and operator calls) are syntactic sugar for "call the thing directly, or call it multiple times as needed to satisfy the junction semantics". though I'm not sure if that's a meaningful difference or not

    Open ##2457471

  • @wim_v12e@merveilles.town 2026-05-09 08:41

    @timotimo@peoplemaking.games Thanks for the explanation. So providing the explicit Mu type constraint is a way avoid the greedy behaviour, rather than retrieving a value that was turned into a junction because of this greedy behaviour.

    Open ##2457473