Fork me on GitHub

How do you add elements to both the end and front of a seq. I saw a trick:

(flatten [1 some-vec 1])
which adds 1 to both end and beginning. Another approach would be
(concat [1] some-vec [1])
Is there any better approach other than the above two?

Ben Sless08:11:55

Just regarding concat, it's not exactly cheapest. It has some implementation details which actually give it nasty overhead and a nasty tendency to realize lazy arguments

Ben Sless08:11:29

Flatten is usually a code smell imo

Ben Sless08:11:33

To add elements to the end of a vector you can just use conj. More information about your use case would help

Ben Sless18:11:34

Yes. It's slower than using (eduction cat ,,,), surprisingly enough

Nathan K05:11:33

Hi all. I’m tempted to try tinkering with a very trivial “” clone. Would reframe be a good choice?


Is there a tool to remove / merge redundant let ?

Geoffrey Gaillard11:11:52

Not that I know of. It would probably look like a compiler pass on the AST. Do you have access to the AST before the problematic code is emitted?


no I mean some cider refactor etc. I already use the one to add arities to function and such


sounds like making a naive "combine these 2 lets into one" would be easy also sounds like a symbol-aware one (make sure one var is not used before another) is hard but maybe a naive one, paired with clj-kondo would be easy. clojure-LSP has some fun things. And integrates nicely with clj-kondo I think smash-lets-together is not yet a feature

Marc Rios11:11:03

I'm doing clojure web development. I'm trying to do authentication. The header setup I've chosen works when the backend server is node.js, but it doesn't work with Clojure's ring. I am able to deliver cookies to the client when the request comes from one of the webpages served from clojure's backend port but it will not issue cookies to requests that come from a different port on localhost. The headers Access-Control-Allow-Credentials = "true" , Access-Control-Allow-Methods is set to "*", Access-Control-Allow-Origin is set to localhost:<the port of the frontend, not clojure>, and "Access-Control-Allow-Headers" is set to "x-requested-with, content-type". Even after making those modifications, clojure still will not serve up a cookie to the frontend.


You should say that you already asked pretty much the same question in #web-security

Marc Rios11:11:23

Sure. I am not familiar with Slack or with this Slack's ettiquette.

Marc Rios11:11:04

BTW, I asked the same question in #web-security and got no reply.

Marc Rios12:11:54

My partner discovered it was an issue with the JS frontend. Thank you for listening.

🎉 1

In defense of this slack it is sunday morning 😛


is this is good one to learn clojure and web development : ?


There is a web development book to. But as a intro im sure that's fine. Web dev is bigger then cljs


yep, but that one costs me a lot of money


This book is free but I'm not too sure how good it is compared to the Web Development with Clojure book


When using lein uberjar what’s the difference between the SNAPSHOT-standalone.jar and the SNAPSHOT.jar? Which one would I use in docker?


standalone is the uberjar


The other is just the project, no deps

randomm char19:11:42

how do I request a change in clojure. A clarification of a doc on a command (doc take-while) it doesn't explain that it will stop on first false.

pavlosmelissinos19:11:28 > Please file it as a question on with the tag "problem" (possible bugs) or "request" (enhancements).


How is the docstring misleading though? It seems to me that the function does what it describes? > Returns a lazy sequence of successive items from coll while (pred item) returns logical true


:thinking_face: the opposite of logical true is logical false


I thought the opposite would be illogical true?

😂 1
Geoffrey Gaillard13:11:36

What is the problematic example?

☝️ 1
randomm char20:11:58

correct but when someone new to programing reads it they assume it goes thru the entire coll, not stop, like filter would , early on this bit me. the reason I want to know, specifically it caused someone else trouble look at This causes issues for newbs. thanks pavlosmelissinos


What behaviour would you expect @UE0T2PKJA ? If it didn't terminate on first false how would it be different from filter?

randomm char21:11:25

I'm not expecting any other behavior but for new people the doc isnt clear (just for clarification I didnt post the question on stakoverflow)

👍 1