Questions tagged [core.async]

A clojure/clojurescript library for asynchronous programming.

core.async is a clojure/clojurescript library to allow a model of asynchronous programming similar to that of the Go language.

229 questions
61
votes
5 answers

Comparing core.async and Functional Reactive Programming (+Rx)

I seem to be a little bit confused when comparing Clojure's core.async to the so called Reactive Extensions (Rx) and FRP in general. They seem to tackle similar problem of async-hronicity, so I wonder what are the principal differences and in what…
tillda
  • 16,950
  • 16
  • 48
  • 69
42
votes
6 answers

Isn't core.async contrary to Clojure principles?

I have seen many Clojure programmers enthusiastic about the new core.async library and, though it seems very interesting, I am having a hard time seeing how it conforms to Clojure principles, so I have these questions: It uses mutable state…
aeuhuea
  • 449
  • 4
  • 7
37
votes
1 answer

Can I make a fully non-blocking backend application with http-kit and core.async?

I'm wondering if it's possible to put together a fully non-blocking Clojure backend web application with http-kit. (Actually any Ring-compatible http server would be fine by me; I'm mentioning http-kit because it claims to have an event-driven,…
Valentin Waeselynck
  • 5,613
  • 22
  • 40
27
votes
1 answer

What is the advantage of core.async in clojurescript?

Everybody is talking about how great core.async is, and how it will improve event handling in clojurescript. I've been following the ClojureScript 101 tutorial, and I don't see any clear advantage from these code examples. What am I missing? Why is…
Imogen
  • 361
  • 3
  • 6
21
votes
1 answer

In Clojure (core.async) what's the difference between alts and alt?

I can't figure out the difference between: alts! and alt! in Clojure's core.async.
procr
  • 549
  • 4
  • 14
20
votes
1 answer

ClojureScript, Om and Core.async: How to handle events properly

I have had a look at using Om for rich client website design. This also is my first time using core.async. Reading the tutorial https://github.com/swannodette/om/wiki/Basic-Tutorial I have seen the usage of a core.async channel to handle the delete…
wirrbel
  • 2,859
  • 2
  • 19
  • 43
17
votes
4 answers

Rate limiting core.async channels in Clojure

I'm using Clojure with core.async, and have a situation where I want to put a rate limit on the number of messages processed through a channel. In particular I would like to: Define a rate limit e.g. 1,000 messages per second Handle messages…
mikera
  • 101,777
  • 23
  • 241
  • 402
16
votes
3 answers

How do I unit test clojure.core.async go macros?

I'm trying to write unit tests when using core.async go macros. Writing the test naively, as follows, appears that the code inside the go blocks doesn't get executed. (ns app.core-test (:require [clojure.test :refer :all] …
Hugh Powell
  • 285
  • 1
  • 9
15
votes
1 answer

Clojure how to stop all go blocks or close all channels in core.async

all to often when I'm using core.async from the repl a go block will get away from me because I loose the channel that is used to stop it because I reload a namespace. For instance if i run this from the repl: (go (when (not= c (second (async/alts!…
Arthur Ulfeldt
  • 87,736
  • 24
  • 197
  • 278
13
votes
4 answers

When to use core.async in Clojure?

When should I use Clojure's core.async library, what kind of applications need that kinda async thing? Clojure provides 4 basic mutable models like refs, agents, atoms and thread locals/vars. Can't these mutable references provide in any way what…
Ertuğrul Çetin
  • 4,779
  • 4
  • 28
  • 61
13
votes
1 answer

What's the difference between pub and mult in core.async? & a sample usecase?

I've been using core.async for some time, but avoided pub and mult, since I can't really grasp a useful usecase from their documentation. Specifically what's the purpose of the topic-fn and how would you use it in practice? Or maybe you can map a…
rene_gr
  • 479
  • 4
  • 11
12
votes
1 answer

Is Communicating Sequential Processes [CSP] an alternative to the actor model in Scala?

In a 1978 Paper by Hoare we have an idea called Communicating Sequential Processes. This is used by Go, Occam, and in Clojure in core.async. Is it possible to use CSP as an alternative to the Actor Model in Scala? (I'm seeing JCSP but I'm wondering…
hawkeye
  • 31,052
  • 27
  • 133
  • 271
11
votes
1 answer

Should clojure core.async channels be closed when not used anymore?

Close method (at least in java world) is something that you as a good citizen have to call when you are done using related resource. Somehow I automatically started to apply the same for the close! function from core.async library. These channels…
Viktor K.
  • 2,480
  • 2
  • 17
  • 28
10
votes
2 answers

How do I make a large number of concurrent HTTPS requests robustly in Clojure (/Java)

I have a stream of inputs and I want to make 2 HTTPS network requests for each before passing the result on to another part of the program. The typical throughput is 50 per second. for each input: HTTP request A HTTP request B pass event…
Joe
  • 42,600
  • 24
  • 134
  • 225
10
votes
1 answer

couldn't use for loop in go block of core.async?

I'm new to clojure core.async library, and I'm trying to understand it through experiment. But when I tried: (let [i (async/chan)] (async/go (doall (for [r [1 2 3]] (async/>! i r))))) it gives me a very strange exception: CompilerException…
xudifsd
  • 739
  • 4
  • 22
1
2 3
15 16