Fork me on GitHub
#clojurescript
<
2016-10-28
>
adambros00:10:35

In clojurescript 1.9.229: (let [{:keys [ui/foo] :or {ui/foo 0}} {}] foo) returns nil but in clojure 1.9-alpha13 it fails with

ExceptionInfo Call to clojure.core/let did not conform to spec:
In: [0 0] val: {:keys [ui/foo], :or #:ui{foo 0}} fails spec: :clojure.core.specs/local-name at: [:args :bindings :binding :sym] predicate: simple-symbol?
Is this a bug?

idiomancy01:10:26

is there any kind of x-www-form-urlencoded to edn library out there?

idiomancy01:10:41

why does slacks outgoing webhook api send things as x-www-form-urlencoded? its terrible

idiomancy01:10:53

and why doesnt slack have a slack development slack channel?

thheller07:10:29

@adambros not a bug, the correct form would be (let [{:keys [ui/foo] :or {foo 0}} {}] foo)

octahedrion09:10:19

any idea why :preamble doesnt seem to work with modular compilation ? I want to prepend importScripts() to the start of my generated js

ezmiller12:10:58

Anyone encountered this error before? > Uberjar aborting because jar failed: nth not supported on this type: PersistentArrayMap

ezmiller12:10:51

I’m trying to generate a jar file to deploy a small application built in leinigen/figwheel…

dominicm12:10:05

@ezmiller That's a fairly generic error, it suggests that you're doing some code like (nth {} 2), but nth doesn't support {}

dominicm12:10:54

Not sure if there's more stacktrace that could help?

ezmiller12:10:32

There’s nothing in the way of a stacktrace strangely. I only see the error when I run lein uberjar. When I run lein figwheel everything is fine. Hmmmm.

martinklepsch12:10:11

could be AOT related?

dominicm12:10:40

AOT might be hitting a codepath that isn't hit otherwise.

martinklepsch12:10:59

@ezmiller you could try turning aot off entirely if that's possible when building an uberjar (the uberjar is useless/non-functional in that case so I'm not sure it's a supported option)

martinklepsch12:10:07

that said I guess figuring out why there is no stacktrace might be something you'll want to do at some point so you might as well do it now

ezmiller12:10:44

maybe lein can be run with a verbose option?

mping13:10:25

can you tell me why this doesnt work?

… promise
(.then #js (fn [& args] (.log js/console #js args))
			   #js (fn [& args] (.log js/console #js args))

mping13:10:41

I want to do .then(console.log, console.log) but in clj

robert-stuttaford13:10:38

you don’t need to #js a function def, @mping

robert-stuttaford13:10:43

only datastructures

robert-stuttaford13:10:56

e.g. #js [”one” “two”]

mping13:10:15

will give it a shot

mping13:10:04

hmmm JavaScript literal must use map or vector notation

anmonteiro13:10:54

@mping that's right. #js args doesn't work, it must be used with literal notation, i.e. #js [1 2 3]

anmonteiro13:10:49

you can use clj->js to convert from Clojure data structures to JS's

anmonteiro13:10:30

alternatively, if all you want to do is print ClojureScript's persistent data structures into a readable console form, use println instead of console.log

mping13:10:50

thanks, doesn’t work because its a reader macro and reader macros work on “macro-time” right?

anmonteiro13:10:01

reader-time 🙂

anmonteiro13:10:12

reader -> macro-expansion -> runtime

anmonteiro13:10:36

(which is why you also can't use #js in macros)

anmonteiro13:10:54

reading has happened at that point

mping13:10:05

thanks for the explanation. the generated println code is quite nasty but I guess thats the price to pay 🙂

wwajerowicz14:10:28

Hi I have a question regarding converting ClojureScript datasctructures to JS, I’m trying to convert following map to JS object

(clj->js {
    :title        “Downlo”
    :description "This graphic shows a time-series of downloads."
    :data        [{  :date (js/Date), :value 12}
              { :date (js/Date), :value 18 }]
    :width       600
    :height      250
    :target      "#graph"
    :x_accessor  "date"
     :y_accessor  “value”

})
However, it seems to convert Date objects to string, is there a way to avoid that and keep the Dates as JS Dates ?

timgilbert14:10:04

@mping, you might take a look at the shodan and devtools libraries for cljs logging, if you haven't already seen them

timgilbert14:10:44

Hey, I've got maybe kind of a naive question. I'm working on some cross-platform (clj/cljs) code which exposes a common interface but uses two wildly differing implementations of an underlying parser; they're different enough that I don't want to use CLJC for the files because they're not really very similar. So now I'm considering having two files, parser.clj for the Clojure implementation and parser.cljs for the ClojureScript one.

timgilbert14:10:43

Good idea? Bad idea? Something about it doesn't quite feel right, but it would probably simplify the calling code somewhat

manutter5115:10:20

what about doing something like parser_impl.clj and parser_impl.cljs and then have parser.cljc that just calls simple wrapper functions?

timgilbert15:10:56

That was basically my plan, yeah

timgilbert15:10:55

I'm sort of waffling besides that and having like parser/clojure.clj and parser/coljurescript.cljs

peterschwarz15:10:08

@anmonteiro: > (which is why you also can't use #js in macros) what is a recommended way to do this in macros?

timgilbert15:10:23

It's keeping the namespaces the same but varying the extensions that has me looking a little askance at it

anmonteiro15:10:44

@peterschwarz cljs.core/js-obj and cljs.core/array