This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-16
Channels
- # 100-days-of-code (1)
- # announcements (1)
- # beginners (93)
- # boot (46)
- # cider (40)
- # cljdoc (4)
- # cljs-dev (7)
- # clojure (78)
- # clojure-conj (12)
- # clojure-dev (17)
- # clojure-italy (5)
- # clojure-nl (10)
- # clojure-spec (34)
- # clojure-uk (36)
- # clojurescript (56)
- # code-reviews (6)
- # core-async (31)
- # cursive (12)
- # datascript (9)
- # datomic (19)
- # devops (2)
- # editors (3)
- # emacs (6)
- # events (2)
- # figwheel (1)
- # figwheel-main (11)
- # fulcro (59)
- # graphql (10)
- # hyperfiddle (3)
- # keechma (5)
- # leiningen (26)
- # luminus (1)
- # nrepl (5)
- # re-frame (5)
- # reitit (10)
- # shadow-cljs (64)
- # spacemacs (29)
- # tools-deps (6)
- # uncomplicate (8)
- # vim (2)
- # yada (4)
Odd bug in the reader in [org.clojure/clojurescript "1.10.339"]
(rdr/read-string "01") ; valid
...
(rdr/read-string "07") ; valid
(rdr/read-string "08") ; error
(rdr/read-string "09") ; error
I've narrowed it down to cljs.tools.reader.impl.commons/match-number
cljs.tools.reader.impl.commons=> (match-number "09")
nil
cljs.tools.reader.impl.commons=> (match-number "07")
7
I wonder why the choice was made to support both the ^0 (eg. 023) and ^Nr (eg. 8r23) convention for octal? It seems like the general Nr one would have been enough.
Octal with a leading 0 is a common syntactic convention in many programming languages, e.g. C/C++, probably Java, too. The "<number>r" notation in Clojure lets you specify any base from 2 up to 36. Once you have that, it would be weird to leave out bases 8 and 16 as exceptions
It wouldn't make sense to leave them out from the generalized one, but it maybe would have made sense to not include the specialized one.
Leading '0' for octal, and leading '0x' for hex, are very common in many programming languages.
I mean, a the very base, it is Rich's language, and we get to use it, so all "why" questions are really not anyone else's to answer. Just giving my perspective on why he probably chose to keep the leading 0 syntax for octal -- common usage.
You're right about it being common, of course that is not the most compelling argument in favor of it. I'm more sympathetic to 0x.
I think you're going too far with bowing to Rich there, I don't think Rich would even want that level of deference.
I'm not bowing (although I do thank him mightily for creating Clojure). Just explaining that if you ask "why" for a human-designed thing, the authoritative answer is the one who created it.
I think Rich usually has a good reason for what he does, but you as a user should ask why and understand. You are doing no one any favors by being against asking why.
I don't know how you got that I am against asking why. I am 110% for asking why. The best answers I can give you for your "why" question are "here is my guess as to why".
If you can't articulate why decisions make sense, and be realistic about where Clojure has made trade-offs, then you'll just look like a zealot to potential new users evaluating potential use.
Ok, maybe I misunderstood when you invoked Rich Hickey's argument against entitlement, that it's Rich's language, and questions about why are questions about Rich's preferences.
If a human makes a design decision, and someone else tries to answer "why did they do that?", you either go by your best guess, or what they have said. I'm not aware he has answered this particular "why" question before for Clojure, although he has answered many many others.
How do I get the data back from a js/Error
? It looks like data in the REPL, but it comes back as a string when using .-message
cljs.user=> (js/Error. {:foo 42})
#object[Error Error: {:foo 42}]
cljs.user=> (.-message *1)
"{:foo 42}"
That’s what I’m using now - just seems a bit tedious. Ok. How does the repl display it as data? Does it just guess that it might be clj data?
is (enable-console-print!)
needed these days ?
cheers
I'm looking for a library for nested data manipulation, and I saw a recommendation from a couple years ago of specter
. Has anything changed since then, i.e., better alternatives that I should learn instead?
Thank you
I wrote a haskell(!) thing a while back which converts streams of edn to streams of json, so that I could use jq on edn logs: https://github.com/uswitch/ej
I later discovered I could do the same thing with a lot less hassle with the aid of joker https://github.com/candid82/joker
#!/usr/bin/env bash
while read line
do
echo $line | joker --hashmap-threshold -1 -e "(-> (read) joker.json/write-string println)" | jq .
done
Greetings! I've been browsing the last couple hours, trying to find out how I'd like to proceed with building a side-project webapp using mostly Clojurescript. I come from the Rails world. I couldn't find anything based on the plain old template-file architecture, i.e. the 20 years old approach of serving slightly tweaked HTML documents, possibly with a sprinkling of Javascript to enhance UX. I'm now under the impression that should I want to commit to Clojurescript for my side-project webapp, I better embrace either Om, Reframe, or some other Reacty thing, just to publish a bunch of largely static pages. Is that impression correct ?
For static sites there’s https://www.staticgen.com/
@zor: you can definitely render some simple static documents without om, reframe or react. We generate some simple static pages on the server using https://github.com/weavejester/hiccup
I see your point, if it's mostly static, just don't do a backend (staticgen). Or plain hiccup to generate the static pages, appropriate caching strategies left as an exercise to the reader.
Are there alternative templating systems to Hiccup, using archaic architecture, (like erb, smarty, moustache, ...). I imagine usage would run like (render-template template_string bindings)
. (I won't answer the "Why would you want that?" question until someone asks for it 😉 )
Never used it myself, but: https://github.com/fotoetienne/cljstache
Now the beer_value_in_cents
question is : anyone know of cljstache alternatives (outside hiccup, and that doesn't aim at building SPAs) ? 🙂
@zor check section “HTML Generation” https://www.clojure-toolbox.com/
No problem! As you can see most of the static generators seem to be for clj
. It’s more common to build backend with clj
and frontend with cljs
. Code can be shared between the two, which is a huge benefit. If you don’t find a cljs
or clj
lib suitable for your needs,you can use libraries from node/js and jvm ecosystems via interop.
I wonder why the choice was made to support both the ^0 (eg. 023) and ^Nr (eg. 8r23) convention for octal? It seems like the general Nr one would have been enough.
I wrote a haskell(!) thing a while back which converts streams of edn to streams of json, so that I could use jq on edn logs: https://github.com/uswitch/ej