Fork me on GitHub
#clojurescript
<
2020-05-09
>
mfikes04:05:28

@hammerha As an aside, you can write Math/PI instead of (.-PI js/Math) as well as (Math/sin (/ Math/PI 2)) instead of (.sin js/Math (/ (.-PI js/Math) 2)) . The former expressions are also portable to Clojure. These work in ClojureScript because there is a Math pseudo-namespace.

Sanghyun Lee09:05:09

@miikka awesome, thanks for the information!

frozar13:05:23

Hi guys, I had to create/use a non standard range function like this:

(range-math 0 1 5)
;; => (0 0.25 0.5 0.75 1)

(range-math 0 1 5 :log)
;; => (0 0.5118833609788743 0.7403626894942438 0.8893017025063101 1)
And I was wondering, do you know a clojurescript lib that gives this functionality?

lilactown15:05:12

I don't know of a clojurescript lib that does that off the top of my head

lilactown15:05:16

seems pretty niche

frozar15:05:58

@lilactown It's maybe a small amount of use cases in ClojureScript world, but this is one of the main reason why people likes Numpy lib in the Python world ^^'

lilactown15:05:51

that makes sense

lilactown15:05:00

you could see if there's a JS library that does what you want, that you could wrap

frozar16:05:41

I was thinking about that, I should dig deeper in this direction maybe

lilactown16:05:07

what's the best way to package a Closure JS project for CLJS consumption?

lilactown16:05:35

I'm tempted to use leiningen + deps.cljs 😅 but I'm sure there's a proper way to generate a POM or something. I'm guessing I would still deploy to a maven repo

lilactown17:05:45

I don't know how to convince ClojureScript or Closure tooling that the npm package is Closure JS, not some random crap

lilactown17:05:28

in other news, I've discovered a project called "tsickle" - converts TypeScript to Closure JS https://github.com/angular/tsickle/ I might play with a mixed TS + CLJS project :zany_face: but I would prefer to package my TS as a separate lib

frozar17:05:01

I have a project where I wrap a JS lib: https://github.com/frozar/roughcljs I'm interest in hand-drawing things. To do so, I used leiningen + shadow-cljs. What I like with shadow-cljs is its facility to use npm lib. With shadow-cljs, you're still obliged to use another build tool to generate the jar package.

reefersleep19:05:23

Hello all I’m in the middle of a long quest where the goal is actually to try out using React libs with @lilactown’s hx. I’ve gotten hx working with a figwheel-main project, so that’s great, but using a React lib (more specifically, react-dnd-cjs with figwheel-main is proving difficult. I’ve started with a minimal project using deps.edn and not much more, that actually manages to pull in React as bundled webpack dependency, as described in https://clojurescript.org/guides/webpack . That’s one part of the puzzle. The next big part is integrating figwheel-main. I tried expanding on this minimal project as minimally as I could, using the tutorial at https://figwheel.org/#setting-up-a-build-with-tools-cli . But, when I get to the final step, running the clj, like this: clojure -m figwheel.main -b dev -r , it hangs forever. The output looks like this:

Rees-MacBook-Pro:hello-bundler ree$ clj -m figwheel.main -b dev -r
2020-05-09 20:56:47.318:INFO::main: Logging initialized @4637ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Compiling build dev to "target/public/cljs-out/dev-main.js"
Anyone know what I could be doing wrong?

lilactown19:05:21

I don't see anything weird there. What are you expecting to happen, and what is actually happening?

dpsutton19:05:49

I thought figwheel main was not yet compatible with the new bundle target

lilactown19:05:55

Ah right, I didn't notice you were using the webpack guide

lilactown19:05:03

No idea how that works with figwheel

dpsutton19:05:51

i think it explicitly doesn't for now

reefersleep19:05:55

Cheers, @U11BV7MTK, that’s crucial to know!

dpsutton19:05:18

i would use shadow-cljs for now

reefersleep19:05:33

@lilactown I was expecting it to finish compiling and give me a repl

reefersleep19:05:16

@U11BV7MTK I’m really getting a tour of build tools at the moment 😅 What’s a minimal example of what I want?

reefersleep19:05:53

Cheers! I’ll have a look @U11BV7MTK

reefersleep19:05:36

Are there notable differences in the development experience when using shadowcljs rather than figwheel, @U11BV7MTK?

dpsutton19:05:54

don't think so. except npm just works

dpsutton19:05:14

otherwise they are running and hotloading your code in. both support nrepl so should work with most tooling

reefersleep19:05:26

Big 👍 I’ll follow your guide and see how that goes 🙂