This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-14
Channels
- # 100-days-of-code (4)
- # announcements (1)
- # beginners (63)
- # boot (22)
- # braveandtrue (104)
- # calva (3)
- # cider (12)
- # cljs-dev (53)
- # cljsjs (3)
- # cljsrn (1)
- # clojure (180)
- # clojure-dev (14)
- # clojure-italy (4)
- # clojure-nl (11)
- # clojure-spec (15)
- # clojure-uk (60)
- # clojure-ukraine (1)
- # clojurescript (118)
- # clojutre (3)
- # core-async (12)
- # core-logic (17)
- # cursive (19)
- # datomic (45)
- # devcards (4)
- # emacs (7)
- # figwheel-main (218)
- # fulcro (27)
- # funcool (3)
- # graphql (1)
- # jobs (4)
- # leiningen (57)
- # off-topic (71)
- # pedestal (2)
- # portkey (17)
- # re-frame (5)
- # reitit (4)
- # remote-jobs (2)
- # ring (11)
- # rum (2)
- # shadow-cljs (14)
- # specter (11)
- # sql (34)
- # tools-deps (23)
Hey everyone. If I were building a new web app in clojure, with a frontend in cljs, what libraries should I look at? I'd like to be backed by Datomic. Last time I asked, transit/vase was recommended to me, but I haven't seen much activity on the vase project
(I'd certainly be interested to hear responses to that question! My inclination would probably still be Reagent and/or re-frame and either Sente or a simple REST back end with Ring/Compojure or maybe compojure-api...)
Thanks @seancorfield! Re-agent, reframe and sente all look great. I was more thinking about the backend. I really like the idea of vase, but don't want to build on something abandoned
@jarvinenemil That site seems to start out with recommending LightTable as an editor and using Docker... I thought LightTable was pretty much abandonware at this point and starting out with Docker is not exactly a friendly low bar to get started...
It just feels way too framework-y and "magical" to me... I've seen beginners start down that path and it's great if it works but they're hopelessly lost as soon as anything goes wrong š
it was a fine experience, but I did learn way much more by setting up an application from scratch by myself
(defn contains-subvals? [subvals vals]
(->> vals
(partition (count subvals) 1)
(some #(= subvals %))))
I have a vector with statistics, then I filter the statistics so I only get the statistics for a month.
I just found the error. Filter returns a list, so I have to take FIRST of the list that filter gets.
this is quite the gotcha when you're manipulating strings, because it will print the function name instead
Hi Clojurians!We're opening a new Clojure heavy position at Exoscale where we build programmable cloud infrastructure. We're now completely remote-compliant even though we favor European candidates: https://www.exoscale.com/jobs/#senior-software-engineer-backend-mailto
I'll gladly assist you with my several weeks of Clojure experience š
there's also http://clojuredocs.org/clojure.core/flatten , which is more general
I know what you mean. I think there are basically two humps you need to get over to be comfortable with Clojure: thinking in a functional way and getting used to immutable data
so normally I at some point when I dont find a functional approach, then I end up having some for loops or whatever
and when you have written enough, then your brain is already at a stage where you have thought about the problem.
Thanks for this phrasing, Iāve been thinking similar thoughts recently and this is very very apt.
Is there a way to combine (range 2005 2019) with (range 1 13) so I get a vector of vectors, so I have a combination of year/months ?
the one I linked is a lazy function
yes, yours @coinedtalk is very functional
thats a list comprehension too
I don't think it's imperative
no, it's not imperative. If you macroexpand the for
you see it's actually based on loop
which is a functional looping construct
if you want side effects you'd need to add (doall) or something?
trying to use for more often rather than dotimes
nice, thanks
(def year-month-vector (for [year (range 2015 2019) month (range 1 13)] [year month])) (doall year-month-vector)
it doesn't execute until you do that
it's a lazy function (?)
(println (do year-month-vector))
posted in the other channel, might be relevant for debugging: https://blog.michielborkent.nl/2017/05/25/inline-def-debugging/
@hoertlehner referenced here along with other tools and techniques btw: https://clojure.org/guides/repl/enhancing_your_repl_workflow#debugging-tools-and-techniques
Andy, maybe use clojure.spec and :pre :post conditions
might have to test a lot less later that way
@hoertlehner I think you hit the nail on the head with the comparison to C# above with regards to having time to think about the problem while writing the mountains of code required
just stick at it the way you seem to be doing and you will have Clojure figured out in no time! šŖ
@hoertlehner re code organisation, are you talking about writing actual tests with deftest
or just REPL experiments?
One approach that seems to be very common is to keep either a comment
block at the end of your file where you keep your REPL experiments there so you can just re-evaluate them later, or move to their own namespace and turn them into proper tests once the API stabilises.
But if you create small functions, then usually you donāt need to change them that much after making them do what you want, in my (limited) experience.
@schmee @hoertlehner I never saw the verbosity of languages like C# or Java as an obstacle in thinking about the problem, though I did mind greatly the readability of such code (by which I mean how easy one can find out what the code does, which in C# and Java suffers because of the code which is there but not part of the problem). In Clojure however, until now I do feel that readability suffers as well, but for another reason: the lack of type declarations, and (to some degree) the lack of verbosity.
To me the big issue I have with c# is that small Repl style experiments are really pain in the ass. I have written my own c# Repl... And even I ultimately gave up because typically one has to instanciate very complex object structures. What is also missing in c# is like a JSON format that allows to setup data structures easily.
I as to reading code.. I still understand the verbose c# code better.. In clojure I have problems seeing the structure of the code.. If I have 5 levels of data hierarchy.. Then I get lost on which level I am doing what. And then if I move one bracket then I am on a completely different data layer.
Javascript for example is very similar to clojure insofar as one can program very functional in it.. AND Javascript allows to define data structures in code..
What does make c# code hard to understand is if you work with multiple services (like database) that have to be initialized somehow. Then most of the code is setting uo the connections, and perhaps managing the dependencies.. I find that very hard to simulate. So the functional part and the infrastructure gets convoluted.
when reading clojure code, you always spend some time guessing the type of values (party to find out what values are accepted, but also to find out their semantic), and it's largely deductive process. it is therefore harder. this is mitigated with comments and names, of course, like any other dynamic language.
for dynamic languages in general, the connection between the source code and the runtime is weaker, so you can find out less just by looking at the code than you would in a static language
I tend to document the types of input and output, where spec is not used. It's not as straightforward to explain in text though when working with complex data structures.
interesting, my feeling is the opposite. for me, when working in statically typed languages with no REPL itās hard to understand whatās going on cause you have these large, opaque objects, often deeply nested, and there is no generic API to work with them
in Clojure, I go into the REPL, print the thing and āoh, itās a mapā and then I have the usual tools at my disposal. in Java, for instance, I print something and āoh, itās a HTTPServletExecutionContextā and I have no idea how to use it since itās a completely custom thing with itās own API
multiply that with however many classes you have in your project (often several hundred or even thousand) and things get out of hand. in clojure, you pretty much have maps, vectors and seqs, and thatās it. and since most projects stick to that, I can immediately jump into any project and make sense of it
I now have a little data mining / data exploration project written in clojure. Mostly I use print-table and proto Repl charts. Now I want to do something more interactive and don't know which libraries I should use. Is reagent / re-frame a good choice for that?
Iāve heard lots of good things about re-frame, so if thatās caught your attention Iād just run with it.
Thereās a handful of choices for cljs UI frameworks, and the best deciding factor is to pick whichever grabs your attention while reading the readme.
the efficiency of the REPL as claimed by many, is half true in my opinion. In a static language you use the debugger of course, there's no alternative. the REPL is useful during development, but becomes less efficient in maintenance, simply because it does not allow you to easily inspect some state. you can use println
of course, but often the debugger is flat out better. and all this is not related to the number of classes in a project, in my oppinion. I think the way logic is spread out in classes is rather the problem.
I have developed over time a hatred towards inheritance, and only because I did a lot of maintenance š
I am not yet at the stage, where I have huge clojure project, so I am just speculating. I found some snippets to allow remote-repl to a running application. So I think with a remote repl, one should be able to debug most problems of a running app, I guess better than with an IDE / Debugger, because one can setup all kind of scenarios quicker.
@hoertlehner you want to add a ui to your project?
In python I would use jupyter notebooks; there you have a few controls (like sliders, comboboxes, and numerical up/down boxes, that then allow me do explore the effect of parameter changes to the model.
I don't think any cljs ui framework has ui elements out of the box, but check out https://material-ui.com/ in tandem with whatever you pick.
for web based UIs you can check out the react wrappers in clojurescript, they are definitely popular: https://clojurescript.org/community/libraries, om and reagent are probably the most popular. I tried using quiescent, because I liked the philosophy behind it, but ran into problems, and it also looks abandoned. I also played around with hoplon, and liked it.
Yes. I'm using an old version 0.7.0 due to some dependencies restrictions. This doesn't seem to work. But I just tried 0.8.1 and it works.
reagent is arguably the simplest in terms of API, you probably don't event need to learn React
indeed, the react wrappers don't offer ui elements, but all of them allow using react components
I have a job where I want to use watermark triggering to use windows of segments. It works in a toy example, and time-based triggering works in the real application. However, watermark triggering does not work in the real application. What can be the cause and how can I verify and fix that?
Hi, I am a beginner in Clojure but not a beginner in programming. I would like to study the codebase of a large, and preferably computation-intensive, Clojure program. I come from a C/C++ background and I want to see how large programs can be written differently
depending on what you are fishing for here are a couple serious things: https://github.com/uncomplicate/bayadera <-- very serious and https://github.com/aria42/flare <-- sits on top of Neanderthal https://github.com/uncomplicate/neanderthal
OTOH, might be best to just start with some straight ahead Clojure data xform work. Also, check out #beginners and probably useful to add #data-science
Also, feel free to ask any beginner-Clojure questions in the #beginners channel as that's where other folk have opted it to help with as much detail (and patience) as you need or want.
(for "beginner(s) in programming", we have #programming-beginners -- just FYI)
Thanks @seancorfield I will do that
Hey all, I'm sure I'm missing some basic core function that can be used to make this function more concise, anyone want to assist with simplifying it? I'm just running a list of data through a pre-determined list of transform functions.
(defn apply-transforms [data]
(map (fn [xform] (xform data))
[xform-fn-1 xfrom-fn-2 ...]))
juxt! It's like Clojure's magic secret sauce
Er, that is, I'm running a single data item through all of those, as in a threading form
@lilactown I made one a very long time ago, https://github.com/nwjsmith/spec.datomic/
Not sure if thatās useful, but it should be complete (might be out-of-date WRT the latest clojure.spec)
Does anyone have an example of :default-deps
lying around? Iāve got a hacked up copy of the clojure
script which lets me -Dmore-deps.edn
and Iāve confirmed that works, so Iām trying to clojure -Dmore-deps.edn -R:my-defaults
to inject resolver :default-deps
so I can have {:deps {org.clojure/clojure nil}}
in my actual deps.edn
and āinheritā the Clojure version from the :default-deps
of the :my-defaults
profile in the other file.
default-deps is not terribly useful at the moment
not sure exactly what you mean by āinject resolverā
clojure.tools.deps.test-alpha> (deps/resolve-deps {:deps {'org.clojure/clojure nil}}
{:default-deps
{'org.clojure/clojure {:fkn/version "1.10.0"}}})
ExceptionInfo Coordinate type not loaded for library org.clojure/clojure in coordinate nil clojure.core/ex-info (core.clj:4739)
I was expecting that would work based on the docs šwell itās failing to understand the nil coordinate in :deps
thatās the fall-through of a multimethod
diff --git a/src/main/clojure/clojure/tools/deps/alpha.clj b/src/main/clojure/clojure/tools/deps/alpha.clj
index 6293734..f4e06c1 100644
--- a/src/main/clojure/clojure/tools/deps/alpha.clj
+++ b/src/main/clojure/clojure/tools/deps/alpha.clj
@@ -178,7 +178,7 @@
coord-id (ext/dep-id lib use-coord config)]
(when verbose (println "Expanding" lib coord-id))
(if-let [action (include-coord? version-map lib use-coord coord-id parents exclusions verbose)]
- (let [{manifest-type :deps/manifest :as manifest-info} (ext/manifest-type lib coord config)
+ (let [{manifest-type :deps/manifest :as manifest-info} (ext/manifest-type lib coord-id config)
use-coord (merge use-coord manifest-info)
children (canonicalize-deps (ext/coord-deps lib use-coord manifest-type config) config)
use-path (conj parents lib)
Variable naming bug š
As currently written deps.alpha keeps the original dependency coordinate even after figuring out what coordinate it wants to use by consulting the override and else mapping, so if the original mapping wasnāt to a valid coordinate as here even if a valid coordinate is discovered in the defaults resolution will blow up.