This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-26
Channels
- # announcements (4)
- # babashka (5)
- # beginners (11)
- # clj-kondo (4)
- # clojure-bay-area (1)
- # clojure-dev (8)
- # clojure-europe (4)
- # clojure-norway (10)
- # conjure (2)
- # datomic (12)
- # emacs (3)
- # hyperfiddle (5)
- # jobs-discuss (26)
- # lsp (55)
- # observability (3)
- # overtone (1)
- # portal (5)
- # practicalli (1)
- # sql (11)
- # xtdb (8)
what are some use cases for core.async? I want to try using it in a project but am not sure what kind of programs it's best for
Anything you can model as a production line can be built using core.async pipelines You can also use them to parallelize transducing operations It's also convenient for asynchronous programming with channels rather than promises and having to enjoy callback hell
@U05PEDP7J85 when working with asynchronous APIs (pretty common in JS land, less common in JVM) you can use it to write synchronous looking code that uses those. On the other side, if you have a synchronous piece of code that you would like to make async for decoupling the caller from the processing parts via buffered channels. If you have something that can benefit from multi-threading you can use core.async also to implement some adhoc actor model, where you spin multiple threads with isolated state and they communicate with each other by sending messages over channels, like producers - consumers.
Thanks! I think I'll try doing some parallel data processing.
A fun use case is if you're using some queueing system or distributed log like Kafka, then you can process the records in parallel
Agreed with the above! https://tilton.medium.com/backpressure-99501f23881f
no, if you have same class from different packages, you will need to use the fully-qualified class name for one of them
oh and to other beginners avoid llms. I asked and got a very wrong answer.
(ns your-namespace
(:import [java.util HashMap]
[java.util.concurrent Executors]
[java.util.regex Pattern]
[http://java.io File]
[java.time LocalDate :as Date]))