This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-31
Channels
- # announcements (3)
- # beginners (139)
- # boot (28)
- # cider (40)
- # cljdoc (1)
- # cljs-dev (30)
- # clojure (61)
- # clojure-conj (1)
- # clojure-dev (113)
- # clojure-germany (4)
- # clojure-italy (29)
- # clojure-nl (3)
- # clojure-russia (2)
- # clojure-spec (38)
- # clojure-uk (53)
- # clojurescript (188)
- # core-async (4)
- # css (2)
- # cursive (7)
- # data-science (5)
- # datomic (14)
- # emacs (1)
- # figwheel-main (192)
- # fulcro (37)
- # jobs-discuss (1)
- # mount (4)
- # off-topic (47)
- # pedestal (7)
- # portkey (14)
- # re-frame (4)
- # reagent (22)
- # reitit (2)
- # remote-jobs (1)
- # ring (6)
- # shadow-cljs (65)
- # spacemacs (7)
- # specter (6)
- # yada (8)
what is the idiomatic way to iterate over HTMLCollection and NodeList in cljs? I'm surprised it doesn't work out of the box
https://cljs.github.io/api/cljs.core/array-seq or
(extend-type js/NodeList
ISeqable
(-seq [array] (array-seq array 0)))
Thing is that Emacs and Vim have a rather steep learning curve. (Example: Yesterday I wanted to install the Clojure Layer to Spacemacs, and now the editor can not even start correctly anymore because of some error. I am sure it would take me hours to debug that. Calva for VS Code, on the other hand, worked out of the box.) So easier alternatives are good for starters with Clojure.
I wonder if Spacemacs is a bit more fragile? I've hardly had any issues with vanilla emacs, even after maintaining 3 or 4 configurations spread across a few computers over the years with varied package stacks, but Spacemacs seemed to break a lot right away when I tried it (not saying its like that, just that in my limited experience it was).
As a beginner (1-2yo experience), i could say .. start with emacs not so good idea. I used many editors, VScode etc.. in the first half year with terminal/repl, after this switched to intellij/ cursive which i use now too. Since 2-3 months ago i can use emacs in good way, i know when is that emacs ‘bug’ (i did smthg wrong) or clojure code fail. So as you see, that is learning path. I did a mistake, i started with emacs.. that is killer for beginners
I agree. I think this is a downside of that Clojure for the Brave and True book. It wants to sell you Clojure and Emacs in a bundle.
I think the fragility of Spacemacs is due to the fact that the packages are loaded from MELPA and not from MELPA stable. But right now the Clojure-Layer from Spacemacs seems not to get well along with the latest Cider version. I think Spacemacs has a solution for this problem in their upcoming version (0.300), where they introduce some sort of stable repo for the packages. Hence, until the release of Spacemacs 0.300 I’d consider Clojure to be broken for Spacemacs (unless you use Spacemacs’ devel-branch, or you manually pin the cider packages to MELPA-stable).
This is correct from my understanding. They need to fix this fast, because for beginners this makes Spacemacs nearly unusable without hours of hacking around in its config. I want it to work so much, but everytime I try I am back to VSCode after 30 minutes.
If I want to make a one page clojurescript app that runs entirely in the browser, what should I use? reagent?
Other persons here pointed me out to Re-Frame, which is based on Reagent. https://github.com/Day8/re-frame
@coinedtalk There are a few alternatives, but my personal favorite for that purpose is reagent (take a look at re-frame too after you've learned the ropes in reagent, it brings some very nice structure to the application)
Hi Clojurians, I’m having hard time updating record via HugSQL. SQL:
-- :name update-person! :! :n
-- :doc updates an existing person record
UPDATE persons
SET first_name = :first_name, last_name = :last_name
WHERE id = :id
Code:
(db/update-person! {:id 15 :first_name "F" :last_name "L"})
Error:
ExceptionInfo Parameter Mismatch: :first_name parameter data not found.
:face_with_monocle:
The fact is it does actually retrieve the data with that very ID if I call get-data function.Looks right, maybe a stale compile hanging around somewhere?
try quit REPL/ lein clean/ restart REPL?
Also double check for dash-vs-underscore typo, it’s real easy to do and to miss
Well, here’s a catch: I have a configuration in the same namespace: db. and somehow REPL doesn’t seem to resolve configuration def when I evaluate it, although eval is successful.
Hmm, I dunno then, it’s weird
There’s a #hugsql channel, seems fairly inactive, but you might want to try it
Are those books any good? https://www.manning.com/books/the-joy-of-clojure-second-edition https://pragprog.com/book/shcloj3/programming-clojure-third-edition Is there another good introduction other then Clojure for the Brave and True?
@tobias.vetter Joy of Clojure is my very favorite Clojure book, but it's somewhat dense; possibly better as a second book (although if you've done Brave & True already, you may well be ready for it). Programming Clojure is also good, and should work well as a first book.
@tobias.vetter Absolutely. Joy of Clojure was a joy to read. The pace is a bit high though. It's a whirlwind tour of the ideas behind Clojure more than the details (although there are quite a few useful tidbits). If you've watched all of Rich's and Stu's talks, then you'll feel right at home. Programming Clojure is closer to a cookbook than Joy of Clojure and has more details.
Stuart Halloway. Many members of Cognitect in fact, have given great talks about Clojure and software engineering. Stuart Sierra, Timothy Baldridge, Michael Nygard, David Nolen, Alex Miller and Fogus are the ones off the top of my head. Stuart's Narcissistic Design is especially funny. https://www.youtube.com/watch?v=LEZv-kQUSi4
Note: I'm a beginner myself. Haven't used Clojure in a professional setting (, yet).
I like codinggame
lets you learn clojure at your own pace with minigames
like help batman defuse the bomb etc
you should buy copies for all your friends
There’s also Living Clojure by Carin Meier https://www.amazon.com/Living-Clojure-Introduction-Training-Developers/dp/1491909048
for intro books, I think the best options right now are Brave Clojure, Getting Clojure, Living Clojure, or Programming Clojure
Pragmatic Bookshelf describes Getting Clojure as an expert book: https://pragprog.com/book/roclojure/getting-clojure
My personal opinion having read it is that that is a misclassification
I’d check out the book excerpts and see what you think http://media.pragprog.com/titles/roclojure/hello.pdf
I finished Getting Clojure a few days ago. I think the author does a great job of splitting the text into Basics/Intermediate/Advanced topics.
they all have different approaches and so if you try one and don’t like it, try another one!
I did this macro, but it keeps giving me warning, any tips??
(defmacro execute [pool func & body]
`(.execute ^ExecutorService ~pool
(fn [] (~func ~@body))))
Reflection warning, catalog/services/es.clj:60:22 - call to method execute can't be resolved (target class is unknown).
@rcustodio see this SO answer: https://stackoverflow.com/questions/11919602/generating-clojure-code-with-type-hints
@tobias.vetter I don't know if you have made up your mind but I also thought Spacemacs would have a deep learning curve after I first tried it and got stuck inside a buffer. But in all honesty if you stick to it for a week and give it an honest shot you will pick it up well enough to be able to work with it. I am also a beginner and have been using it for a little over a month. I can move around and do editing.
I want to like it, but stuff always breaks on my with Spacemacs. I am not trapped in some window or menu, but it breaks when it wants to install dependencies.
@tobias.vetter are you seeing breakage related to CIDER, or other stuff? CIDER breakage is due to an unfortunate disagreement between the author of CIDER and the author of SM about whether it's reasonable to treat snapshot builds as deployable code. CIDER has had a ton of churn lately (working on improvements!) some of which has broken stuff for users; SM unfortunately goes with the latest-n-greatest build. Hopefully not a long-term problem (and SM is adding the option of defaulting to only using stable builds), but as dadair points out, you may want to stick with a stable build for now.
It broke after I agreed to install the Clojure layer after I first opened a Clojure file.
Oh, interesting.
Fair enough, just wanted to toss out a warning signpost for the SM update issue I'm aware of.
BTW I'd expect you could solve that problem by deleting your .emacs.d
directory and re-cloning it from Spacemacs. Wouldn't hurt to delete your .spacemacs
too to ensure nothing there is broken, but probably only worth it if you haven't modified it much yet (and of course you would need to re-add the clojure
layer to dotspacemacs-configuration-layers
).
Or actually it sounds like you didn't explicitly add that layer -- so that would be a good thing to do.
Well, that one does look CIDER-related, so you may be tripping over the thing I mentioned.
This may be a bit of a process, I’m afraid. What I’ve done to keep things stable is add the following at the beginning of my dotspacemacs/init
(in .spacemacs
). It may or may not work for you. You should be able to get a definitive solution by posting the error in #cider — hopefully someone can walk you through whatever the current fix is.
(add-to-list 'configuration-layer-elpa-archives '("melpa-stable" . " "))
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
(add-to-list 'package-pinned-packages '(clojure . "melpa-stable") t)
Thanks for the help. But I think I will stick to VSCode for a while and then will look if Spacemacs and its dependencies work.
if you do decide to give spacemacs another try you might want to use the develop branch. it was explained to me that in some ways it can be more stable than the stable branch because it's seeing a lot more active bug fixes I think. I'm usually a stable version of everything kind of dude but I made the switch and it's not only been smooth running, it also starts up much quicker for me. To try it out, after you clone the github repository as you did, you would just do:
cd emacs.d
git checkout develop
then when you start spacemacs you will be in the develop branch and can install the clojure layer. Sounds like a lot but it worked great for me and I'm loving it.I’d say consider giving it a shot, and if it’s working well, freeze it for a while and don’t worry about updating until you’re ready to turn your attention back to tweaking your dev environment.
What about Clojure in Action? https://www.manning.com/books/clojure-in-action-second-edition
probably good too, I haven’t looked at it since the 1st edition. The second ed targets Clojure 1.6 (currently stable is 1.9).
As I recall, both editions of Clojure in Action were rushed to print: a new version of Clojure appeared before each edition was published but the editors refused to allow another pass over the book to ensure it was brought up to date. Much as I like a lot of the Manning books, their editorial process leaves a lot to be desired, IMO.
That is a particularly bad Manning cover :)
Book authors typically have little influence over the cover btw
Hello, are there any clojure workshops with more in depth material ? this one was a joy to go through but only covers topics up to concurrency https://github.com/cognitect/clojure-lab
that material is based on the intro workshops we do before the Clojure conferences (like the upcoming Clojure/conj). http://2018.clojure-conj.org/training/ in case you’re interested
Can I have 2 projects inside of a projects.clj? For example for client and server apps?
Define twice (defproject ...)
?
@denis.fuenzalida for client and server, you would usually use profiles
e.g. you’d have a :client
profile with client dependencies and commands, and a :server
profile for server dependencies and commands
@lilactown thanks Will. Another fast question regarding websockets. For this the best framework to use is aleph, right? Any other alternatives? What would you recommend
@denisgrebennicov there’s Sente and Pedestal as well
sente is a wrapper on the communication layer, it works with aleph or pedestal
Aren't agents like actors but with a function being passed to the actor in order to process the message? I mean of course agents do not have supervision and stuff, but it could have been implemented, right? Link to stackoverflow question: https://stackoverflow.com/questions/3259296/how-clojures-agents-compare-to-scalas-actors
the message is the function so it's inverted - you don't send data to a function and get data back, you send a function to some data and it updates itself
So agents can bang on the same state. But actually you usually use them in more of an actor like way
how do you folks deal with so many options to explore? It sometimes feels a bit like the JS world with 3-5 different popular choices at each lib decision
I generally grab one that looks ok, try it out, and if it works for my problem I keep it. I also don’t generally use too many libraries (especially compared to front-end JS projects).
@risinglight You can always ask for advice on library choices -- but don't be surprised if there are two or three that seem equally popular and also well-maintained. Clojure is opinionated about some things (at a core abstraction level, mostly) but not about others -- and libraries proliferate because of that.
But also, in Clojure, libraries all tend to follow those core, idiomatic abstractions too so any choice tends to be "good".
It feels less and less overwhelming over time as you get used to the ecosystem -- if that's any consolation? 🙂
it is also an evolving space, jetty supports websockets these days too (I am not sure if are any clojure libraries around that, or any attempts to unify that with ring anywhere)
so what was true when a lot of clojure libraries and abstractions got their start (ring, aleph) isn't true now
This can be quite a helpful site for library choices, or at least to look at the landscape https://crossclj.info/ (but, yes, also a bit overwhelming).
@hiredman What are we using for websockets these days? Several years ago Fumiko and I built a p.o.c. based on Sente and Netty, as I recall...
we are using https://github.com/mrniko/netty-socketio which provides all of http and websockets, and http://socket.io on top of http and websockets
You're not using much of an abstraction layer over that, right?
(a lot of core.async but otherwise... just raw interop? you can tell I haven't dug into that part of our codebase yet!)
no, I guess, we aren't using a lot of http://socket.io stuff, mostly just as a transport layer for messages
we do have a ring adapter so we can write regular ring handlers on top of the webserver provided there, but it isn't used very much
Has anyone done development on cljs from "within" a flask (or any other web framework)? For example, I have a python flask server, and I want to have it serve my cljs from /app
. This is easy enough once I build the final JS/CSS/etc assets, but during development, how would I go about that? I have a flask dev server running and serving my HTML templates, but I can't also have live reloading? Should I just do my dev with the cljs live reloader, and expect to build/serve it from the flask app later?
figwheel can make reloading work via a web socket, while your app talks to your real server
@hoopes I just figured this out myself w/ figwheel-main and the Django dev server the other day w/ the help of bhauman in #figwheel-main. Long story short, you can use :output-to
and :output-dir
to get the js files into a dir that is served by Django dev server, in my case /static
. The dev JS in turn connects to the figwheel dev server for hot reloading
(I think this does require figwheel and your server being on the same host, but I'd assume that's easy to ensure during dev)
yeah, what @risinglight said in more detail :D
yeah, the thing that makes it just work is that figwheel just wants a socket connection, it doesn't need to be the http server serving the js itself
awesome, i'll give it a shot - the funny thing about this slack is i have like a directory full of chat snippets from super-helpful things i don't want to lose to slack limits 🙂
thanks @noisesmith and @risinglight!
@noisesmith the same host isn’t required
oh - I thought it would run into cross host validation issues
oh, good to know
implemented some super hairy stuff that that communicated to a locally running auth process that way once
@m131 Clojure 1.9 will run on Java 6 onward. Clojure 1.10 will require Java 8 onward.
thank you! it's been a long time since I've compiled a jar to distribute- i found my java 10 compilation failed to run on java 8, but is it backward compatible? if I make a lein uberjar on a java 6 runtime can any user with java 6 onward run the jar?
I don't use AOT and haven't had a Java 6 environment around for years so I can't say with any certainty, sorry.
ok thanks, i guess at the least, if I get it working in alpine that's a good starting point
I would expect that a compiled uberjar, built on Java 6 would run on Java 6, 7, and 8, because I would expect that level of backward compatibility from the JVM...