Fork me on GitHub
#clojure
<
2020-09-14
>
borkdude07:09:17

When implementing an interface / protocol with multiple overloads in defrecord / reify this readme https://clojure.org/reference/protocols seems to suggest writing (foo [ ] ...) multiple times. But later on in the readme I see:

(extend-type MyType
  Countable
    (cnt [c] ...)
  Foo
    (bar [x y] ...)
    (baz ([x] ...) ([x y zs] ...)))
What's the official syntax?

hiredman07:09:17

It isn't the same for extend type vs reify or defrecord

hiredman07:09:48

For defrecord / deftype you do a method per arity (like java without types, because it ends up generating methods for each), for extend type it is like fns with a different body per arity because it actually macro expands to a fn

Lone Ranger15:09:14

Can anyone recommend a Clojure product/library/tool similar to Python's celery (aka task execution from a queue -- https://docs.celeryproject.org/en/stable/getting-started/introduction.html). Or does everyone just kind of roll their own for that sort of work in Clojure?

emccue15:09:31

I think you can just use celery

emccue15:09:54

I haven't gone far enough to know what to recommend, but my money is on there being pretty robust Java solutions you can use

emccue15:09:28

quartz or whatever the heck

lukasz16:09:49

@U3BALC2HH are you planning to use RabbitMQ? Is celery compatibility required (e.g. you have python publishers/consumers)?

Lone Ranger16:09:39

no, just looking for similar conceptual functionality

p-himik16:09:34

After a few years with Celery, I would not recommend it to anyone. :) But I got pretty bitter with the whole Python ecosytem. With that being said, I couldn't find any complete replacement. Here are some links with similar/related stuff that I've gathered, maybe they will be helpful: - http://immutant.org/documentation/current/apidoc/immutant.messaging.pipeline.html - http://www.quartz-scheduler.org/ - https://github.com/prepor/twarc - https://redisson.org/ - https://github.com/gresrun/jesque - https://github.com/apache/storm - http://www.onyxplatform.org/

🔥 9
Lone Ranger16:09:57

@U2FRKM4TW agreed re:Celery 😉 Dang awesome list or resources!!

lukasz16:09:53

We have built our own RabbitMQ library/component https://github.com/nomnom-insights/nomnom.bunnicula - currently processing millions of jobs every day

p-himik17:09:19

Does it handle computation DAGs?

lukasz19:09:31

@U2FRKM4TW no, it's a "simple" job publisher/consumer thing. DAGs etc are out of scope (not sure how it would all work to be honest, it's not something we need, at least as a "hard" concept)

👍 3
Franklin20:09:15

Hey, I'm trying to upgdate my dependencies with lein ancient and I keep getting this: "Syntax error compiling var at (midje/util/exceptions.clj:75:3).\nUnable to resolve var: aviso.exception/traditional in this context\n"

Franklin20:09:27

Does anyone know how this could be fixed?

seancorfield20:09:24

@franklineapiyo Sounds like a version conflict between one or more libraries. Do you have stuff in your ~/.lein/profiles.clj file? That's often the most common cause of problems with Leiningen.

Franklin20:09:59

Yes I do. bu the only thing in there is {:user {:plugins [[lein-ancient "0.6.15"]]}}

seancorfield20:09:03

And you're getting the exception from lein ancient itself? Or when you try to run the project after it has updated it?

seancorfield20:09:24

(or are you just trying to get a report of outdated dependencies to update them yourself?)

Franklin20:09:15

I'm getting this from just running lein ancient

Franklin20:09:21

I've tried to run lein ancient interactive mode and this only happens when I try to upgrade midje, clojure or dk.ative/docjure

Franklin20:09:50

trying to upgrade any one of them or all of them at the same time causes this error

dpsutton20:09:05

not sure if this will help, but try lein with-profile -dev [whatever goes here]

Franklin20:09:57

Running that... I get Reflection warning, dk/ative/docjure/spreadsheet.clj:642:17 - call to org.apache.poi.ss.util.CellReference ctor can't be resolved.

seancorfield20:09:11

You could just update these things manually -- but the problem looks like recent versions of Midje depend on that var, which was introduced in Aviso Pretty 0.1.15, which all happened a few years ago.

seancorfield20:09:03

I don't really trust any tools that try to update my project configuration "automatically"...

Franklin20:09:37

But @seancorfield, I don't see Aviso Pretty anywhere in my project.clj... I'm a bit of a newb.. how should I update something that isn't in my project.clj... I think it's a dependency of something that's in my dependencies correct?

seancorfield20:09:48

Part of me feels like saying "Stop using Midje -- that's part of your problem"... 🙂

seancorfield20:09:57

Since this is probably going to be a fair bit of hand-holding to get to the bottom of this and you're fairly new to Clojure, perhaps share your project.clj file in #beginners where folks have opted in to spending more time digging into basic problems like this (I'm happy to continue digging into it in #beginners )

seancorfield20:09:58

(there's an expectation in this channel that you can mostly debug dependency conflicts on your own)