Fork me on GitHub
#clojure
<
2021-05-23
>
awb9905:05:23

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.

seancorfield06:05:09

@hoertlehner No, that is not possible.

seancorfield06:05:24

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.

seancorfield06:05:56

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

Noah Bogart17:05:49

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

vemv17:05:02

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

seancorfield20:05:19

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

vlaaad20:05:49

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

vemv21:05:26

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

seancorfield23:05:41

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

👍 3
Noah Bogart23:05:16

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.

seancorfield23:05:09

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.

👍 3
lassemaatta04:05:28

I was just about to reference the old .kkrieger game as a nice example of what people can do with just 96 kilobytes, but then I noticed that the game jam already references it as an inspiration 😄

Jakub Holý (HolyJak)20:05:03

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!

dpsutton20:05:31

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”

Jakub Holý (HolyJak)21:05:01

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

chrisulloa23:05:45

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]})