2025/05/12

Newest at the top

2025-05-12 05:58:15 +0200 <ski> without `-rectypes', it only allows such cycles, if they go through at least one object type
2025-05-12 05:58:04 +0200 <monochrom> OK that's deep magic.
2025-05-12 05:57:50 +0200 <ski> `ocaml -rectypes' does, yes
2025-05-12 05:57:41 +0200 <monochrom> Oh God it does equi-recursive types?!
2025-05-12 05:57:33 +0200 <EvanR> it's an infinite type
2025-05-12 05:57:10 +0200 <ski> val omega : ('a -> 'b as 'a) -> 'b = <fun>
2025-05-12 05:57:08 +0200 <ski> # let omega x = x x;;
2025-05-12 05:57:06 +0200 <EvanR> this is some fun t business
2025-05-12 05:56:29 +0200 <monochrom> Wait, how does that accept that "t t" is typeable?
2025-05-12 05:56:11 +0200 <EvanR> alright let me think
2025-05-12 05:54:46 +0200 <ski> - : int = 144
2025-05-12 05:54:43 +0200 <ski> # fix (fun fib n -> match n with 0 -> 0 | 1 -> 1 | n -> fib (n - 1) + fib (n - 2)) 12;;
2025-05-12 05:54:33 +0200 <ski> val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun>
2025-05-12 05:54:28 +0200 <ski> # let fix f = (fun t -> t t) (fun t x -> f (t t) x);;
2025-05-12 05:53:53 +0200 <EvanR> uhg
2025-05-12 05:53:41 +0200 <monochrom> No, it's designed to be compatible with by-value evaluation.
2025-05-12 05:53:03 +0200 <EvanR> does the by value version need a different evaluation strategy
2025-05-12 05:52:27 +0200 <EvanR> ok but the point of a fix construct is so you don't have to munge these nuts combinators, and so they can have a type
2025-05-12 05:50:41 +0200 <monochrom> It is correct. :)
2025-05-12 05:50:26 +0200 <EvanR> I probably messed up
2025-05-12 05:50:16 +0200 <EvanR> \f -> (\t -> t t) (\x -> f (\v -> (x x v)))
2025-05-12 05:49:03 +0200 <ski> yea, i prefer adding in `(\t -> t t)' for the first part, no need to repeat something longer
2025-05-12 05:48:04 +0200 <EvanR> but yours is more explainable
2025-05-12 05:47:42 +0200 <EvanR> I found this on some page Z = \f -> (\x -> (f (\v -> (x x v)))) (\x -> (f (\v -> (x x v))))
2025-05-12 05:47:33 +0200michalz(~michalz@185.246.207.203)
2025-05-12 05:47:01 +0200 <monochrom> So it is missing out on fix (0 :) = 0 : 0 : ... but it's OK, call-by-value languages don't have lazy lists in the first place. :)
2025-05-12 05:45:43 +0200 <monochrom> Y is (\t -> t t) (\t -> f (t t)). For call-by-value languages we eta expand to (\t x -> f (t t) x) so one more argument is needed for evaluation so there is the delay I said we need.
2025-05-12 05:44:51 +0200Unicorn_Princess(~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection)
2025-05-12 05:44:20 +0200 <ski> (note the eta-expansion)
2025-05-12 05:43:00 +0200 <EvanR> I see
2025-05-12 05:42:06 +0200 <ski> it's the by-value fixed point combinator
2025-05-12 05:41:48 +0200 <EvanR> is that the Z combinator ski
2025-05-12 05:41:15 +0200 <monochrom> So you cannot make "fix (0 :) = 0 : 0 : ..." like in Haskell, but you can still make "fix (\f -> \n -> ... fibonacci ...)"
2025-05-12 05:39:40 +0200 <ski> fix f = (\t -> t t) (\t x -> f (t t) x)
2025-05-12 05:39:36 +0200 <monochrom> Even in call-by-value languages, lambdas are lazy in bodies, or at least delayed, i.e., "\x -> undefined" does not cause that undefined to be evaluated, only application "(\x -> undefined) 5" does. That little delay is leveraged to make fixed point combinators and emulation of laziness.
2025-05-12 05:39:33 +0200 <ski> fix :: ((a -> b) -> (a -> b)) -> (a -> b)
2025-05-12 05:38:16 +0200 <EvanR> how do all these languages get recursion without lazy evaluation
2025-05-12 05:36:21 +0200 <monochrom> True.
2025-05-12 05:28:34 +0200 <EvanR> or else evaluating fix f necessarily freezes
2025-05-12 05:28:03 +0200 <EvanR> true or false, to have a working fixed point construct for recursion, you need some kind of lazy evaluation
2025-05-12 05:27:43 +0200weary-traveler(~user@user/user363627) user363627
2025-05-12 05:27:18 +0200weary-traveler(~user@user/user363627) (Remote host closed the connection)
2025-05-12 05:22:59 +0200 <monochrom> :)
2025-05-12 05:18:32 +0200weary-traveler(~user@user/user363627) user363627
2025-05-12 05:02:25 +0200hughjfchen(~hughjfche@vmi2417424.contaboserver.net) hughjfchen
2025-05-12 05:01:10 +0200Taneb(~Taneb@2001:41c8:51:10d:aaaa:0:aaaa:0) Taneb
2025-05-12 05:00:54 +0200hughjfchen(~hughjfche@vmi2417424.contaboserver.net) (Quit: WeeChat 4.4.3)
2025-05-12 05:00:00 +0200Taneb0(~Taneb@2001:41c8:51:10d:aaaa:0:aaaa:0) (Quit: I seem to have stopped.)
2025-05-12 04:56:24 +0200Frostillicus(~Frostilli@pool-71-174-119-56.bstnma.fios.verizon.net)
2025-05-12 04:40:15 +0200aditya_an1l(~aditya_an@user/aditya-an1l:63825) aditya_an1l