This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-29
Channels
- # aatree (1)
- # admin-announcements (7)
- # announcements (3)
- # beginners (125)
- # boot (164)
- # braid-chat (8)
- # cider (26)
- # cljsrn (37)
- # clojars (3)
- # clojure (162)
- # clojure-argentina (1)
- # clojure-art (2)
- # clojure-berlin (5)
- # clojure-czech (3)
- # clojure-ireland (1)
- # clojure-miami (1)
- # clojure-norway (9)
- # clojure-russia (47)
- # clojurebridge (1)
- # clojurescript (151)
- # community-development (1)
- # conf-proposals (80)
- # core-async (15)
- # core-matrix (1)
- # cursive (66)
- # datomic (26)
- # emacs (17)
- # events (10)
- # funcool (59)
- # hoplon (43)
- # incanter (2)
- # jobs (10)
- # ldnclj (8)
- # lein-figwheel (18)
- # luminus (1)
- # off-topic (19)
- # om (144)
- # onyx (167)
- # overtone (9)
- # parinfer (12)
- # pedestal (1)
- # proton (158)
- # re-frame (139)
- # reagent (48)
- # test-check (19)
- # testing (43)
Has someone ever tried to "bend" code mirror and have a repl in the style of a terminal (like http://clojurescript.io) ? @jaredly
@richiardiandrea: http://jaredforsyth.com/reepl/ uses codemirror if that’s similar to what you’re imagining
yes, that's exactly why I am asking you 😄 basically I would like CodeMirror but with the familiar top-to-bottom terminal
it wouldn’t be too hard to change reepl to have the top-to-bottom style. just change the element that scrolls, really
because I am having problems with jqconsole
and I was wondering if I should switch...still...i don't know if CodeMirror is reagent friendly enough
but you tell me that it is not difficult to change the style, well I might dig into it
I'll have a look
I will either go with your solution or implement a custom re-console
(I always propose it but everybody feels like reinventing the wheel)
have you seen the various codemirror-console libraries? http://kybernetikos.github.io/SoleMirror/ (and some others that I can’t find immediately)
Nice! I like jq-console
because it has the classic feeling of being in a terminal
I guess that with some css-fu I can adapt code mirror to that style
Hey everyone, I was wondering is it necessary to learn Javascript prior to learning Clojure Script? It’s not my first language , I am a Java developer, but I rarely use Javascript.
@joshua.d.horwitz: it’s not necessary. you might run into some javascript things (just like clojure gives you java stacktraces) but the people here are super helpful 😄
I'd say it's good enough to Google your way out when your run into problems but that's still not ideal
Hmm, I guess it wouldn’t hurt to do some javascript learning quickly before
So I've heard, but it's a very Java-ish, hardly documented style of Javascript unfortunately.
I for one would appreciate a "just enough GClosure library for a Clojurescript developer" P ;
That is a great Idea for a tutorial!
I’ll help in anyway I can
After reading the state of clojure results I feel like there's a huge influx of people who want to try it out, and that we should do a better job to ease in adoption
@amonks: if you want to try boot, catch - https://github.com/magomimmo/modern-cljs/tree/master/doc/second-edition
Just noticed that (inc 3 12)
returns 4
rather than an arity error. Is that a ClojureScript bug, or a reflection of some JS idiosyncrasy?
JS seems to handle extra params in the same way:
function myInc(n) { return n + 1; }
myInc (3, 17)
4
but certainly some cljs functions throw arity errors...In the Speaking JavaScript book, I'm seeing that "JavaScript does not enforce a function’s arity: you can call it with any number of actual parameters, independent of what formal parameters have been defined...[given] more actual parameters than formal parameters, the extra parameters are ignored..." But I guess what I don't understand is whether there's a clear convention for when ClojureScript will throw an arity error and when it simply passes off to JS (in which case apparently there will never be an arity error).
I could be wrong about this, but I think CLJS just shows a compiler WARNING
when it detects an arity error. As you referenced, the underlying JS will never complain when that happens at runtime.
@chrisoakman: I guess you're right. eg:
cljs.user=> (reduce + 0 '(0 1 2) :extra)
WARNING: Wrong number of args (4) passed to cljs.core/reduce at line 1
Invalid arity: 4
cljs$core$reduce (cljs/core.cljs:2147:1)
Still, no warning on (inc 3 12)
. So I'm still not sure whether there's a definitive cljs convention or whether it’s just a matter of how each function happens to be implemented.
Interestingly, if I define my own inc function, it throws a warning:
cljs.user=> (defn my-inc [x] (cljs.core/+ x 1))
#'cljs.user/my-inc
cljs.user=> (my-inc 3 12)
WARNING: Wrong number of args (2) passed to cljs.user/my-inc at line 1
4
but cljs.core/inc, which seems to be defined the same way, does not. I’m not sure why they behave differently.
cljs.core:
(defn inc
"Returns a number one greater than num."
[x] (cljs.core/+ x 1))
@eggsyntax: There’s something odd with bootstrapped macros like inc
as compared to if-not
, probably worth tracking down. (What you are describing doesn’t occur in JVM ClojureScript.)
Is there a good way to see if the JavaScript environment you're in has a DOM?
In particular in the context of working with Google Closure on iOS react-native; in boot-react-native we're shimming window.document
so that won't work.
@mfikes: oh, glad you noticed this. I should have checked to see if it was Planck-specific. Thanks!
@eggsyntax: Yeah, you can also see it in, say, http://clojurescript.io, which is based on bootstrap as well:
cljs.user=> (if-not true)
Could not eval (if-not true) - Invalid arity: 3 at line 1 - Invalid arity: 3
cljs.user=> (inc 2 3)
3
That last difference, (arity for macros), is the difference between 1.1.170 and 1.1.228. It solved the age-old issue of doing (max)
an getting an invalid arity diagnostic indicating arity 2
Cool, thanks! It’s been a good opportunity to go look at more of the cljs source code.
I may dig into the (inc 2 3)
problem at some point—I recorded it in Planck’s issues. Maybe I can create a minimal repro, or even figure out the root cause.
I wonder if Planck signals the start of a totally independent self-hosted clojurescript.
@gerred: you are thinking of the idea of using self-hosted ClojureScript to transpile for general targets, like the web?
Can you extend existing JS types with ClojureScript protocols? I'm getting Extending an existing JavaScript type - use a different symbol name instead of js/String e.g string
.
yeah, if you don't use :advanced
, and don't rely heavily on macros, such a transpiler is probably becoming feasible. Macros in libs makes it challenging.
@jindrichm: yes but not native types directly because that’s problematic
@jindrichm: yes, use string
@jindrichm: follow the advice given by the warning
I know a lot of people, including myself at one point, have a pretty irrational response to anything that has anything to do with the JVM.
@jindrichm: Feedback on usefulness / accuracy of this proposed docstring change would be welcome: http://dev.clojure.org/jira/browse/CLJS-1550
@gerred: sure but no one involved in Clojure(Script) development is concerned about this problem at all
I'm thinking more along the lines of "how do we get more developers into this?!", and self-hosted probably isn't the correct answer, since they'll come JVM or not.
@gerred: For regular dev, JVM ClojureScript has the test of time on its side, definitely
@gerred: The question of JVM-less ClojureScript won’t go away, even if it is an irrational question. Hrm.
@jindrichm: You can use string
to essentially extend js/String
to a protocol
@gerred: as far as I can tell Clojure(Script) usage grows at a fairly healthy rate every year - not quite enough that people don’t have staffing worries - but teams and companies that adopt Clojure consistently seem quite happy about it and stick with it. Not sure any other metric matters much.
Besides, a lot of people, including myself, have a partially rational response to anything that has anything to do with JS. If that hasn’t kept devs away, I don’t know if anything can 😉
tbh companies have staffing worries no matter the language
@jindrichm: just use string
as @mfikes said
@mfikes: I see, thanks!
(defprotocol Foo (bar [_]))
(extend-type string Foo (bar [_] "foobar")
(bar "") ; => "foobar"
It is my opinion that someone in the community that is interested in a Node-based transpiler should give it a shot. We might learn the pros and cons. Can’t hurt. Whoever does it is likely to learn a lot about how the language ticks internally, which is a lot of what drives me to mess with Planck.
I actually came over to this side when I ceased being able to figure out what the hell was going on with ES6, Babel, Webpack, and everything else people are cobbling together into what they think a React app should be composed of/built with.
I think more what I mean is that the footprint of JS is growing at a far, far faster rate than ClojureScript's.
was enough to make me interested enough / convinced enough to finally sit down and learn it though
@jcomplex: there was an O’Reilly series fairly recently (but I haven’t seen it myself so I can’t vouch for it). One downside is that it isn’t free.
@jcomplex: https://www.safaribooksonline.com/library/view/learning-clojurescript/9781771373890/
I think you can get access to it with the 30 day trial, and Safari books also has pretty much all of the Clojure books as well.
You can also go with http://www.purelyfunctional.tv/single-page-applications , but it's not free either - $25 / month for all his content though
I've also heard really good things about https://www.youtube.com/watch?v=aWJPlRVZX90
would be cool to see a super beginner friendly video tutorial series using Atom & Parinfer
& devcards
@jcomplex: If you have any specific things you really want to focus on or get stuck, the #C053AK3F9 channel is really helpful and is a great place to ask questions too (even if you think they're too basic)
A lot of the concepts should apply to all editors, so once you get a little more comfortable with the basics the others might be useful as well.
I've heard good things about Modern ClojureScript: https://github.com/magomimmo/modern-cljs
@jcomplex: another approach might be to just use Clojure videos, there’s a lot more out there and lot of the concepts transfer
@jcomplex: got it, yeah definitely a lot fewer resources - hopefully that will change in the near future with all the current interest
I am trying to get server-side rendering working and I get "navigator is not defined". Looking at the server-side.js file, it looks like react boots up like:
var Browser = {
isDomPresent: true,
navigator: navigator,
window: window,
document: document,
navigator
is undefined
(the default value for non bound variables) so {navigator: navigator}
==` {navigator: undefined}`
@chrisn where are you finding that code? react is very server friendly — is that an old version?
It took me a long time to burrow down but basically we have something including quil that is including processor.js.
I mis-attributed the problem; I just got something rendering with react and now I am trying to pare down our system so I can pinpoint which namespaces aren't going to work server-side.
If you use (defroutes (ANY "*" [] (route-fn)) is there any way to get the request url in route-fn?
@chrisn I assume you are asking about compojure? If so, there is a :uri
key on the requests that you can check:
(defroutes app
(ANY "*" [] (fn [req] (ok (:uri req)))))