This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-28
Channels
- # announcements (2)
- # babashka (16)
- # bangalore-clj (1)
- # beginners (93)
- # boot (11)
- # calva (5)
- # cider (13)
- # clj-kondo (49)
- # cljdoc (14)
- # cljs-dev (1)
- # clojure (99)
- # clojure-dev (3)
- # clojure-europe (1)
- # clojure-india (1)
- # clojure-italy (9)
- # clojure-nl (3)
- # clojure-poland (1)
- # clojure-russia (1)
- # clojure-spec (31)
- # clojure-uk (21)
- # clojured (2)
- # clojurescript (18)
- # core-async (12)
- # cursive (36)
- # data-science (1)
- # datomic (54)
- # duct (3)
- # emacs (33)
- # events (1)
- # fulcro (17)
- # jobs (1)
- # joker (8)
- # keechma (1)
- # leiningen (7)
- # malli (8)
- # nrepl (19)
- # pathom (6)
- # planck (18)
- # re-frame (20)
- # reagent (18)
- # shadow-cljs (3)
- # sql (7)
- # vim (31)
Is there a more pure way to learn web development with CLJS rather than Luminus? I feel like starting with no framework at all will better teach me how to fit components but I'm not sure which guide/book teach that?
Coincidentally someone just posted on reddit something similar to what I'm asking for: https://www.reddit.com/r/Clojure/comments/dnwldr/a_series_of_tutorials_on_creating_a_fullstack_app/?utm_medium=android_app&utm_source=share But still if you have other options please mention.
Not sure about ClojureScript, but have you tried with the first edition of Web Development with Clojure? It guides you through the different libraries available for clojure web development.
Interesting, from what you say I'm assuming that the first edition doesn't use luminus...
I might try it for sure if that's the case.
Warning: I wrote all of these before noticing that it's about clojurescript, not necessarily clojure ----- I'd start with ring + compojure. Read the docs, pick up some tutorials and check sample apps. Web Dev. with Clojure may still be helpful (some parts of it) - thinking actually about the second edition. It may also help to mix in some component (https://github.com/stuartsierra/component) @seancorfield’s example project: https://github.com/seancorfield/usermanager-example/ is pretty useful I think Of course, it depends on what you have in mind since "web development" may mean many different things
I want to build a simple website project that has a simple 3 table sql database. Not thinking about react for now so as not to add complication. Once I can do that with basic components html css cljs compojure ring postgres I'll probably check how to convert it into a react app. I hope that this sequence of training will teach me the most and then when I use something like luminus I'd appreciate their best practices understanding the reasons behind them.
I found this guide very helpful for starting out: https://devcenter.heroku.com/articles/clojure-web-application
I there a way to integrate clojure.spec/check and clojure.test.check/defspec or use defspec tests within spec :fn? I don't want to duplicate some property tests in my test file and some in my s/defspec
@arto.eg I did https://www.learnreframe.com/ and found it pretty good. There's also a re-frame one that I'm in the middle of.
(this is pure cljs, no clj only)
Could someone point me to a guide/tool that I can use to package a bunch of .css files in a webjar please ?
I used juxt/pack and depstar but they both copy files directly into the jar and not under META-INF directory
(There's an undocumented api in pack that could be used to do remapping, but I've not opened it up really. There's not a lot of good in doing clever things with packaging)
@dominicm so I need to use a shell script to copy these files into a META-INF directory and then call pack/depstart to package that dir as a jar or is there a tool in Clojure that I can use to do this ?
here's an example webjar pom.xml file: https://github.com/webjars/bootstrap-sass/blob/master/pom.xml#L53-L54
Anybody else getting backend unavailable from http://repo.clojars.org?
https://stuartsierra.com/2015/05/10/clojure-namespace-aliases life is so much better with this convention having each ns define its own DSL (custom aliases) for refering to other ns'es seems a pretty superfluous barrier for understanding other people's code
templating engines for serverside html ... favorites? currently using rum for cljs and the clj templating, but i'm wondering if there's more mustache-like versions i could be relying on.
We use Selmer heavily at work. It's Django-inspired.
I like it as string
but then I always prefer a real word over a shortened or acronym when reading code
if you just use the methods on String you don't have to have arguments about namespace aliases
can core.match guard/when patterns work across two matched values? this is incorrect syntax but should explain what I have on my mind:
(match [state event]
[{:limit x}
{:amount y} :guard (< x y)] (do-something x y))
We use Selmer heavily at work. It's Django-inspired.
woot thanks @seancorfield
I haven't used Django much
does anyone know a “guide/tutorial” out there to create a clojure project that has both Java and Js code ? It seems there are lots of guides for each part but not for both together which makes me a bit afraid 😅
Not a guide/tutorial, but @U04V15CAJ's https://github.com/borkdude/sci has such a mix. I see src-java
is referenced in project.clj
. Don't know if you need any more than that.
This is definitely in the direction that I'm looking. However what I meant is rather a project that not only compiles Java but also JavaScript. It seems the project above exports a js file which is not the same 😞
@UEZDDDLJ1 oh you want to compile JS with CLJ(S) tooling? maybe @U05224H0W's shadow supports this (I wouldn't be surprised)
(->> 1 (= 1))
?
Is this in the middle of a threading pipeline, and you just want "end of args" in this one slot?
(-> 1 ,,, (->> (= 1)) ,,,)
the as->
macro is great for inserting into the middle of a list of ->
invocations (`->>` also works if it happens to be you want it last)
I’m just looking for equivalent of ()
, e.g. (-> 2 ((comp + -)))
, how to do this without inner parens?
you’re looking for the behaviour where the threading macros insert () for you as a convenience like (-> 1 inc) but for a more complex expression like (comp + -)?
it does not exist. if the expr in a threading macro is a list then it will not insert the ()’s for you
@ag ->
is a purely syntactic transformation. Hence our suggestions to use ->>
or as->
in the middle of ->
.
yeah, I’m just surprised there’s no equivalent to ()
as in funcall
(not as in “unit”, empty list)
but just like I was surprised that time when I found, there’s not equivalent of Haskell’s flip
function in clojure.core, and soon I learned that you don’t really need it. Probably if that doesn’t exists, it’s not needed
What syntax and behavior are you thinking of for ()
that is not provided by (apply foo)
?
Maybe I am too steeped in what ->
and ->>
do to understand.
I am guessing you are not hoping that (comp foo bar baz 42)
does something useful?
Oh, maybe you were wishing that ->>
would somehow figure out on its own that (comp foo bar baz)
is a function as a whole, and not stick the 42 inside there?
It's not that much of a mind-reader.
so these are equivalent, right:
((comp clojure.string/upper-case name) :foo)
(apply (comp clojure.string/upper-case name) [:foo])
(->> :foo ((comp clojure.string/upper-case name)))
so how do you do the last one without inner parens?All of them are absolutely needed
How do you do (+ 5 7)
without the parens? 🙂
->> doesn't know what the value of the things it manipulates will be after evaluation
which is the syntax/semantics division, ->> can manipulate objects of syntax (what is read), not semantics (evaluation being the determination of meaning)
I mean, one could write their own variant of ->>
that at run time determined whether each of the expressions returned a function or not, but if you tried to do that, the expressions would have to be evaluated, and they would be missing a parameter, and attempt to call the wrong arity.
Haskell has syntactic currying of function calls always, everywhere. Clojure doesn't. Not sure if that is what you might be thinking of.
This is just a workaround, but perhaps a practical one:
(let [f (comp clojure.string/upper-case name)]
(->> :foo f))
;; => "FOO"
you changed the syntax so ->> is passed the literal symbol f
, instead of a list of symbols, even though those things have the same meaning
Yeah, which is equivalent to the version of that with (->> :foo (f))
. The version you wrote can only dispense with the parens around f
because ->>
and ->
have a special case for expression that return false for seq?
Yeah, I guess some always add the parens (f)
as a matter of style, to avoid that special case.
so what is happening to comp
within a thread macro, why for example this works:
(->> :foo clojure.string/upper-case eval)
but this one doesn’t
(->> :foo (comp clojure.string/upper-case name) eval)
It really is syntactic. In the second case it inserts :foo
before the closing paren ... name :foo)