missionary

whilo 2024-11-22T08:51:41.201389Z

Out of curiosity, is there a way to reach through missionary into the cloroutine expansions to install further breaks, e.g. to control randomness? I guess I can just do that separately, but since missionary is already recompiling Clojure it might be nice to be able to extend it. In other words could there be a language tower on top of missionary?

Vincent 2024-12-03T04:04:01.080579Z

what's wrong with starting with a superficial understanding and working backwards? isn't that how we all become experts anyway?

Hendrik 2024-11-22T08:57:51.998349Z

I guess that this is possible. And I think, that you enter a rabbit hole, where it is really hard to understand the code and what it does. What do you want to achieve? What do you mean with “control randomness”?

whilo 2024-11-22T09:08:58.691249Z

I am the master or rabbit holes unfortunately 😉 . I am the maintainer of https://probprog.github.io/anglican/ and I was thinking about replacing its more limited CPS transform compiler to use cloroutine. I agree that it is easy to create a mess with Lisp and meta-programming, but I do think the Clojure community would benefit from more directly exploring ideas from the PL community, for example Racket. Barely anybody from the PL world I talk to knows much about Clojure or would consider doing research in it. The pragmatism of Clojure is good to keep the ecosystem straight, but there is also not much radical happening for a Lisp. I was just checking barliman again, the Scheme community has a lot of good ideation. Anyway, this is a tangent...

whilo 2024-11-22T09:15:14.011149Z

I have some more crazy ideas in the direction of JIT compilation and online rewrites of the code for inference purposes (i.e. running your program in reverse or speeding up simulations/executions through approximations/shortcuts). In Clojure many people like logic programming a la Datalog (I also maintain Datahike), these ideas can to a degree also be applied to use programs with different variables assigned and being free. Probabilistic programming is doing this with weighted measures, which is arguably the most general setting.

whilo 2024-11-22T09:18:49.021259Z

I am trying to figure out whether one could build an OpenAI competitor on this set of ideas, but honestly it is hard to find people for that. They either only do deep learning or they have a superficial understanding of it, but are good programmers. I have been prototyping an AI engine that can do things like screen recording and automatic task execution https://simm.is/screen/491680819, and I am currently porting it to Electric and missionary, among other things.

whilo 2024-11-22T09:19:13.805169Z

(maybe that helps, maybe it just looks like rabbit holing)

Hendrik 2024-11-22T10:30:41.087219Z

woah, I was expecting something in the direction of derterministic programming. Really impressive stuff 🙂 Cloroutine might be a good fit for CPS. As far as I know missionary does not recompile clojure. Only cloroutine does. And cloroutine is only used in a few places in missionary. Namely ap, sp, and cp macros.

whilo 2024-11-22T16:53:01.288469Z

Right. A friend of mine worked on https://www.tweag.io/blog/2023-10-12-rhine-bayes/. They integrated FRP through monad transformers. I think Haskell is beautiful because in the end everything is defined just through a few algebraic expressions and structures (at least rhine bayes was beautiful to look at). I think Clojure could be more like this without enforcing a rigid type checker, e.g. by offering a wide range of standard protocols (type classes) for basic algebraic operations (monoids, groups etc.) and construction of algebraic data types. It might not fit the community well, but I think there is value in learning to think that way. I agree with Rich Hickey's specific takes on the Maybe monad in "maybe not", but I think the overall attitude towards algebraic thinking in the Clojure community limits its conciseness a bit. There is also considerable progress in this space, that is neglected under the notion that verification is not worth it.

Andrew Wilcox 2024-11-22T00:32:54.666419Z

Why does (m/? (m/reduce conj (m/stream (m/seed [])))) hang?

leonoel 2024-11-22T10:45:17.291319Z

likely a bug https://github.com/leonoel/missionary/issues/98

Andrew Wilcox 2024-11-22T02:03:21.732629Z

In an m/ap I need to run some cleanup code after termination, including after being canceled. (m/ap (try ... m/?> ... (finally (cleanup))) calls cleanup after each value produced by the m/?>, so that's not what I want. What's the right way to do this? Alternatively I could wrap the m/ap in something that would call the cleanup after the flow terminated, if that would be easier.

leonoel 2024-11-22T10:51:27.930339Z

This pattern works

(m/ap
  (let [resource (m/?> (m/observe
                         (fn [!]
                           (! (<init-resource>))
                           #(<dispose-resource>))))]
    (<use-resource> resource)))