clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
ackerleytng 2020-12-30T05:57:31.013500Z

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)

p-himik 2020-12-30T10:01:22.013800Z

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.

ackerleytng 2020-12-30T20:31:56.018100Z

thanks!

Jack Arrington 2020-12-30T17:51:07.015700Z

Is there a more elegant interop syntax for this:

element.getBoundingClientRect().width
than this:
(.-width (.getBoundingClientRect elem))
?

dpsutton 2020-12-30T17:55:41.016300Z

(.. elem (getBoundingClientRect) -width) i think

👍 2
2020-12-30T19:59:57.017400Z

anyone have chance to play with https://hotwire.dev yet?

phronmophobic 2020-12-30T20:04:37.017600Z

also:

(-> elem .getBoundingClientRect .-width)

euccastro 2020-12-30T20:37:25.018300Z

and the inner parens there are optional, aren't they?

Erkan 2020-12-30T22:13:47.020200Z

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....

Erkan 2020-12-31T11:39:29.023900Z

after lot's of struggle, thank you so much @p-himik!

(.apply gl.uniform2f gl (into-array (cons location values)))

👍 1
p-himik 2020-12-30T23:06:42.020300Z

Try wrapping (.-uniform2f gl) in (.bind ... gl).

p-himik 2020-12-30T23:07:20.020700Z

Also, with apply you don't need partial - apply accepts multiple arguments.

p-himik 2020-12-30T23:07:53.020900Z

Also#2, you can use JS's .apply to avoid having to call .bind.