Fork me on GitHub

anyone suggest a non react-native lib/tutorial to jump into tvOS dev with CLJS?


found some good looking articles on google but figured I'd asl


Beginner here, are there any good tutorials for clojurescript with react ?


There are a few good libraries that encapsulate react in different ways


reagent re-frame reactive and om


depending on how clojure-like you want react to be (and other big things as well)


Hi all, got a bit of a curly question, what's the best way to invoke a js method on an object by name in ClojureScript? I want to write a macro that converts a nice consistent fluent JavaScript API to a bunch of ClojureScript functions in a namespace.


So eg (.fluent-fn handle arg1 arg2) === [magic] ===> (converted-fluent-fn handle arg1 arg2) where the only input to [magic] is the string name of fluent-fn


To take it a little further:


(defmacro convert
    `(defn ~(symbol fn-name) [args] (apply (something!) args)))


whats the benefit of not doing (.thing handle arg1 arg2) ?


What is "something!" if fn-name is a JavaScript method of the handle (first arg in all cases)?


Nothing really, just I've started building some more primitives on top of the core functions the JavaScript library provides, and I'd like to preserve consistency


so cljs seems fine with apply on methods, e.g. (apply [1 2 3])


I am macro dumb but

(defmacro convert [fn-name]
  (let [x (gensym)]
    `(defn ~fn-name [~x & args#]
       (apply ~(symbol (str x "." fn-name)) args#))))


Thanks, I'm going to give that a try (also macro-nooblike)


How can i read documentation in figwheel repl ?



(doc map)
throws error
----  Compiler Warning on   <cljs form>   line:1  column:2  ----

  Use of undeclared Var cljs.user/doc

  1  (doc map)

----  Compiler Warning  ----
#object[TypeError TypeError: Cannot read property 'call' of undefined]


Is there a beginner friendly slack channel for clojurescript ?


This slack channel seems to be low on activity


or may be i am spoiled by Elm's slack channel


@vjunloc: #beginners is a good spot


@vjunloc it gets busy here sometimes, it depends šŸ™‚


no worries, i have posted my question in beginners channel


I'm figuring out the Sente library. Last year figuring out basic web comms was painful, and this looks great. I have a couple of questions. First, is there any situation when you wouldn't want to use this library? Seems like it combines Ajax and WebSockets, so I can just use this for basically every client-server interaction?


I'm asking because Rich Hickey says that programmers know the benefits of everything and the tradeoffs of nothing šŸ˜‰


My second question is pretty specific. You can send a message in Sente: (chsk-send! [:rente/testevent {:message "Hello socket Callback!"}]. This has no CSRF token explicitly declared. I'm reading the docs and can't tell if that's because it's sending the token back under the hood, or because it's not needed.


This is in contrast to this example from the docs:

(sente/ajax-lite "/login"
              {:method :post
               :headers {:X-CSRF-Token (:csrf-token @chsk-state)}
               :params  {:user-id (str user-id)}}


Using the ajax-lite method, we do have to explicitly send the CSRF token, which is easily obtained from the chsk-state atom.


Maybe I should ask all this on the repo?


Inspired by @dnolen comment that "your browser is a lisp machine" and the screeshot in (around 24:30), I'd like to try using Chrome as a ClojureScript IDE... and so I installed the ClojureScript REPL extension in Chrome and I have a little doodad in my Chrome windows next to the address field... and it's a menu that will just take me to the Chrome web store to get the thing that I already have... But how do I make this go, to look like what @dnolen has there? Probably obvious: I'm pretty new to ClojureScript and any web/browser development


And I miss Lisp machines šŸ˜ž


@lspector I just watched it earlier today and to me it looked like a stock Chrome DevTools, no extensions/plugins whatsoever


Thanks -- but how does one "make it go"?


btw. @dnolen, thanks for the cljs-devtools plug šŸ™‚


@lspector: you probably want to use, and later when you get familiar with all the tooling, check out Dirac DevTools as last step:


Just to add the stack of questions here: does :include-macros work even when namespace bar.core contains only macros? Specifically, I'm trying out this:

(ns foo.core
    [cool.project :as cp]
    [cool.project.macros :as cpm :include-macros true]))


:require-macros works fine for this, but since it's in a cljc file, it would be cool if I could just use :include-macros true and let clj compilation ignore it.


@darwin: Thanks -- I'll read what's at those pointers. BTW I only just now found the Chrome View > Developer > Developer Tools menu item, so I wasn't kidding when I said I was new to this.


@lspector oh, then you should probably start here:


@lspector: In that case, unless something about Clojure is really speaking to you, I suggest getting up to speed on using JavaScript in the dev tools first.


It's entirely possible to use CLJS without touching much JavaScript, but it will be very helpful to know at least the basics.


I'll second the recommendation to learn a bit of JS - I started CLJS without JS, and translating from JS to CLJS was painful. Now that I know some JS it's much easier.


OTOH, I've never felt the need to know any Java.


@amacdougall: I'm deeply committed to Clojure. Pretty new to web programming. This would be for doing Clojure/Script in a nice way in browsers (possibly an alternative to Gorilla REPL, possibly for teaching beginning programmers). I won't take time to learn JavaScript for any of these purposes.


If you're experienced with Clojure, I'm sure you can figure out the web stuff without knowing JavaScript.


Actually, "pretty new" understates it -- did a little at the very beginning of the web, then a tiny bit lately via clojurescript but only leveraging very nice tools like


for me, just knowing basic syntax so I know what's a method and what's a property and what functions to translate was helpful. But I've never done web dev in anything other than ClojureScript. Don't think I ever will.


I find the web stuff to be a pretty steep wall because most people in the space do know JavaScript, and don't realize the depth of my ignorance šŸ™‚


Well, you can't blame web developers for knowing the one language that runs in the browser!


I'm just glad there are so many compile-to-JS alternatives.


I don't blame them. But my goal here is not to do any web programming, just to have a nice environment to write Clojure/script in a browser. I absolutely love Gorilla REPL, but that screenshot and @dnolen's comment about lisp machines made me wonder if something much better was already available. Looks like maybe? But I'll have to figure out how to use it, and whether it will really serve this need.


If you're doing any kind of browser-based stuff, I strongly recommend Figwheel, too. Every time you save a file, your changes will be reflected in the running app in the browser. It's magical.


BTW one nice thing about Lisp machines was that all you had to do to make the Lisp environment "go" was to turn them on šŸ™‚


Yes, Figwheel or Boot. Hot-reloading is the bomb.


I think that for Figwheel, you have to be using a particular webapp framework, though, which may not be what you're looking for.


You said you're not doing web programming, so on second thought, I guess Figwheel wouldn't help.


I hear you on figwheel, which I use when doing my little thing with Very nice. But what I'm aiming for here wouldn't even involve a separate running app -- just a coding/debugging environment with a REPL


then Chrome Devtools is not a good fit for this IMO, you are looking for some (bootstrapped) clojurescript REPL project, something like klipse or


Thanks @darwin. I did look at and some related things earlier, which was what eventually led me to re-simple-term, which turned out to be the best way for me (with my limited web programming knowledge) to solve the problem that I had at the time (just if you're curious, because it's totally niche: I saw some of the klipse stuff announced recently, but not that particular interface... which looks potentially great! I'll check that out more. But FWIW none of this appears immediately to offer the kind of editing/debugging environment that I was imagining from @dnolen's talk might be available in Chrome


Do I understand you well that you are looking for a web-based coding environment, where one could develop simple clojure(script) programs, evaluate them with integrated debugger? newbie friendly, hiding complexities of underlying platform?


Iā€™m afraid nothing like this exists


Yes, that would be awesome. Too bad it doesn't exist! To be a little more clear, the "web-based" part is only there for me because browsers are sometimes good platforms. But I'm constantly circling between the currently available development environments looking for one with the right combination of all of the other things you mention... every half-year or so trying the latest versions/setups of all of the IDEs, editors, etc. The browser platform provided what I felt was the best option for my class last semester (Gorilla REPL with a bit of tweaking and advice:, but it's not perfect (e.g. I don't yet have a way to save files without markup) and debugging features would be nice... So when I saw that Chrome screenshot it wasn't a big leap to think that there's maybe there's another, better option that also leverages browser technology.


Have you tried Cursive? I haven't tried it myself, but I've heard that it has a good editor and debugger. Of course, then you're installing a big application, which might not be much help either.


Cursive is a PRO tool, he wants something his students will be able to tinker with in minutes


Ah, and you just said "trying the latest versions/setups of all of the IDEs, editors, etc.", so never mind. I should read more carefully!


no debugger, obviously


and would have to be tailored for non-reagent use cases, I guess


I have indeed tried Cursive and I see there's a lot to like there, especially on debugging. But last I checked it out the getting started text and process included a bunch of stuff that I didn't understand myself, with decades of programming experience and a PhD in compsci šŸ˜•... so not quite right for newbies IMHO. I chatted with with Colin Fleming and he was really nice and responsive, but at least at the time I didn't think Cursive would be the choice for my audience for a while yet... but I should check again, since it looks like that was 9 months ago. FWIW Counterclockwise has often been the thing that I've found to serve these needs best, and I've used it in several classes and for research development (and the Counterclockwise developers have also been super helpful and responsive). Both with Cursive and with Counterclockwise there's lots of incidental complexity that comes with the platform (IntelliJ, Eclipse), which would be fine if it would stay out of the way of newbies, but that's the tricky part. Counterclockwise's standalone version and drag-to-open-project helped on this front a lot, but there's still a lot of confusing stuff cluttering it up, that just comes with the Eclipse territory.


Also just FWIW, I was spoiled by Lisp machines and other early Lisp environments (especially Macintosh Common Lisp) that I thought worked well both for newbies and for pros. This is probably why @dnolen's comment got my blood racing šŸ™‚


cljsfiddle is certainly interesting... not quite what I'm looking for here, I don't think, but I will keep it in mind


greetings! what is the "accepted" policy on including core.async as a dependency in a library (or rather tiny framework)? should I have a bunch of atoms as a library integration points, or those would better be channels? is there a universal rule/preference, or is it highly contextual?


in general, if your library needs state, you should provide a factory to create it and a way to pass it into your api, what you put inside is highly contextual


in other words: ideally, there should be no global state hidden in your library


ok, suppose I use provided state, but have a chain of dependencies, which can be represented as series of add-watch on atoms or as a bunch of channels. is there any preference there?


e.g. I get some input from user, and under the hood I subscribe to certain events (clicks, drags, etc. which is really would be boilerplate if required as part of setup/integration). The combination of those inputs (implicit and explicit) produce branchy chain reaction, resulting in lib usefulness and justification of its existence.