This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-20
Channels
- # announcements (10)
- # babashka (12)
- # beginners (30)
- # calva (15)
- # clerk (7)
- # clj-kondo (15)
- # clojure (22)
- # clojure-art (2)
- # clojure-austin (1)
- # clojure-berlin (1)
- # clojure-europe (22)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-uk (5)
- # cursive (3)
- # hoplon (1)
- # hyperfiddle (26)
- # introduce-yourself (1)
- # jobs (1)
- # joyride (13)
- # kaocha (6)
- # lsp (5)
- # matrix (1)
- # music (1)
- # off-topic (8)
- # podcasts-discuss (1)
- # practicalli (1)
- # releases (1)
- # sci (43)
- # shadow-cljs (67)
- # squint (56)
- # tools-deps (3)
Is it good to start with neovim with clojure and do you have some nice guide to start off?
If you're familiar with neovim anyway, yes it's fine to start with. The practicalli guides are pretty good: https://practical.li/neovim/
For me, Conjure on neovim was the best option. On vim, I like vim-iced best. Works nice.
Error detected while processing /home/linuxbrew/.linuxbrew/Cellar/neovim/0.9.4/share/nvim/runtime/filetype.lua: E5113: Error while calling lua chunk: vim/editor.lua:0: /home/linuxbrew/.linuxbrew/Cellar/neovim/0.9.4/share/nvim/runtime/filetype.lua..nvimexec2() called at /home/linuxbrew/.linuxbrew/Cellar/neov im/0.9.4/share/nvim/runtime/filetype.lua:0../home/ice/.local/share/nvim/site/pack/packer/start/aniseed/ftdetect/fennel.vim, line 1: Vim(function):E488: Trailing characters: stack traceback: [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd'
Hi, I have a REST application that uses compojure & ring middlewares. I’m trying to use Swagger to have a nice API for my clients, but so far I couldn’t understand how to use it. can someone help? Trying to make a basic example - to define a route “/api/v1” where the Swagger UI would be rendered.
I don’t know about compojure but if you use Reitit (see the #C7YF1SBT3) channel, it will auto generate the openapi3 specs for you based on your schemas and the route definitions. I think it’s great!
Hi. thanks but I’m not using Reitit - I’m running the server with http-kit, defining routes with compojure & ring
Yeah, I don’t know about that. I thought you might be at the beginning of the project with some flexibility in the router choice.
nope. unfortunately it’s not the case 😅
Is there any advantage to using letfn
over let
if you don’t need functions referring to other function names you are defining? For example is there any practical difference in this case here:
(defn r2 [names]
(letfn [(name-reducer
[names name]
(let [feature-name (name :feature_name)
clean-name (clean-name feature-name)]
(if (valid-name clean-name) (conj names clean-name) names)))]
(reduce name-reducer [] names)))
(defn r3 [names]
(let [name-reducer
(fn [names name]
(let [feature-name (name :feature_name)
clean-name (clean-name feature-name)]
(if (valid-name clean-name) (conj names clean-name) names)))]
(reduce name-reducer [] names)))
Thanks 👍
I have a list of urls in the following shape.
(def items `({:url "valid-url"}
{:url "valid-url"}
{:url "in-valid-url"}))
There could be up to a couple of thousand urls in that list. I need to call each url and assoc the response status code into that list. What would be a realistic way to go about it ?
So far I did this, but it is slow when I apply it with pmap to a list say above 1000 urls. Am using clj-http library to call the url.
(defn add-status-code
"Call the url of the seo page and add response status code."
[item]
(let [status-code (-> (:url item)
(clj-http/get {:redirect-strategy :none})
:status)]
(assoc item :status status-code)))
(pmap add-status-code items)
I would probably start by limiting the maximum number of simultaneous requests
pmap
is OK for CPU intensive tasks but doesn't offer much control for IO tasks
Pmap gives you limited to no control over execution, and is linear, it can only process in order
The general structure you likely want is an input queue, a pool of workers, and an output queue
@U0NCTKEV8 do you know of any popular high level libraries for that kind of work? I know I've seen one or two before just forgetting the names
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorCompletionService.html
ah https://github.com/clj-commons/claypoole is what I was thinking of
@U025C8SL84T I've just did that exercise few days ago using channels https://github.com/senyorjou/fetcher/blob/main/clojure/src/isjustok/core.clj
Thank you all for all the inputs... 🙏 I think for now I'll try to split the call into multiple smaller batches.
Never used this lib before, but I think that code with promises
will do the trick of performing concurrent calls ➡️ https://gist.github.com/senyorjou/9d6699c4d963c10da56c39c3c229106b