This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-22
Channels
- # announcements (1)
- # beginners (109)
- # boot (2)
- # calva (26)
- # cider (6)
- # circleci (6)
- # cljsrn (3)
- # clojure (77)
- # clojure-dev (5)
- # clojure-europe (28)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (21)
- # clojure-japan (13)
- # clojure-nl (36)
- # clojure-spec (22)
- # clojure-sweden (4)
- # clojure-uk (105)
- # clojurescript (91)
- # community-development (8)
- # cursive (60)
- # datascript (3)
- # datomic (4)
- # emacs (33)
- # fulcro (19)
- # graalvm (38)
- # hoplon (4)
- # instaparse (1)
- # jobs (1)
- # leiningen (22)
- # off-topic (14)
- # pathom (2)
- # perun (4)
- # planck (5)
- # re-frame (10)
- # reagent (1)
- # reitit (11)
- # rum (11)
- # shadow-cljs (97)
- # tools-deps (82)
- # vim (53)
dumb sente/ring question:
the chsk/handshake messaged received on the server from the client has a :uid
i asked for. i’d like :uid
to be in my handler map for all my POSTS, but it’s not there. have i misconfigured something? or do i not understand something about sente and ring?
Hello, I am newly working with the official docker image of "clojure" on docker hub. I have selected the following tag, "https://github.com/Quantisan/docker-clojure/blob/f4257cfa677af38c2f8a9cd0455747c9bee835ca/target/openjdk-8/debian/tools-deps/Dockerfile"
which is maintained by Kirill Chernyshov. I have successfully built the image, but when I try to run the image with a "-it", I am getting the following error,
I’m no longer maintainer of this image. And we had long discussion with original author of image about necessity to have rlwrap in alpine-based version here - https://github.com/Quantisan/docker-clojure/issues/55 .
So far I’m using this Dockerfile as a base image for our projects:
FROM openjdk:13-alpine
LABEL maintainer="Kirill Chernyshov <[email protected]>"
ENV CLOJURE_VERSION=1.10.0.442
WORKDIR /tmp
RUN apk add --update --no-cache bash curl
RUN wget \
&& chmod +x linux-install-$CLOJURE_VERSION.sh \
&& ./linux-install-$CLOJURE_VERSION.sh
RUN clojure -e "(clojure-version)"
CMD ["clojure"]
This is the smallest image that I manage to build
official in the sense that it is blessed by docker, not official in the sense that is blessed by clojure core I think
Yes, that is a fair assumption.
$ docker run -it 29e7f11ab2ae Please install rlwrap for command editing or use "clojure" instead. $
hmm, okay
Okay, one moment . .
OOOOh! I am a little new, sorry.
@ghadi One last question. Is there truly an issue with installing "rlwrap" within this image? As seen below:
yeah, the alpine package for rlwrap got hosed at some point, I know my team found a workaround but I forget how it worked
RUN apk del bash readline && \
apk add bash readline --no-cache --repository && \
apk add rlwrap --no-cache --repository
@pthornton apk doesn't exist in that docker image I linked -- it's a debian image
@ghadi oh- I overfit my problem onto his
unless you're using those containers as command line repls, I kind of dispute having rlwrap
in them
cmdline rlwrap is a pretty anemic interface, but sufficient for getting your feet wet with clojure
Quick dumb qustion, I have this line that works great (assoc-in @game [:players 0 :hand] [])
It replaces the existing hand with an empty vector. But when I try to do it with a swap!
it fails: (swap! game assoc-in [:players 0 :hand] [])
saying wrong number of args to assoc-in
.
My guess is that its due some sort of apply
Sorry. game
is an atom.
Hmmm...Simplified ones work here too.
But the more complex game
doesn't.
Hmmm...it seems as though my watch function doesn't like that.
Hah...Turns out it I had a bug in a watch function, that also had a assoc-in
and the error was from there. My bad all.
Hey guys, I've started with clojure a few weeks ago, and you helped me alot with it. I wrote an getting started article, to contribute to this community and spread the world. There's a shotout to Clojurians there 😄 https://medium.com/qualyteam-engineering/getting-started-with-clojure-acaa45d1039a
@ghadi Oh, you are right! I am begin moving across different images. Thanks for the clarity. You rock!
Where can I find a tutorial that explains in simple terms adding a clojars library to my project and incorporating it into existing code?
your dependency management tool should cover that in the very beginning of the documentation, it's covered in the top of the README for leiningen, boot, and deps-edn
@ruby.object The Clojure tools that read dependencies and build the classpath in order to run code (`clj`, lein
, boot
) all look for libraries on both Maven Central and Clojars, so they just need to know the "coordinates", e.g., seancorfield/next.jdbc
for the group/artifact ID of the library and then a version number as a string.
Pretty much all the books (and I would expect most of the Clojure tutorials online) should have an example of adding dependencies to a project. Mostly lein
-based I expect.
What books/tutorials have you looked at so far?
Under "Usage" it shows the coordinate that you'd use with Leiningen or Boot.
[pegasus "0.7.0"]
You have an existing project? Is it using Leiningen or Boot, or the clj
/ deps.edn
tools?
I have added it to dependencies in project.clj, but proceeding further is a mystery to me
OK, so once it is in your dependencies in project.clj
, the next time you start a REPL in that directory or run your project code, the library will be automatically fetched and cached locally.
Then you can require
it in your code, as the example shows.
The namespace is pegasus.core
, not pegasus
.
Per the Usage example
(ns pegasus.foo
(:require [pegasus.core :refer [crawl]]
[pegasus.dsl :refer :all])
(:import ( StringReader)))
The library coordinates are pegasus/pegasus
and a version number "0.7.0"
. The library contains a number of namespaces, pegasus.core
, pegasus.dsl
, etc.
(ns easy-crawler.core
(:require [pegasus.core :refer [crawl]]
[pegasus.dsl :refer :all])
(:import ( StringReader)))
your namespace is easy-crawler.core
their example is the (ns pegasus.foo
form in the #Usage section
you declare your namespace easy-crawler.core
and then the other namespaces that you will depend on.
I suspect CIDER is hiding the real problem here.
user=> (require 'pegasus.core)
Syntax error macroexpanding clojure.core/refer-clojure at (async.clj:9:1).
:as - failed: #{:exclude} at: [:exclude :op :quoted-spec :spec]
:as - failed: #{:only} at: [:only :op :quoted-spec :spec]
:as - failed: #{:rename} at: [:rename :op :quoted-spec :spec]
(quote :as) - failed: #{:exclude} at: [:exclude :op :spec]
(quote :as) - failed: #{:only} at: [:only :op :spec]
(quote :as) - failed: #{:rename} at: [:rename :op :spec]
Pegasus is relying on outdated versions of libraries that are not compatible with Clojure 1.9/1.10 with the stricter syntax for ns
.
Add the following dependency: [org.clojure/core.async "0.4.490"]
(! 677)-> clj -Sdeps '{:deps {pegasus {:mvn/version "0.7.0"} org.clojure/core.async {:mvn/version "RELEASE"}}}'
Clojure 1.10.0
user=> (require 'pegasus.core)
WARNING: pos-int? already refers to: #'clojure.core/pos-int? in namespace: taoensso.encore, being replaced by: #'taoensso.encore/pos-int?
WARNING: bytes? already refers to: #'clojure.core/bytes? in namespace: taoensso.encore, being replaced by: #'taoensso.encore/bytes?
WARNING: Inst already refers to: #'clojure.core/Inst in namespace: schema.core, being replaced by: #'schema.core/Inst
nil
user=>
So Pegasus 0.7.0 should work with the latest core.async
(which is 0.4.490 -- I was just being lazy with RELEASE
)You may need to explicitly add up-to-date versions of other things Pegasus relies on, but that should get you moving forward.
could it be simpler just to give up on pegasus and try other library that works with contemporary clojure?
Maybe. I see a number of open, unanswered issues in the Pegasus repo that are three years old which suggests the maintainer stopped working on it -- so it hasn't been updated to the latest versions of Clojure or other libraries.
That builds on CircleCI are failing? Yes. It looks like it is still using CircleCI's 1.0 config and that's outdated (builds seem to be failing due to HTTPS protocol issues).
does clojars attempt to indicate which libraries are not working and should be deprecated?
Clojars is "just" a repository -- it doesn't know much about its contents.
And old versions never get removed -- because if someone is depending on them it would break their builds.
(That's true of any repository for any language)
Yes, Elm has a very deeply coupled ecosystem and can use checkers to see if library versions are compatible or not.
I will try https://github.com/owainlewis/athena and disappear for a while, thank you for your help
Clojure builds on the Java/JVM world so it uses the "same" system as all the other JVM languages in terms of libraries and versions...
Feel free to ask any questions here, to avoid days of frustration!
Athena hasn't been updated since Clojure 1.6 so you may run into problems with that too.
And it uses an even older version of core.async
than Pegasus.
That said, at least athena.core
loads
(! 680)-> clj -Sdeps '{:deps {athena {:mvn/version "RELEASE"}}}'
Clojure 1.10.0
user=> (require 'athena.core)
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/boolean?
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/boolean?
WARNING: bounded-count already refers to: #'clojure.core/bounded-count in namespace: clojure.core.async, being replaced by: #'clojure.core.async/bounded-count
nil
user=>
(version 1.0.6)
It's OK - I just spent 45 minutes running cucumber smoke tests against an app that had gone down and wondering why my tests were failing when they passed just before...
non-deterministic tests?
they are smoke tests, so they rely on the remote service being up
instead of checking if the service was still running, I dug deep into why the tests might be flaky
And it's even more ancient than athena 🙂 But that just goes to show that some very old, unmaintained libraries are just fine to use!