2025/03/21

Newest at the top

2025-03-21 23:15:41 +0100 <mauke> monochrom: you say square_cps1 is mixing styles because (*) is not in CPS, but mul_cps is also mixing styles because currying
2025-03-21 23:13:31 +0100alfiee(~alfiee@user/alfiee) alfiee
2025-03-21 23:12:12 +0100ski. o O ( "Yield: Mainstream Delimited Continuations" by Roshan P. James,Amr Sabry in 2009 (?) at <https://www.cs.indiana.edu/~sabry/papers/yield.pdf> )
2025-03-21 23:12:03 +0100wootehfoot(~wootehfoo@user/wootehfoot) wootehfoot
2025-03-21 23:11:52 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-03-21 23:10:57 +0100 <ski> Manager) (which might also work in MLton, i don't recall if i tried))
2025-03-21 23:10:51 +0100 <ski> for monadic reflection, see "Representing Monads" in 1994-01 and "Representing Layered Monads" in 1999-01, both by Andrzej Filinski, at <http://hjemmesider.diku.dk/~andrzej/papers/>. at some point, i typed in the code in the papers, which you can access at <https://0x0.st/HOHX.tar.gz>,<https://0x0.st/HOH8.tar.gz> (see `starting-points.txt' for how to run, using either SML/NJ directly, or its CM (Compilation
2025-03-21 23:10:48 +0100ash3en(~Thunderbi@89.56.182.235) (Quit: ash3en)
2025-03-21 23:08:01 +0100 <mauke> I don't believe in python
2025-03-21 23:07:22 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-21 23:07:05 +0100 <monochrom> https://www.vex.net/~trebla/haskell/cont.xhtml#yield
2025-03-21 23:06:39 +0100 <monochrom> But I have one readable use of shift-reset. If you accept that Python's yield is readable in some cases, then it's shift-reset when I do that in Haskell. :)
2025-03-21 22:59:00 +0100 <ski> rather than always be passing around continuations everywhere, and not as clearly being able to notice when they're being used "unconventionally". as well as the continuation-passing cluttering up (and turning inside-out) the code, in general
2025-03-21 22:57:57 +0100 <ski> making the "special cases", when you resort to `reset' and `shift', stand out more
2025-03-21 22:57:40 +0100 <ski> yes, exactly
2025-03-21 22:57:28 +0100 <monochrom> Oh I think the readable part comes from trying to be in direct style most of the time, rather than the shift-reset part.
2025-03-21 22:57:19 +0100 <mauke> do any of those not break my brain?
2025-03-21 22:57:18 +0100 <ski> nqCPS code, generally, mauke. `Codensity' does something similar (in terms of nqCPS) (albeit without side-effects), in Haskell
2025-03-21 22:55:56 +0100 <ski> collect the results, delimiting the extent of the side-effects)
2025-03-21 22:55:50 +0100 <ski> one could quite possibly have used instead `reify' and `reflect' primitives of Filinski's "Monadic Reflection", for a non-deterministic monad, in place of `shift' and `reset'. or `fail' and `amb' (disjunction, like `(<|>)') operations for the non-determinism monad, implemented in terms of `reflect' (`reify' (or a `collect' operation defined in terms of it) is used at the toplevel of the computation, to
2025-03-21 22:55:02 +0100weary-traveler(~user@user/user363627) (Remote host closed the connection)
2025-03-21 22:54:14 +0100 <mauke> I wonder what kind of code gets more readable by the addition of shift/reset
2025-03-21 22:53:55 +0100 <ski> (but in this context, it would be contrasting with CPS (or nqCPS))
2025-03-21 22:53:35 +0100 <ski> or whichever "style" you're contrasting with
2025-03-21 22:53:34 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-03-21 22:53:26 +0100 <ski> yes. or when you don't use state-threading style. or you don't use short-circuiting
2025-03-21 22:53:16 +0100pavonia(~user@user/siracusa) siracusa
2025-03-21 22:53:00 +0100 <monochrom> is when you don't use CPS :)
2025-03-21 22:52:39 +0100 <EvanR> direct style?
2025-03-21 22:52:12 +0100 <ski> ocasional call to `shift' and `reset' inserted, making the code more readable
2025-03-21 22:52:06 +0100 <ski> this example was written in CPS (success and failure continuation), but the staging of it became nqCPS, because of the inserted quasiquotation and unquotation, meaning that you often had to construct new code fragments, splicing recursive results into them, rather than doing tail-calls. however, MetaML also had support for composable continuations, so i converted the example into DS (Direct Style), with the
2025-03-21 22:51:21 +0100wildsalander(~wildsalan@81-175-155-97.bb.dnainternet.fi) (Ping timeout: 246 seconds)
2025-03-21 22:51:03 +0100califax(~califax@user/califx) califx
2025-03-21 22:50:39 +0100califax(~califax@user/califx) (Remote host closed the connection)
2025-03-21 22:50:01 +0100 <ski> i recall at some point looking at an example of staged computation, in MetaML, which interpreted a description of a regex, matching on an input string. the staging on it walked over the description, converting it to a piece of code (not too dissimilar to `Expr' or `TExpr' in TH) that when executed would more efficiently match on input strings (without having to re-interpret the regex all the time)
2025-03-21 22:48:18 +0100j1n37(~j1n37@user/j1n37) j1n37
2025-03-21 22:47:57 +0100 <ski> (undelimited) continuation effects, and a single piece of mutable state)
2025-03-21 22:47:51 +0100 <ski> there is something called "nqCPS", which is related to composable/delimited/sub- continuations .. and also to Andrzej Filinski's notion of "monadic reflection", which allows you to turn any (computable) implementation of a monad (like we do in Haskell, e.g.), into an actual corresponding side-effect in the language, assuming only we have composable continuation side-effects (or, equivalently, ordinary
2025-03-21 22:47:21 +0100gmg(~user@user/gehmehgeh) gehmehgeh
2025-03-21 22:47:19 +0100 <EvanR> mauke, I will forward my check from elon to this when I get it
2025-03-21 22:46:55 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-21 22:46:05 +0100 <ski> "not quite"
2025-03-21 22:45:10 +0100 <EvanR> "nq" ?
2025-03-21 22:44:29 +0100j1n37(~j1n37@user/j1n37) (Read error: Connection reset by peer)
2025-03-21 22:44:19 +0100 <mauke> https://www.gofundme.com/f/haskell-infrastructure-overhaul
2025-03-21 22:44:05 +0100 <ski> (programming with `(>>=)' already is a kind of CPS, although commonly "nq")
2025-03-21 22:42:30 +0100 <ski> dminuoso : well .. i kinda sorta approve ..
2025-03-21 22:41:53 +0100 <ski> this coheres with the Prolog roots of Erlang, where `,' means conjunction, which is commutative (although Prolog, unlike e.g. Mercury, does have side-effecting logical formulae (goals), which break commutativity)
2025-03-21 22:40:47 +0100 <ski> Erlang doesn't permit this, will do matching on the second time in `X = foo(),X = bar(X,T)', to check that the two results are equal
2025-03-21 22:40:06 +0100 <ski> EvanR : "keep \"assigning\" to the same variable over and over" -- yes