Fork me on GitHub
#clojurescript
<
2015-08-22
>
machty01:08:08

i have an app that receives full JSON representations of objects

machty01:08:09

ah, just rubber ducked an answer to the question i was just about to ask simple_smile

bhauman02:08:34

@magnars: parensofthedead is absolutely awesome.

escherize02:08:43

Agreed. @magnars: Your emacs dexterity and mechanics are downright inspiring.

Oliver George06:08:13

Hi All. I'm looking for a quick and easy way to have my debugging macros available in all namespaces. Essentially, to help me avoid having to add this everywhere: (:require-macros [my.macros :as my])

Oliver George06:08:46

Should adding them into the cljs.core namespace work?

magnars06:08:58

@bhauman @escherize: thanks for the kind words :) I'm glad you like it. Wish I'd get to show off figwheel more, but the UI is so simple. It is such a workflow improvement when you're building more involved UIs.

jackschaedler07:08:44

Why is it that (apply (first [+]) [5 5]) results in 10

jackschaedler07:08:04

But (apply (first '(+)) [5 5]) results in : #<Error: No protocol method ILookup.-lookup defined for type number: 5>

profil07:08:55

@jackschaedler: try

(apply (first `(~+)) [5 5])

profil07:08:54

or (apply (first (list +)) [5 5])

ragge07:08:45

@jackschaedler: because the + in [+] and '(+) are not the same thing

ragge07:08:07

user=> (first [+])
#object[clojure.core$_PLUS_ 0x638ef7ed "[email protected]"]
user=> (first '(x))
x

ragge07:08:16

in [x], x is resolved to the plus function, whereas in '(x) you're quoting a list with the symbol (unresolved) +

jackschaedler07:08:57

so, the tilde basically allows me to resolve the symbol, but allow the list to remain quoted

ragge07:08:25

in this case, you could also use syntax-quote (x)` which is similar to ' except it does resolve symbols to vars

ragge07:08:44

user=> `(+)
(clojure.core/+)

ragge07:08:52

oops, actually no, not exactly what you wanted

profil07:08:58

@jackschaedler: Yes, just like @ragge says, '`' is called syntax-quote and by using '~' you can resolve symbols

jackschaedler08:08:06

My use case is writing out a list of maps within unit tests. Something like '({"a" 12} {"+" +})

jackschaedler08:08:35

would you all find it gross to read (list {"a" 12} {"+" +}) instead?

jackschaedler08:08:05

I haven't been clojuring long enough to know if it's preferred to use the syntax quote or list constructor

profil08:08:43

as you saw, they are not equivalent

profil08:08:05

I would use (list ...)

jackschaedler08:08:50

k, I'll go with the (list...) construction for now

jackschaedler08:08:54

thanks for your help!

igorw09:08:27

you could also use a vector: [{"a" 12} {"+" +}]

val_waeselynck13:08:59

Hi everyone, I plan to write a blog post aimed at making ClojureScript accessible to JavaScript developers. The idea is to provide answers to concerns that JavaScripters may have regarding ClojureScript adoption (e.g "Is there reasonable tooling?" / "is it accessible to non-academics?" / "is it yet another compile-to-js fad?" / "is there a library for doing <X>?" / etc.). It will probably be in the form of a FAQ . Is there such a resource out there already?

bhauman16:08:11

@val_waeselynck: I'm not sure about a central resource. But this faq would be great to have. The ClojureScript wiki is getting better and better.

bhauman16:08:08

@magnars: if you get a chance you might want to checkout Devcards it will make short work of the dead. I also know it's hard to set up a screencast with the browser and the app visible. The app has to be tiny. I do a split emacs with half of it onscreen with resources open in the other half.

magnars16:08:36

@bhauman: devcards looks very interesting indeed. Thank you!

shaunlebron17:08:48

there’s a lot of work going on there, been working on the landing page points to address some of things you mentioned

shaunlebron17:08:52

@val_waeselynck: if you are not familiar with Jekyll, it’s pretty simple. just drop a faq.md file in the site-jekyll/ folder in https://github.com/cljsinfo/site

shaunlebron17:08:31

you can look at the other .md files to see the “front-matter” that you can for choosing an html layout, etc

shaunlebron17:08:03

but yes, we would love to have some help on common concerns for JS that you were describing

shaunlebron17:08:23

if not there, the ClojureScript wiki would be a great starting point for just laying out the ideas

meow17:08:25

@shaunlebron: I just want you to know how much I appreciate the fact that we have someone like you in the community creating such an awesome resource. Thank you, thank you, thank you! simple_smile

bhauman17:08:36

@shaunlebron: yes absolutely thank you so much for your amazing contributions

val_waeselynck17:08:57

@bhauman, @shaunlebron thanks simple_smile. Let me layout some ideas on some wiki page of my own. I'll ask you for reviews and we'll see where we should put it

shaunlebron17:08:15

@val_waeselynck, that’s probably the best spot for things like this, and we’ll decide from there what goes on the website

shaunlebron17:08:37

thanks for encouragement simple_smile @meow @bhauman

val_waeselynck17:08:32

@shaunlebron: let me add up to the encouragements. Making a good façade to ClojureScript is very important simple_smile

shaunlebron18:08:21

especially now, with the growing maturity of ClojureScript this year

bhauman18:08:25

its the most fun you can have with a browser open. Oh shoot I'm gonna tweet that.

dialelo18:08:05

definitely!

shaunlebron18:08:21

idk, I feel there’s a kindling enthusiasm for functional programming and immutability in the JS community thanks to React

bhauman18:08:00

if you look at the uptake and enthusiasm around Redux, its amazing how these ideas are spreading

shaunlebron18:08:02

now just seems like the right time to start reaching out, and showing them what sane React component syntax looks like, among other things clojure does right

shaunlebron18:08:43

man I need to look at redux then

bhauman18:08:30

theres a talk let me find it for you

shaunlebron18:08:59

thanks, will need to bookmark

shaunlebron18:08:51

(gotta get back to my impending failure of an entry for Ludum Dare 33)

bhauman18:08:51

good luck, it would be cool to know how many cljs entries there are this year

meow18:08:33

Is anyone working on a react component that can eval clojurescript code, similar to what dnolen does here: http://swannodette.github.io/2015/07/29/clojurescript-17/

meow18:08:09

Or a cljs repl component for react?

meow18:08:53

The dnolen example uses codemirror, which might be overkill, depending on ones needs.

meow18:08:56

@mfikes: I think you've talked about going beyond the apple platform. Any thoughts on this?

mfikes18:08:47

@meow: Are you referring to Planck?

meow18:08:15

I suppose, yes. And just cljs repls in general.

meow18:08:35

I'm on Windows so I haven't been able to use Planck.

meow18:08:17

I'd like to have two different things in a browser page: 1. an input area for a chunk of cljs code that will get eval'd, and 2. an input area that acts like a console repl with at least basic command history recall and maybe autocomplete and such.

meow18:08:16

I'd love for these to be available in a library that would keep everyone from having to reinvent the wheel.

meow18:08:19

Obviously it can be done, as dnolen shows an example of the first case on his blog post.

mfikes18:08:18

@meow: Yes. I am. In fact, Planck’s been updated to work on Mountain Lion, and to do that meant using the C API to JavaScriptCore. So, one small step towards portability.

meow18:08:36

But his code hasn't been abstracted into a general component that can be used elsewhere.

meow18:08:18

@mfikes: Do you have any plans to target something for the browser like I described?

mfikes18:08:05

@meow: No, I have no plans for any browser work. (None for myself.)

meow18:08:45

I may work on such a thing myself, but I have plenty of things I'd like to be working on so would love to hear that someone else is already tackling this.

meow18:08:51

Or if anyone is interested in working on said items, please let me know.

meow18:08:24

@mkremins: Any interest in creating a cljs repl react component?

mkremins18:08:24

@meow: I’d be willing to help out with someone else’s, but school is starting up again and I’m hesitant to start a new project myself at this point.

meow19:08:04

@mkremins: ok, thanks. I'll let you know if I do something myself. Do you think any parts of flense would lend itself to such a thing?

mkremins19:08:25

only if you want a structural editor as opposed to a text editor for code input. still haven't gotten around to building some of the live-eval features I wanted flense to eventually have

meow19:08:13

well, the code that would be input would be cljs, so structural editing would be applicable

meow19:08:39

I'm mostly familiar with structural editing in Cursive, and even there just barely.

meow19:08:17

So I'm not sure how that would play out in the browser, but I am intrigued by the notion of structural editing.

mkremins19:08:27

here’s a brief video demo of flense doing some simple structural editing: https://www.youtube.com/watch?v=Vh9AymZsqEk

meow19:08:06

@mkremins: yes, looks interesting. I think I'll have to run it myself to fully appreciate what I'm seeing in the video.

darwin19:08:53

@meow: I don’t have direct plans to implement cljs eval component, but I will definitely implement client-side eval in devtools console (cljs-devtools) when chrome devs implement this request: https://code.google.com/p/chromium/issues/detail?id=484261

darwin20:08:37

btw, I think you integrate CodeMirror as a first step, it is not overkill, the library is pretty lean and easy to integrate, IMO

meow20:08:50

@darwin: that's good to know, thanks. That's the direction I was heading.

meow20:08:45

awesome - that will help

meow20:08:04

@darwin: tyvm :thumbsup:

darwin20:08:26

click the wrench icon -> json, or gears in the top-right corner

val_waeselynck23:08:30

As discussed with @bhauman and @shaunlebron, here's a Wiki page which answers concerns JavaScript developers may voice regarding ClojureScript adoption, in a FAQ-style. I'll add more stuff as ideas come, but I really welcome new questions and answers as well as criticism on the ones I provided. Also, since I am not a native English speaker, I probably made incorrect or poor choice of words, please feel free to suggest improvements here as well. https://github.com/vvvvalvalval/reagent-phonecat/wiki/Questions-about-ClojureScript