clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
Chris K 2020-10-05T00:17:53.498300Z

@smith.adriane I want to try making a productivity app with stuff like timers, and way to store notes

phronmophobic 2020-10-05T00:20:43.499200Z

is the app for personal use or will it be distributed to other users?

Chris K 2020-10-05T02:45:49.499900Z

@smith.adriane I want to try a personal one

phronmophobic 2020-10-05T02:50:50.000100Z

i'm not exactly sure why cljfx wasn't a good fit, but it seems like it could work in principle. the folks in #cljfx are pretty responsive if you have questions. if you have cljs experience, an electron app is pretty straightforward. I would recommend something like https://github.com/Day8/re-frame (#re-frame for questions) as an overall framework, browser apis for timing, and then use the https://nodejs.org/docs/latest-v13.x/api/for storage.

devn 2020-10-05T06:02:31.002Z

@dominicm You may be interested in https://github.com/contribsys/faktory — It’s not in the Java ecosystem, but I would choose this over Quartz or somesuch.

devn 2020-10-05T06:04:13.003200Z

I have not read any of this code, but there are at least a couple of examples of people creating little interfaces in clojure. Here’s one: https://github.com/apa512/clj-faktory

apa512 2020-10-05T13:25:15.004Z

I built it after failing to find anything in Clojure that worked like Sidekiq. If anyone wants to try it, it's probably better to look at the tests than the readme.

Chris K 2020-10-05T06:37:29.003400Z

@smith.adriane Thanks a lot

dominicm 2020-10-05T06:57:12.003600Z

Looks useful, thanks!

mashimom 2020-10-05T14:00:05.007300Z

Quick question I need to perform a function on two sequences/vectors A B, for every item on A with every item on B and collect the results. I know map will operate on nth of A and nth of B, I need A0 to B0, A0-Bn...

✅ 1
2020-10-05T14:01:31.007900Z

(for [a-alem A, b-elem B] (some-expression involving a-alem b-elem here))

👍 2
Karol Wójcik 2020-10-05T16:26:41.009400Z

Is it possible to inherit deps from another alias in deps.edn?

borkdude 2020-10-05T16:44:44.010900Z

@karol.wojcik Not in deps.edn itself, only from the command line you can merge alias deps together

borkdude 2020-10-05T16:45:12.011400Z

There was a conversation about this recently in #tools-deps - there might be something like this one day

Karol Wójcik 2020-10-05T16:46:08.012100Z

Actually that would be useful for convenience, but I know that allowing it would cause a mess in classpath.

practicalli-john 2020-10-06T10:21:00.036500Z

As mentioned, combining deps in the command can be an effective way to define separate aliases and merge them together, eg. clojure -M:env/dev:repl/rebel merging the dev alias to set up the dev class path and the rebel alias to run the Rebel UI. Some more examples: https://github.com/practicalli/clojure-deps-edn#repl-experience

borkdude 2020-10-05T16:47:21.012300Z

You're not the first to ask

😄 1
kenny 2020-10-05T20:54:59.015400Z

Is there a preference between returning a) {k v} versus b) [k v] from map when using into? I have always used the latter. Seems like there may also be some perf considerations. Have done absolutely zero testing in that regard. For example...

(into {}
  (map (fn [[x y]]
         ;; A
         {x y}
         ;; B
         [x y]))
  my-coll)

bastilla 2020-10-05T20:58:46.017400Z

Guys, color me shocked. I just found this strange behaviour:

Clojure 1.10.1
user=> (contains? [1 2 3] 1)
true
user=> (contains? [1 2 3] 2)
true
user=> (contains? [1 2 3] 3)
false
Maybe I should post in #beginners. But how on earth can this be correct?? Please enlighten me. Thanks!!!!

dpsutton 2020-10-05T21:00:18.018300Z

common question. check (doc contains?) > Returns true if key is present in the given collection, ... vectors are associative collections from index to value. The docstring walks through this as well

bastilla 2020-10-05T21:01:12.018900Z

@https://app.slack.com/team/U11BV7MTK Thanks! As I said, maybe I should have posted in #beginners :;)

dpsutton 2020-10-05T21:02:15.019400Z

next time 🙂 buts its a common question. you're not the first. probably not the last to ask either 🙂

bastilla 2020-10-05T21:03:02.020200Z

lol, okay. Sry for bugging you for the nth-time. Btw, awesome community here

dpsutton 2020-10-05T21:03:22.020300Z

never a bother!

dpsutton 2020-10-05T21:03:34.020500Z

if i don't have time i don't answer.

bastilla 2020-10-05T21:03:57.020700Z

yes, fair enough

2020-10-05T21:12:58.022Z

Is there a reason deps does not capture the project name like lein did? Is the current approach to just maintain your own pom.xml?

seancorfield 2020-10-05T21:28:37.023200Z

@shaunxcode For now, yes, but Cognitect have talked about an upcoming tools.build project that we might reasonably expect to address that issue somehow...

seancorfield 2020-10-05T21:29:35.024300Z

(they've said almost nothing publicly about tools.build but given that pom.xml generation/sync'ing is already part of the Clojure CLI to some degree, we might assume they would enhance that in future tooling)

2020-10-05T21:36:55.024900Z

cool I look forward to that! For the time being I will just have a skeletal project.clj I use for lein deploy etc.