This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-20
Channels
- # architecture (25)
- # beginners (68)
- # cider (10)
- # clara (3)
- # cljs-dev (90)
- # cljsrn (16)
- # clojure (132)
- # clojure-austin (7)
- # clojure-berlin (3)
- # clojure-czech (1)
- # clojure-dusseldorf (1)
- # clojure-greece (5)
- # clojure-italy (39)
- # clojure-spec (5)
- # clojure-uk (78)
- # clojured (2)
- # clojurescript (92)
- # community-development (6)
- # cursive (7)
- # data-science (1)
- # datascript (14)
- # datomic (32)
- # duct (8)
- # emacs (5)
- # figwheel (3)
- # fulcro (47)
- # hoplon (12)
- # jobs (10)
- # luminus (16)
- # lumo (5)
- # off-topic (1)
- # onyx (2)
- # parinfer (47)
- # pedestal (6)
- # re-frame (10)
- # reagent (2)
- # reitit (61)
- # ring (8)
- # ring-swagger (16)
- # shadow-cljs (116)
- # sql (17)
- # utah-clojurians (2)
- # vim (1)
(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))
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
that returns a new transducer, that does what txf does but also prints
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: https://clojuredocs.org/clojure.core/tree-seq - no source code: https://clojuredocs.org/clojure.walk/walk
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.
Someone has opened a ticket already. https://github.com/zk/clojuredocs/issues/102
The Clojure Grimoire is another site that may have more easily available source code excerpts: https://www.conj.io
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.
@olical i got this working: https://github.com/robert-stuttaford/bridge/blob/master/deps.edn#L49-L55 however, i do still use a Makefile, because i like making airplane cockpits for myself https://github.com/robert-stuttaford/bridge/blob/master/Makefile
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?
Maybe try update! . This might help : https://stackoverflow.com/a/40429434/2610955 https://clojure.github.io/java.jdbc/#clojure.java.jdbc/update!
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"])
sql/format)
=> ["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
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?)
-------------------------
clojure.core/pos-int?
([x])
Return true if x is a positive fixed precision integer
nil
- yes, it’s fixed precision only, so it is meant to return false for numeric types that are floating pointOh, ok. E
will always be floaty
.
There is a short way to represente "huge" integers?
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
@U051SS2EU why so?
Wondering how on earth Stu deploys https://github.com/cognitect-labs/transcriptor
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've got a build pipeline which works sans-lein. But I haven't tried it for a library yet.
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
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...
https://github.com/juxt/pack.alpha seems interesting btw
https://github.com/robert-stuttaford/bridge 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.
@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
with a recycled username, clashing an sha is still hard
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
right
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
> 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.)
@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: https://github.com/blog/2338-sha-1-collision-detection-on-github-com
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
Part of it is here: https://youtu.be/oyLBGkS5ICk?t=29m39s
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
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.
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
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.
the fact that the clojure community uses short, non controlled names for qualification has never been a good idea
which is why maven central doesn’t allow such things
https://github.com/juxt/ see every repo here for an example of such things 😂
All of those would be fine if you referred to them as juxt/aero or whatever
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.
it does extend to namespaces
in the case of clojure, that’s a trademarked unique name, so the org is unnecessary
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
in this case, http://puredanger.com is actually a domain I own, so :)
Makes sense. Cool 🙂 I suppose this gets harder if you consider that other juxt's may exist.
yes, and that’s where the original sun guidelines recommend the full reverse dns, like pro.juxt
that was for package names, but it’s reasonable advice for artifacts too
like org.clojure/clojure
yeah, I have a todo for it :)
Anyone know any good resources on modeling a game using FSM?
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?
no, sorry - pto from several of us has delayed progress on posting the results