Fork me on GitHub
#clojurescript
<
2016-08-24
>
jasonjckn00:08:48

is clojurescript self hosting part of the mainline build now?

shaunlebron00:08:56

@jasonjckn: requiring the cljs.js namespace gives you that: http://cljs.github.io/api/cljs.js/

shaunlebron00:08:55

yeah this was the big release last year that changed the version scheme and added self-hosting: http://cljs.github.io/news/1.7.28

dnolen02:08:13

@kirked we don’t test with JDK 9 so not that surprising

kirked02:08:22

meh, @dnolen my mistake (or rather Sublime's). Had saved the .cljs file in the wrong place. OpenJDK 9 works fine so far.

kirked02:08:09

FYI that's the error you'll see when there's no source in src/

dnolen02:08:03

@kirked k good to know

Jon06:08:10

@potetm would you like to try https://github.com/Respo/respo/wiki/Quick-Start I used React.js(in CoffeeScript) and Reagent before, and made this for my own projects. Not as powerful as React, but a lot simpler.

curlyfry07:08:17

Is there any real reason not to use the :hints feature in cljs-devtools? It is disabled by default but I can't see any real downsides to activating it https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#what-is-the-hints-feature

Jon08:08:06

Isn't it for this reason, written in link you referred? > This is expected to work only with :optimizations none compiler mode and it is disabled by default because it relies on monkey patching

curlyfry08:08:23

@jiyinyiyong: Yeah, but how do I know if this is a problem in practice?

danielcompton08:08:58

@curlyfry you know when weird stuff starts happening to your code 🙂

danielcompton08:08:32

I think it’s disabled because it’s too invasive/dangerous to be on by default, perhaps it will be on by default later once it gets more usage

curlyfry08:08:29

@danielcompton: Cool, that seems reasonable

am-a_metail09:08:17

;; Although lists are sequences, they are not keyed sequences.
;; `contains` should not be used for lists.

(contains? '(1 2 3) 1)   
;;=> false                  (Clojure = 1.1)
;; IllegalArgumentException (Clojure >=1.5)

am-a_metail09:08:58

If like me you wanted to find a value in a collection and read this article then you'll need to find an alternative. So instead of:

(contains (1 2 3) 1)
I used:
(some #(= 1 %) (1 2 3))

am-a_metail09:08:20

I hope that helps @nxqd

reefersleep09:08:05

I'm having trouble using cljs.core/destructure. It seems that my REPL and code do not know of it, even if Cursive can jump to the correct source in cljs.core.

reefersleep09:08:43

my-repl> (destructure '[:asdfsdf "lol"])
----  Compiler Warning on   <cljs form>   line:1  column:2  ----

  Use of undeclared Var my-namespace/destructure

  1  (destructure '[:asdfsdf "lol"])
      ^--- 

----  Compiler Warning  ----
#object[TypeError TypeError: Cannot read property 'call' of undefined]
nil
my-repl> (cljs.core/destructure '[:asdfsdf "lol"])
----  Compiler Warning on   <cljs form>   line:1  column:2  ----

  Use of undeclared Var cljs.core/destructure

  1  (cljs.core/destructure '[:asdfsdf "lol"])
      ^--- 

----  Compiler Warning  ----
#object[TypeError TypeError: Cannot read property 'call' of undefined]
nil

jimmy09:08:36

@am-a_metail I just found out the problem, I just need to add (:refer-clojure :exclude [get]) . There must be some change in clojurescript compiler. Normally they they returns a warning, this time it's an error :-

am-a_metail09:08:35

Oh right - thanks @nxqd

reefersleep09:08:48

I've tried :require-macros, :requireing cljs.core and other silly stuff. No dice.

reefersleep09:08:45

Couldn't google any similar problems, but maybe someone in here has run into the same thing?

dnolen13:08:40

@reefersleep destructure is in the macro ns, it’s a function in Clojure, there’s no way to get at it

dnolen13:08:58

@nxqd can you please put the full stacktrace somewhere? thanks

dm313:08:07

regarding destructure, is there a cleaner way to do:

(defn- gensym? [v]
  (re-matches #"(map|first|seq|vec)__\d{1,10}" (name v)))

#? (:clj (defmacro when-all-let
           "Like `when-let` but executes `body` when all the destructured bindings are true"
           [bindings & body]
           (let [dst (destructure bindings)
                 syms (->> dst (filter symbol?) (remove gensym?) set vec)]
             ;; cannot reuse `dst` to make something like
             ;; `(let* ~dst ...)
             ;; as it contains Clojure-specific types (e.g. clojure.lang.PersistentHashMap)
             ;; which won't work when expanded in Clojurescript
             `(when-let [~(bindings 0) ~(bindings 1)]
                (when (every? (comp not nil?) ~syms)
                  [email protected])))))

reefersleep13:08:35

@dnolen: thank you for the concise answer!

reefersleep14:08:11

@dm3: Interesting problem. I don't think I'm able to give a good answer 🙂

alpheus14:08:45

How do people run clojurescript tests in the browser unattended?

am-a_metail14:08:56

In clojurescript - can I defn within say, an initialisation func in order to avoid some state sitting about. e.g. (defn init [config], (defn foo [x] (...closed around config...) )

am-a_metail15:08:30

Perhaps having declared foo previously

spinningtopsofdoom15:08:25

You could return a function from init for example (defn init [] (fn [] :foo )) then assign it foo (def foo (init))

anmonteiro15:08:51

@dnolen that contains? bug is a regression introduced by the :rename patch

anmonteiro15:08:06

I’ve already got a fix

anmonteiro15:08:07

@nxqd thanks for reporting, your bug should go away with this patch: http://dev.clojure.org/jira/browse/CLJS-1763

dnolen16:08:01

@alpheus people use standard JS headless testing for that, Selenium or Slimer (I would personally limit my usage of either even if I needed it for some reason)

dnolen16:08:56

@am-a_metail I would not do that, nesting defn is not only not idiomatic it’s nothing we ever test

dnolen16:08:27

that Lisp/Scheme-ism just isn’t supported

dnolen17:08:16

@mfikes is that a custom made key?

hlolli17:08:26

What methods operate on event returned by goog.events EventType/SCROLL, I would have assumed .-x and .-y?

mfikes17:08:01

In hindsight, it looks like WASD took the liberty to modify the SVG to make the line thickness larger (perhaps to make it show up). Cool, I suppose !

shaun-mahood17:08:10

@mfikes: @hlship was looking into what it would take to get a bunch of keys printed with the Clojure logo, it seemed like the price would be pretty reasonable for a group buy of some sort. Last I heard the main issue was dealing with the image copyright for something more than a one off.

hlship17:08:25

I’m still pursuing that, but the people who can make the decision, especially @richhickey, are on PTO.

mfikes17:08:19

Yeah, that would be very nice if it happened. Especially if it involves something better than pad printing, or perhaps if it ends up being a bit more affordable. (A one-off key like the above is USD 10 — USD 15.)

hlship17:08:50

At about 50 keys, it drops below $2/key, if memory serves. I’m looking at DSA keycaps for my Ergodox.

shaun-mahood17:08:58

@hlship: Where were you looking at printing them from?

hlship17:08:22

Signature Plastics.

hlship17:08:08

Actually, the breakdown is 100 keys = $2.14 each. There’s a whole range for prices based on order quantity.

hlship17:08:27

Anyway, not worth discussing unless we get an OK from TPTB.

shaun-mahood17:08:11

Yeah, I've got another idea for a keycap as well that I may end up pursuing if the Clojure or CLJS ones don't go through. Not quite as general purpose but I doubt the copyright side of it will be as much of an issue. Thanks for the info.

shaunlebron17:08:04

@mfikes: that is an SVG resize error...

shaunlebron17:08:38

they tried to downscale the SVG, I’ve seen that artifact before, haha

shaunlebron17:08:44

because the parens are paths defined with line thickness, the thickness doesn’t scale correctly

shaunlebron17:08:57

we should fix that, filing an issue

mfikes17:08:40

Feel free to use my keycap image in the ticket 😏

shaunlebron17:08:07

will do, thanks

shaunlebron17:08:52

@reefersleep: re: lack of cljs.core/destructure… next time you can ctrl+f search the http://cljs.github.io/api to check availability of symbols. special care is taken to list only clojure macros that are only available to cljs

chris18:08:05

speaking of http://cljs.github.io, who owns that? I would like to make a pull request but I don’t really understand gh pages

chris18:08:32

ok, thanks

shaunlebron18:08:53

@chris: let me know if you have questions, the https://github.com/cljs/site repo is the one that generates the site

shaunlebron18:08:29

if you want to edit the api pages, the edit link is at the bottom of every “details” page

chris18:08:09

thanks. I just noticed that it was trying to load a font from an http site, but an https site exists for it

shaunlebron18:08:27

cool, glad to accept pr

alpheus19:08:58

@mfikes now I want keycaps for the keys I bind to Hyper, Super, and Meta!

mokr19:08:16

re-frame 0.8.0, does it ship with :http fx handler? From a quick test and looking at the source, my guess is no, but want to ask just in case i missed something.