This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-25
Channels
- # aatree (3)
- # admin-announcements (14)
- # aws (2)
- # beginners (23)
- # boot (58)
- # braid-chat (15)
- # cider (8)
- # clara (5)
- # cljs-dev (1)
- # cljsrn (38)
- # clojure (82)
- # clojure-china (2)
- # clojure-czech (16)
- # clojure-dev (11)
- # clojure-finland (1)
- # clojure-ireland (6)
- # clojure-japan (3)
- # clojure-portugal (1)
- # clojure-russia (152)
- # clojure-sg (7)
- # clojurebridge (3)
- # clojurescript (86)
- # code-reviews (3)
- # core-matrix (4)
- # cursive (25)
- # data-science (1)
- # datascript (2)
- # datavis (98)
- # datomic (21)
- # dirac (97)
- # emacs (1)
- # hoplon (1)
- # jobs (2)
- # ldnclj (21)
- # off-topic (3)
- # om (204)
- # pedestal (3)
- # proton (12)
- # reagent (125)
- # ring-swagger (9)
- # slackpocalypse (1)
- # spacemacs (1)
- # vim (1)
- # yada (19)
Is there something in Clojure like http://www.django-rest-framework.org/api-guide/exceptions/ that would validate models and respond with friendly messages like the ones in Django REST, probably Rails has something similar.
For validatiosn themselves you might want to use https://github.com/leonardoborges/bouncer for example
https://github.com/metosin/kekkonen seems to have that built-in into the library for example
https://github.com/juxt/yada also seems to have it, but I can't find a concrete example in the docs to be 100% sure
Hi. Is there shorter equivalent for (merge m1 (select-keys m2 (keys m1)))
?
@jplaza there is also https://github.com/frankiesardo/pedestal-swagger & https://github.com/metosin/compojure-api using Schema for validation (and api-docs). Schema doesn't produce 100% human readable errors thou.
hi guys is there any shorter way to implement contains for vector. Normally I use this one (some #{:a} [:a :b :c])
. I can see that we can use native java method (.indexOf vector key)
(some #{value} vector)
is idiomatic, I would keep using it. It won't explode with NPE if vector
is nil
, like indexOf
will.
is it possible to inject a project version number into leiningen/boot from an external source (properties file)?
With boot it's easy as well, just do (task-options! :pom {:version (slurp "your-file")})
or something similar.
How do I do this http://stackoverflow.com/questions/4195997/enumerate-over-a-sequence-in-clojure in current clojure without contrib
?
@mbertheau: (map-indexed vector ["dog", "cat", "bird"])
never thought of it, but you can use clojure code in your project.clj file; (defproject my-project (slurp “version.file”)…
I thought that was the advantage of boot; scripting your build tasks, but you can script leiningen this way as well, right?
@slotkenov: the advantage of boot is that your build file is a program operating on immutable filesets, not that you can hack some logic into the description of you build
Also, you can't really "script" lein, at best you can produce a certain shape of a defproject
arguments you want
And I don't think you have your depenendcies available in project.clj
yet; in boot you can have that.
@dm3 can you elaborate on why it would be beneficial to operate on immutable filesets?
pretty much same reason immutable data structures are beneficial to mutable ones. In the case of filesystem you know that no one will change the files from under you, you have transactional semantics, you can treat the fileset as a value that can e.g. be cached, you don't have to interact with the actual filesystem at every step. Potentially, you can have a fileset implementation that is remote even.
Namespaces compile to Java packages with the leaf namespace compiling into a class that is included in a package derived from namespace names leading to it, is that right or did I mess something up?
@ikitommi: I’m using pedestal-swagger but was wondering if there was something that could produce more human-readable error messages. It’s a public facing API, hence the need to have friendlier error messages for developers using it.
@jplaza: would like to see that too. There is a start here: https://github.com/cddr/integrity/blob/master/test/integrity/human_test.clj - had plans to port/finalize that into our schema-tools lib, but haven’t had time.
anyone know of an analysis of the frequencies with which core Clojure functions are used in code ?
@ikitommi: I actually did some work on that some time ago, but start-walker
is not a part of Schema anymore. https://github.com/datil/schema-rosetta
somebody called?
@ikitommi: I was using the code you referred to .. and it worked great for schema 0.3.0
thanks for linking
the dataset and my results are linked to at the bottom of that article
@ericnormand: @ghosss cheers exactly what I wanted
although the results are puzzling
@ericnormand: what I'm interested in finding out is which core functions are the most important to learn first if you're a newbie
-- newbies seem to be intimidated by the apparently huge range of functions, and I want to reassure them that they only need to think about maybe 10 to begin with
maybe comp, partial, list, eval, cons, concat, map...
hmmm maybe the most frequently used functions in actual code aren't the best ones to learn first
(huge images warning)
uhh sorry
@jaen no X visible...searching
(deleted)
the first two images from there
the first shows the functions in clojure.core that most other functions depend on
concat, apply, seq, let, list, vector, fn
guys, I’trying to call a scala scala.BigDecimal.unary_-
from clojure with classic (.unary_- bigdec)
and for some reason clojure seems to try to call unary__
and fails with a No matching field found: unary__ for class scala.math.BigDecimal
I suspect the magic name mangling is against me this time
any thoughts ?
@octo221: I think 10 might be too low
that's why I recommend the top 100 expresinos
(never mind, I dodged this one by using the .underlying
java.lang.bigdecimal
for the record: (clojure.lang.Reflector/invokeInstanceMethod "foo" "replaceAll" (to-array ["f" ""]))
is there any clojure function which would run my code later on the same thread (actually I need to run it on main thread)
I ended up using TimerTask: https://github.com/binaryage/cljs-devtools-sample/blob/master/project.clj#L59, it executes on main thread for sure but unfortunately it didn’t solve my problem. I’m trying to launch cemerick.piggieback/cljs-repl and it does some magic with bindings. Executing the code from REPL works, but not running it from that :init code
Can't change/establish root binding of: *cljs-repl-env* with set
I am new to clojure and would appreciate experience sharings
has anyone connected cider to a clojure 1.8 socket server repl?
anyone knows how to find a perfect number in Clojure?
@immutableme: https://maurits.wordpress.com/2010/09/18/clojure-exercise-calculate-perfect-numbers/
@amacdougall, a bit late but just saw your discussion yesterday trying to generate dynamic order by and sort for postgres. I’ve been working on a new library similar to yesql which should handle that. Here's the link describing dynamic queries, and any feedback is much appreciated. https://github.com/mikeball/foundation/blob/master/docs/dynamic-queries.md
Oh, thanks! I’ll check it out tomorrow evening.