Fork me on GitHub

I use lein-npm to manage npm dependencies. But how do I actually require them? Do I need to use :foreign-libs?


I want to pass around references to functions, i.e. their name as a symbol and dynamically call that function later. Is this possible in clojurescript?


I’m storing this function in my application state at the moment and would prefer to store something more readable and debuggable


@lukemorton: Functions can be stored in a hash-map atom and referred to by a key that is a :keyword. But to me it sounds like you are already doing that when you say 'I’m storing this function in my application state'.


Yeah thats what Im doing, just looks like garbage when I print it out to console


Yes it can be hard to debug. When I see them printed out to the console the only guidance it is giving me is that I've done it wrong. It doesn't really show how I've done it wrong. Sorry can't help much more...


Hey no problem simple_smile Just thought it might be possible to pass around a symbol reference to the namespace of the function but guess after advanced compilation this isn’t possible.


@lukemorton: yeah that isn’t possible


@jindrichm: the answer depends on whether you are targeting the browser or Node.js


@dnolen: I'm targeting the browser.


@jindrichm: it will be very challenging to use :foreign-libs for individual npm deps I think. Probably easier to build a single file of your npm deps (using Webpack or whatever) and just make a single :foreign-lib entry for that.


@dnolen: Thanks, I'll try that. I've already stumbled upon Webpack in this context (!topic/clojurescript/6GQLHAOWpZc).


does anyone know a resource that gives a good comparison between elm and clojurescript and the direction both are headed. I know that's asking a lot.


the answer might be to "read up on both of them" simple_smile