what's a good way to add a command line option into the code (like defining constants, but let the constant be provided as an option to lein or something)
Shadow-cljs has this: https://shadow-cljs.github.io/docs/UsersGuide.html#config-merge I don't know if something like this exists in Leiningen but maybe you could use it for some keywords to help you with the search.
thanks!
Is there a more elegant interop syntax for this:
element.getBoundingClientRect().width
than this:
(.-width (.getBoundingClientRect elem))
?(.. elem (getBoundingClientRect) -width)
i think
anyone have chance to play with https://hotwire.dev yet?
also:
(-> elem .getBoundingClientRect .-width)
and the inner parens there are optional, aren't they?
What I'm doing wrong here? trying to access the function uniform2f on the js object gl
and make a partial function of it with location
and then apply the arguments in the list of values
(apply (partial (.-uniform2f gl) location) [1 2 3]) ;; => Uncaught TypeError: Illegal invocation....
after lot's of struggle, thank you so much @p-himik!
(.apply gl.uniform2f gl (into-array (cons location values)))
Try wrapping (.-uniform2f gl)
in (.bind ... gl)
.
Also, with apply
you don't need partial
- apply
accepts multiple arguments.
Also#2, you can use JS's .apply
to avoid having to call .bind
.