Transducers in OCaml?

I have three questions related to transducers (http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming).

I found two transducer libraries for OCaml in Github, but none in opam. Do I miss another implementation, say in a big library?

I think it is not a nice way that I grab these Github libraries, put into my software and publish it. However, from the user point of view, doing this would be nice. What is your opinion?

Finally, I think transducers are worth to have, and I want to see an implementation usable across OCaml projects. Is there anyone interested in making an opam-available version of them?

Best,

2 Likes

Came here via Google, and the same search brought at least a couple implementations in OCaml:


But maybe you’ve heard of them by now. And anyway, I haven’t tried either of them yet.

Hi! I’m the author of one of the mentioned libraries. I must admit that I wrote it initially as an experiment while learning transducers, that’s why I didn’t publish it to opam.

While I belive that transducers are a very interesting and powerful iteration model, in practice most people will probably use something simpler, like the sequence or gen libraries from opam. The former being conceptually similar to transducers (i.e. it’s a push-based model). Of course there’s always room for a new model. I’m curious, what is your use case for transducers in OCaml?

Regarding your last question: given your interest, I would be glad to revive the project and publish it officially to opam. I opned an issue to track this.

If you think the library could be improved somehow, both suggestions and contributions are welcome!

1 Like

I like people who take their automata seriously :slight_smile:

1 Like

I just had a look at the nice talk by Rich Hickey linked above. After watching it, transducers seemed to be a pretty natural and useful abstraction. But your comment reminded me that sequences basically solve the same problem: The combinatorial explosion of fold-like functions applied to (one or a pair of) container data types. It seems that transducers solve the problem by parametrizing on the collection type whereas sequences solve the problem by introducing a unifying ‘connector’ datatype. So now I really wonder if all that a transducer does can also be done by converting a collection to a Seq.t, applying Seq.fold etc. to that and converting back. Or is there a fundamental difference that I am missing?