Fork me on GitHub
#clojurescript
<
2018-09-03
>
unwarysage01:09:10

Heyo. What's the best, safe way to take a string and turn it into an integer?

unwarysage01:09:27

"558" to 558

dpsutton01:09:55

js/parseInt

unwarysage01:09:54

ah, thank you.

unwarysage06:09:01

is there some special trick to

merge
?

unwarysage06:09:22

have an error in reagent that only occurs when I use

merge
, as opposed to
into

unwarysage06:09:28

TypeError: (new cljs.core.Keyword(...)).cljs$core$IFn$_invoke$arity$1(...) is null

meow06:09:35

What's the most popular way to get up and going with ClojureScript at the moment?

valtteri06:09:31

@shawx538 merge is for merging maps and into is more like a generic conjoin for all kinds of collections. Both are clojure.core functions and don’t have much to do with reagent itself. What are you trying to achieve?

valtteri06:09:32

@slack1899 there are many paths. Could you elaborate a little, are you going to build a webapp (SPA maybe?), do some node stuff or lambdas? Or just learning Clojurescript in general?

unwarysage06:09:09

I need to take a map of default values, and combine it with a smaller map of specified values, so that the specified values supersede the default ones. @valtteri

valtteri06:09:48

merge should work fine for your use case. Could you show a code snippet of your current merge?

unwarysage06:09:30

I appreciate the help, but it's gotten to be a lot later than I intended to stay up, and my code is a mess right now. I will ask later if i cannot resolve it with a clear head on the morrow.

unwarysage06:09:40

thank you though

valtteri06:09:08

No problem. Btw there’s also #beginners channel where you can ask for help. Many helpful folks there.

thheller07:09:23

@shawx538 looks like you were trying to call a keyword without arguments. ie. (:foo) missing the (:foo something) arg

Saikyun08:09:57

@slack1899 I'd recommend trying out the figwheel tutorial 🙂 https://figwheel.org/

Saikyun08:09:13

I use figwheel-lein, but I think figwheel-main is the new stuff

stephenmhopper14:09:25

Does anyone have a working example of using radio buttons with CLJS and Rum? I’m running into some very strange behavior and I’m not sure why.

Andreas Liljeqvist14:09:04

Is parallel-build enabled by default now? I have tried activating it, but compile time seems about the same

Andreas Liljeqvist14:09:56

%CPU in top at 400 should mean it is running right?

mfikes15:09:23

@alqvist No, :parallel-build defaults to false

Andreas Liljeqvist15:09:51

@mfikes Ok, I can't see any significant difference in compile time. Perhaps figwheel.main does things in the background

bhauman15:09:59

@andreas862 things like running a file watcher and a server 🙂

Andreas Liljeqvist15:09:00

@bhauman More like always running :parallel-build true but the source doesn't think so

bhauman15:09:41

what I meant is that there are things running in the background that would impact the parallel build

bhauman15:09:24

unless you are just compiling one time and not starting a figwheel build

Andreas Liljeqvist15:09:30

would a server and a watcher really impact perf? Still I am running with -bo

bhauman15:09:50

oh well then thats different

Andreas Liljeqvist15:09:36

that should do it right?

Andreas Liljeqvist15:09:55

and clj -m figwheel.main -bo prod

bhauman15:09:32

yeah so you probably won’t see much inprovement with advanced compilation, as the majority of work is serial

bhauman15:09:53

compiling the initial source files will be faster

bhauman15:09:13

but then the optimizations are not parallel I think

Andreas Liljeqvist15:09:19

Ah, I see - That should be in the cljs compiles opts reference

Andreas Liljeqvist15:09:17

Makes a lot of sense when thinking about it - global optimization etc...

borkdude15:09:29

does Google Closure help in polyfilling Promise for IE11?

john15:09:56

I thought GC had it's own promise implementation. Not a vanilla polyfill though, IIRC

borkdude15:09:05

I read here Now that Promise is available in modern browsers, and is automatically polyfilled by the Closure Compiler, by default,, but using it as (js/Promise. ...) doesn’t help I guess

vhead15:09:14

Has anyone in here ever setup a VM with clojurescript using figwheel REPL at cloud9? I’m used to code normal clojure at it and even some RESTful services, but so far my experience with figwheel hasn’t been great. I changed both nrepl and server ports to 8080 and 8081 but it still takes ages to load the page. When I press F12 to look at the console I keep seeing some pulls to localhost:3449 although I could not find where this is coming from (since I changed the ports).

bhauman15:09:57

but that doesn’t answer your question actually

bhauman15:09:37

I’ve never set up anything in Cloud 9, the above tutorial walks you through REPL based development

bhauman15:09:53

it doesn’t discuss nREPL

vhead15:09:51

yeah, I think that the problem is setting it up at c9 since it would be a nREPL. it is such a great place for developing apps that I thought someone would have done this before xD

borkdude15:09:33

maybe the more general question: how does Closure uses default polyfills, what should you do to activate them?

borkdude15:09:09

should I use goog.Promise instead?

borkdude15:09:12

What effect has setting language-in? I’m not sure what these options do

ccann15:09:11

I’m writing a SPA with secretary/accountant and I can’t for the life of me get the back button to navigate back to my application when if I’ve followed a link out of it. Figwheel says 404 and the url looks as expected localhost:3449/foo/bar. Has anyone got an example that they know works?

bhauman15:09:19

@ccann you need to make a ring handler that handles these routes

bhauman15:09:41

and returns your application

ccann15:09:18

@bhauman thanks for the response. I’m deploying this via github pages and intend it to be a single page app with 1 actual route — I’ve never done this before but assumed from the docs and examples I’ve seen that this stack should handle this case

deliciousowl15:09:16

are you calling window.history.back(); ?

bhauman15:09:18

github nay handle it, but figwheel doesn’t by default

ccann15:09:19

reagent, secretary, accountant + dev with figwheel

deliciousowl15:09:44

probably need re-frame

bhauman15:09:54

no you don’t need re-frame

bhauman15:09:13

this a problem where the server is hitting a url that doesn’t exist

bhauman15:09:21

nothing more nothing less

ccann15:09:00

makes sense that it doesn’t know about the route, I’ll try deploying and see if it works on github. Thanks guys!

lilactown18:09:28

@ccann you’ll have to use hash routing with github pages AFAIK

lilactown18:09:18

in order to use non-hash-routing your webserver needs to know to essentially ignore requests to those routes and just feed them back to the original page

ccann12:09:29

@lilactown yes! I suspected that might be the solution and I got it working great. Thanks for the tip!

👏 4
borkdude16:09:25

is this the language that cljs emits as input for closure? what could break if I put it to es6?

mfikes16:09:38

I’m not aware of any places where the compiler varies what it actually emits

mfikes16:09:17

I’m afk, but I think we don’t really even emit ES5, but specify it perhaps to avoid things like https://github.com/planck-repl/planck/issues/781

thheller16:09:20

@borkdude why do you care what the default is? the CLJS compiler will emit ES3 regardless so it only really matters when processing other JS and if you feed it ES6 you should set it to ES6. last time I checked Closure did some weird things to the CLJS output when compiling with ES6 set though.

borkdude16:09:13

@thheller because I want to use the polyfill option and I don’t want to break anything

thheller16:09:51

polyfills only matter in regard to language-out not language-in

borkdude16:09:40

@thheller

:rewrite-polyfills
If set to true, the google closure compiler will add polyfills (for example when you use native javascript Promise). This requires :language-in to be set to :es6 or higher or it will silently be ignored!

mfikes17:09:28

Nice. Interesting to think about how ClojureScript’s numerics could optionally support that.

john17:09:39

Yeah, seems like cljs has 2332N

john17:09:47

With the N at the end

mfikes17:09:30

Yeah. With efficient underlying support, you could imagine a numerics system that truly supports N suffixes, rationals, etc.

john17:09:47

This v8 addition adds little n at the end

john17:09:18

"Implicit conversions to/from numbers and integers and expressions with mixed operands are expressly disallowed"

mfikes17:09:54

The real challenge would be to somehow have a new numeric tower without effectively forking the language, right?

john17:09:43

Looks like it'll find its way to the other vms too https://github.com/tc39/proposal-bigint

john17:09:31

You dove into CLJS's numerics tower in the past, right?

mfikes17:09:51

Chas was working on a revision… searching for it.

borkdude17:09:30

http://neugierig.org/software/blog/2018/09/typescript-at-google.html in this blog someone says: > Closure has unpredictable semantics, it’s slow, it’s buggy :thinking_face:

jsa-aerial17:09:23

Lots of people say lots of things. For example, 'Typescript is buggy (I know of a bug hindering Vega-Lite) and transpiling to JS makes it slow"

borkdude18:09:28

it’s someone from Google, but yeh, opinions

john18:09:28

There's a lot about goog closure we don't touch too. And never deal with.

jsa-aerial18:09:15

Just being from Google doesn't mean all that much

jsa-aerial18:09:33

Not that argument from authority ever means anything

jsa-aerial18:09:30

Also, come to think of it, since it (typescript) sits on JS, doesn't that make its semantics inherently 'vague'??

lilactown18:09:42

if I could have the closure compiler do polyfills for me, that would be bomb

lilactown18:09:49

polyfills are the biggest PITA for me right now

rnagpal19:09:17

Alot of time I will get this warning on the CLJS repl

----  Compiler Warning on   <cljs form>   line:1  column:1  ----

  Use of undeclared Var reagent-internals.core/app-state

  1  app-state
     ^--- 

----  Compiler Warning  ----

borkdude19:09:33

@lilactown I was just discussing these here.

lilactown19:09:58

@borkdude yep that's what prompted my thought 😁

lilactown19:09:05

Did you figure it out?

borkdude19:09:36

I didn’t dare to break our broken build even more by experimenting with that right now 😛