clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
raspasov 2021-05-23T00:04:43.280400Z

From a brief look at the code, rets acts like many “boxes” that receives different values. They are used in the (go-loop …) in the same fn. So I believe they actually need to be different instances rather than the same instance. (but I could be misunderstanding the code)

raspasov 2021-05-23T00:06:40.280600Z

done are a vector of callback functions that each take ret

raspasov 2021-05-23T00:11:13.280800Z

I feel like I’d need to spend a bit of time with that code to understand the intent there. I might be totally off. Is the copyOf causing a problem for you?

awb99 2021-05-23T05:50:23.284Z

I have several alias in deps.edn. Is it possible that an alias refers to another alias? So I want to makeasecond alias that changes the params passed to the first alias. leiningen can do this, and wondering if deps can do it too.

seancorfield 2021-05-23T06:30:09.284400Z

@hoertlehner No, that is not possible.

seancorfield 2021-05-23T06:31:24.285900Z

Aliases can be “data” but only certain places can accept an alias instead of data: :exec-args can be an alias that refers to data, some tools like depstar and deps-deploy support exec args that are aliases and substitute their values.

awb99 2021-05-23T20:56:59.293100Z

thanks @seancorfield

seancorfield 2021-05-23T06:31:56.286400Z

:paths and :extra-paths can also accept aliases and look them up as data.

NoahTheDuke 2021-05-23T17:11:49.289300Z

Are there any resources on making small jars? I wanna participate in the 4MB Game Jam and would prefer to use Clojure

vemv 2021-05-23T17:21:02.289400Z

have you tried avoiding AOT compilation? i.e. your jar (uberjar?) will include only .clj files

seancorfield 2021-05-23T20:09:19.289700Z

You'll still need Clojure's runtime itself which is about 4MB on its own I believe?

vlaaad 2021-05-23T20:10:49.290200Z

maybe cljs compiled to js and gzipped could yield <4mb

Jakub Holý 2021-05-23T20:35:03.291300Z

Hi! Is there a nicer way to go from {:a [1 2 3] :b [4]} to {1 :a, 2 :a, .., 4 :b} then this rather manual:

(into {}
    (for [[k vs] {:a [1 2 3] :b [4]}
          v      vs]
      [v k]))
? Thank you!

dpsutton 2021-05-23T20:40:31.293Z

Looks pretty straight forward to me. Only thing to think about is what to do with duplicate values in the keys in the original maps. If those are possible, and if so, who “wins”

vemv 2021-05-23T21:26:26.293400Z

a .jar doesn't have to include the clojure runtime. it can include merely the game sources/assets and then the users would add the clojure runtime to the classpath (it's a .jar) so one would build a classpath of two .jars perhaps a more friendly and "official-looking" approach would involve the clojure cli tool, so that one only adds the game .jar

Jakub Holý 2021-05-23T21:37:01.293900Z

Thx! Good point! But in this case, duplicates do not occur.

seancorfield 2021-05-23T23:15:41.294200Z

I wasn’t sure what the restrictions were in “4MB Game Jam” (I’d never heard of it until @nbtheduke mentioned it here).

👍 1
NoahTheDuke 2021-05-23T23:17:16.295900Z

Since asking I’ve found out I’d have to include the JRE in the 4MB limit, which makes this whole thing much harder. Think I’ll try Lua instead.

seancorfield 2021-05-23T23:19:09.296600Z

Yeah, I just Bing’d it and saw the Reddit thread where they explicitly say that HTML5 and browser-based stuff is out, and anything on the JVM is out, since the entire runtime must be counted in the 4MB — which deliberately excludes a lot of game engines too.

👍 1
chrisulloa 2021-05-23T23:25:45.297600Z

it’s really not any cleaner than your solution but this came to mind

(reduce-kv (fn [m k vs] (into m (for [v vs] {v k}))) {} {:a [1 2 3] :b [4]})