Fork me on GitHub

is there a builtin for (vec (mapcat ... )) ?


but you could use the transducer form of mapcat to produce a vector directly


(into [] (mapcat f) ...) for the two arg case I guess


@radomski what are you trying to do here? transduce as a construct isn't intended for producing side-effects like this. doseq or something else would be more idiomatic.


you could just use run! if you want to execute some code for everything in a coll


(run! prn (get-agencies db))

Ryan Radomski01:02:57

This isn't the core part of my app. I was just curious because I was printing stuff to see what was going on with my transducers


I guess there's always (comp txf (partial map #(doto % println))) or whatever


nice use of doto macro Much better then my #(do (prn %) %)


that returns a new transducer, that does what txf does but also prints

Vincent Cantin07:02:18

Why some parts of the docs are pointing to the source code and other don't? What can we do as contributors to make it link to the source code everywhere? - source code: - no source code:


Not sure. That is probably best filed as an issue for the ClojureDocs site developers.


The home page has a "open a ticket" link near the bottom left.


The Clojure Grimoire is another site that may have more easily available source code excerpts:


There is also (source clojure.walk/walk) at a Clojure REPL.


Would anyone with some experience of the new CLI and deps system be able to cast their eye over this "Hello, World!"? I was mainly wondering if I actually require a Makefile like that to make it easier to use. I saw some documentation saying I could put the -m argument in deps.edn, but then couldn't actually get it to work at all. Just trying to do the simplest possible thing but in the idiomatic way right now.


> airplane cockpits


Hah, I've never seen that before but I know what you mean.


Thanks for the link, your post the other day is what reminded me that I wanted to try a project without lein, I should've checked your post again really.


Ah, and you're using the test runner. I was considering that, but ended up taking the simplest possible approach for now since I felt I didn't need any filtering of tests etc (yet). I am slightly worried about what I'll do when I reach the point where I want ClojureScript stuff though...


Also not sure how I'll package it up and publish it to clojars, maybe I should just keep plodding along and write up what I find for newcomers.


I'm using HugSQL and there's a pattern that keeps coming up that I can't solve without lots of embedded clojure code in my queries. Partial update. Let's say I have 7 columns, but my parameter map only has 4 of them. I want to update only 4 of them. How would you achieve that in hugsql?


Exactly, that's how I solved it. But I'm disappointed that there's no other solution than writing clojure code into every update and select filter and I have to

/* :require [clojure.string :as string]
            [hugsql.parameters :refer [identifier-param-quote]] */
in every query to bring join into scope.


also lacks support for namespaced param keys 😞


Ok. I have used Honey SQL and found the below to be nice for updates :

(-> (helpers/update :films)
    (sset {:kind "dramatic"
           :watched true})
    (where [:= :kind "drama"])
=> ["UPDATE films SET kind = ?, watched = TRUE WHERE kind = ?" "dramatic" "drama"]


Hey anyone know if I can run 2 different processes within the same project on a server? In other words, run both lein run for a long running engine, and also lein ring server-headless for an API


lein run | tee engine.log & lein ring server-headless | tee server.log as an example. But for production you might want something more controlable)


if possible, avoid lein on servers, it simplifies things a lot. You can use lein uberjar or lein ring uberjar as apropriate to make a standalone jar. There are multiple advantages, including the fact that you don’t need to worry about dep resolution and jar caching on your server, leiningen defaults provide arguments that are not apropriate for a server process, and if you have a staging environment, you can easily ensure that the same jar that passed staging tests gets run on production


also, you don’t need aot or gen-class to create or run an uberjar, there’s always the option of java -cp my-uber.jar clojure.main -m my.ns


as far as the question, I’d suggest using separate log files for each process, and there’s nothing about lein or java that prevents running many processes from one lein project


@U04V4KLKC @U051SS2EU Thanks guys. I'm going to go with 2 tmux sessions to more easily control the processes separately


(pos-int? 1E10) ;; => false is it a bug or a feature?


it’s not an integral type


I think you want a different function if you want to know if you have a number with no trailing fractional amount


penguin.babysit-test=> (doc pos-int?)
  Return true if x is a positive fixed precision integer
- yes, it’s fixed precision only, so it is meant to return false for numeric types that are floating point


Oh, ok. E will always be floaty. There is a short way to represente "huge" integers?


(long 1E10) will do for now


deps.edn question: Is anyone using it and deploying to Clojars? Or is everyone intending on using git shas? Related: Can you use git tags?


sha only is supported, someone might make a tool to deploy to clojars but the original intention with deps.edn was to make something simpler, in other words, not make a build and deployment tool, just a dep resolver


there is a tool to get an sha from a tag iirc


@olical I’d be cautious about making deps in terms of tags - it’s easy to move a tag to a different commit, and github recycles usernames of deleted users


between those two things you have a huge security problem


That all makes sense, thanks. Mainly just curious about the tag part since I can't find much documentation on the subject. Wasn't sure if the goal was to have everyone sharing dependencies solely through git or if publishing jars somewhere is still a normal thing, there just isn't a built in way of doing it.


All projects I've seen using deps.edn don't seem to be publishing their jars anywhere, was wondering if that's supposed to be like that long term.


at least at one point deps.edn was explicitly not a competitor to lein or boot; it could be the community likes it enough to build the other things around it you’d need to replace lein or boot though


at this point I think it’s too early to say what kind of ecosystem will build around it - as the tool wasn’t even meant to be part of a deployment / build ecosystem


if deps.edn git support leads to a whole world of clojure projects that don’t have deployed jars, that would make me very sad personally


Same, actually.


jars are lighter weight for caching, more straightforward for reproducibility


I’d assume the core cognitect folks are using maven actually - it’s what clojure itself uses


they were never fans of the more elaborate tooling adopted by the community


I mean, in transcriptor, there's no scripts or tooling at all. Does he just type out the full command to build and deploy it every time orrrr?...


I'm interested in these non-lein flows right now 😅


I've got a build pipeline which works sans-lein. But I haven't tried it for a library yet.


if we step away from jars and towards git that would be very bad for the community


since it’s on maven, I’d assume he used the mvn command line to build and deploy transcriptor - it’s odd that there’s not pom.xml in the repo though


go basically started that way and are trying to backport some sense of versions into the community


... it is not going well and I deal with it every day at work


go uses tags too, which has led to problems (that’s why I know about that security problem with github recycling usernames btw - it’s a bug that hit go)


Yeah, I didn't enjoy that part from my foray into Go. Well, I didn't enjoy much of my foray into Go...

Olical16:02:00 is a really good example of how you can plug a lot of these little tools together


Maybe I'll just stick to lein for now, I just wanted to explore this world and found myself coming up with waaaaay more questions than actual solutions.


Ah nice. Looks neat.


@U050AFD41 I think t.d.a does a much better job of this, by using sha pinning.


you can do that in go too, but that doesn't solve any of the other issues unfortunately


what if the repo changes hands


what if the user deletes their account on github


what if that username is recycled


it just solves the issue of tags being malleable


with a recycled username, clashing an sha is still hard


oh yeah for sure, but then your stuff likely won't build


it’s proven possible, but at least for now it is a huge amount of work


whereas if it's a jar it will still build even if the person deleted the repo so long as the jar is still on clojars or central or something


regarding the cognitect transcriptor repo, I downloaded out of curiosity and there’s definitely a pom - my assumption is the pom was not checked into git either intentionally or accidentally


we are ascribing an absolutely unreasonable amount of power to github


> whereas if it's a jar it will still build even if the person deleted the repo so long as the jar is still on clojars or central or something So, maven has tighter guarantees here, I grant that. But because of the cache in ~/.gitlibs it's quite easy to mirror the git repo yourself.


(I mean, not just an auto-generated just-enough-to-make-maven-happy pom, but an actual pom with license metadata and a git tag etc.)


And by that I mean, it's easy to recover something that's moved.


@U09LZR36F right but there are existing tools and workflows to mirror all build deps or keep a custom cache with maven - that tooling doesn’t exist yet for git and might not ever


not to mention relative disk space and file system usage of git repos vs. jars


I can serve jars from s3, I can’t do that with git deps


Agree there's a gap right now. But I don't think the security concern of git dependencies holds up. I think the recoverability is weaker, but not necessarily outside of the realms of possibility. Caching is a place where there's a gap, and it'll be interesting to see how urgently it needs filling. Shaded jars are very popular now, which doesn't let you do caching per-dependency.


Git is inferior to maven in many ways, no disagreement from me there. But I don't think it's that bad.


GitHub tries to detect and reject SHA-1 collision attacks:


I thought from Rich's "Spec-ulation" keynote that it's pretty clear he wants to see a move away from deployed artifacts of any kind. At least that was my take-away from the talk.


@U07TDTQNL I don't recall much of a why from that. Is it buried in there? Do you remember what it was?


I’ll have to watch that talk but I’m suspicious


The idea that artifacts are collections given arbitrary names. "I don't create a new version of my family when I put on a hat". That instead we should grow our codebases by adding new functions, not new collections of functions.


looking up another part of the talk ...


I think the lyrics to “Papa Was A Rolling Stone” woudl disagree here, but I look forward to watching the talk and hearing the whole argument


i heard the same thing. why deploy an artifact when git is already content addressable


So, from listening to that I'm hearing more along the lines of "git has the properties we want, and your code is already there, why don't we just use that?" There's an argument to say that list is incomplete. One of my concerns is over naming. Short names are very popular in the clojure community, and that's going to cause collisions without a central registry.

Alex Miller (Clojure team)19:02:55

our recommendation on that is to either use a name you control (via dns, trademark, etc) or to combine an entity that conveys identity with your user identity in the project qualifier

Alex Miller (Clojure team)19:02:20

such if I create a “ring” project, then refer to the lib as github-puredanger/ring where github is the “identity host” and puredanger is the identity on that host. The combination of the two provides a globally non-colliding name.

Alex Miller (Clojure team)19:02:14

the fact that the clojure community uses short, non controlled names for qualification has never been a good idea

Alex Miller (Clojure team)19:02:37

which is why maven central doesn’t allow such things

dominicm19:02:05 see every repo here for an example of such things 😂

Alex Miller (Clojure team)19:02:48

All of those would be fine if you referred to them as juxt/aero or whatever


But the clojars name is aero, not juxt/aero. But yes, we could change that.


We really should have done namespacing on the refs in aero from day #1 as well, and never did. Which is a bit of a frustration to me. Still figuring out how to cleanly exchange our way out of that without causing massive pain.


@U064X3EF3 I'm curious as to why this doesn't extend to namespaces? e.g. Why isn't it org.clojure.core? Seems that puredanger/ring would have ring/core.clj still, and that would still cause issues.

Alex Miller (Clojure team)20:02:45

it does extend to namespaces

Alex Miller (Clojure team)20:02:08

in the case of clojure, that’s a trademarked unique name, so the org is unnecessary

Alex Miller (Clojure team)20:02:52

and in the puredanger/ring example I would expect at least puredanger.ring namespace (or even something more like github-puredanger.ring) if it wasn’t puredanger but “jeff” or something

Alex Miller (Clojure team)20:02:14

in this case, is actually a domain I own, so :)


Makes sense. Cool 🙂 I suppose this gets harder if you consider that other juxt's may exist.

Alex Miller (Clojure team)20:02:52

yes, and that’s where the original sun guidelines recommend the full reverse dns, like pro.juxt

Alex Miller (Clojure team)20:02:14

that was for package names, but it’s reasonable advice for artifacts too

Alex Miller (Clojure team)20:02:21

like org.clojure/clojure


I always use io.dominic for that reason.


Someone should write all this down 😄

Alex Miller (Clojure team)21:02:04

yeah, I have a todo for it :)


Anyone know any good resources on modeling a game using FSM?


what is the modern way to render web on server side?


is the ring and compujure still in fasion ? 🙂


ring definitely - there's a few alternatives to compojure worth looking at, the most popular full featured template is probably luminus (it's used in the "web development with clojure" book which is likely the authority on the subject)


is there any updates about results of clojure annual survey 2017?

Alex Miller (Clojure team)21:02:49

no, sorry - pto from several of us has delayed progress on posting the results