Clojurians
#clojurescript
<
2016-01-25
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

sigfig05:01:29

hi cljs ppl!

sigfig05:01:08

i need to do some ajax in this single page site, how would u recommend i do that

sigfig05:01:44

i'm just using js xhr for now but this part of the project could definitely use some refactoring and a lib

jethroksy05:01:59

core.async + transducers are really powerful

sigfig05:01:26

oh, transducer friendly thats nice

sigfig05:01:36

i havent seen this yet thank you

sigfig06:01:30

... is there any common reason why :require [lib :refer :all] would generate a syntax error

sigfig07:01:20

an aliased import works fine, im just importing cljs.core.async, but any variation of :refer throws a fairly nonsensical syntax exception

spradnyesh07:01:48

sigfig: i remember reading somewhere that it's deprecated, though https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/require (see "Recognized options") says that :all is valid

sigfig07:01:45

i have not used clojure in a few years so i thought that might be the case

sigfig07:01:53

but it keeps showing up in docs? so im rly confused

sigfig07:01:53

oh, :refer [<!] does actually work it just throws a warning

jethroksy07:01:22

@sigfig: if you're wrapping it in a macro it needs an extra pair of square brackets around them I think

sigfig07:01:03

no macros involved here

jethroksy07:01:47

for a moment i confused it with deps

jethroksy07:01:26

@sigfig: are you using clojure or clojurescript

jethroksy07:01:24

I can't reproduce your issue

sigfig07:01:50

i might dive into it later but its not rly an issue now

niwinz08:01:50

Maybe a little bit late, it there are also https://funcool.github.io/httpurr/latest/ for ajax/http calls from cljs

sigfig08:01:55

this looks neat but i will not applicative composition for any of this, i'm just making unordered state updates really

jaen08:01:04

@niwinz: FYI you have 402 unauthorized in your docs, isn't that 401 though?

niwinz08:01:23

@jaen: thanks! is a typo and I'll fix it asap (this is not my project, I just have contributed some code, not all funcool projects are mine :P)

jaen08:01:59

Ah, I see. I kind of assumed they mostly were ; d

dev-hartmann09:01:12

hi there, does any of you know how to add a flash .swf to an om react component?

nano15:01:11

Pondering on using Elixir as backend, with CLJS as frontend, but I cannot live without figwheel. Any ideas on how to have a dev-environment for non-clojure backend while keeping figwheel? Like some transparent fallthrough or something.

jaen15:01:51

Simple - SPAs are basically static files, so just server them as that.

jaen15:01:09

Also, quite often SPA would live on a different machine, domain than the backend (or even in a CDN) so I don't see any problems with running elixir backend and serving your SPA with something like boot-http (not sure what lein equivalent is).

mihaelkonjevic15:01:00

@nano If you copy the code from the generated js file - one that loads google closure and figwheel - you can serve it from another web server and figwheel will work. I just did that last weekend

mihaelkonjevic15:01:12

This is my index.html file served by backend

nano15:01:55

@mihaelkonjevic: Ah.. right.. ofc. I actually did that as well the other day, in a weird setup, just didn't connect it to what I was intending to do now :simple_smile:

jaredly17:01:07

I made an interactive tutorial environment, w/ light-table style inline eval, a repl, and some extra tricks https://jaredforsyth.com/tutorial-cljs/ tutorials included: cljs (based off of david nolen’s “intro for light table users”), quil, and reagent

jaen18:01:27

That's pretty cool'

jaen18:01:12

Now only someone needs to make Clojure errors friendly and this could actually compete with Racket in the education department

venantius18:01:16

I was working on a lein plugin to make errors better

venantius18:01:18

modified stacktraces to be more…debugger-ish

venantius18:01:40

but then I got distracted

dnolen18:01:56

@jaredly: impressive

jaen18:01:54

@venantius: that's pretty nice, though not the exact kind of "friendly" I've meant. Beginner friendly - something more in line with what Elm or Racket do. The closest thing, I think, is what Elena Machkasova was doing, but I'm not sure how to use that code. Also Collin Fleming's macro pegs.

venantius18:01:12

one of the things I wanted to do as a part of this project would be things like

venantius18:01:25

helpful error messages for, e.g., IFn + type

venantius18:01:31

which I think is often a gotcha

venantius18:01:49

a message that said something like “It looks like you’re trying to call a map with no other arguments"

jaen18:01:15

Yeah, something like that for example. Nice!

jaen18:01:58

Because if Clojure gets friendly errors, I think it could seriously rival Racket, especially considering all this immediate feedback stuff we have.

venantius18:01:10

I logged some time doing something sort of similar with Ultra when it came to tests

venantius18:01:39

e.g. “test failure, hint: these vectors have the same elements but in a different order"

venantius18:01:58

it’s surprisingly easy and super valuable

jaen18:01:25

Yeah, I can see how that is helpful. Or those "did you mean?"

venantius18:01:09

anyways then I got distracted :stuck_out_tongue:

venantius18:01:22

and I don’t like releasing oss when it’s not yet at a point where it’s plug and play

venantius18:01:03

@jaredly ++ for an awesome project

venantius18:01:19

is that running on bootstrapped cljs?

venantius18:01:31

figured, given eval

jaen18:01:18

@venantius: How are you doing/planning to do that, re-defining core functions with macros doing argument validation, ditto for functions with contracts or something else entirely?

jaredly18:01:24

cljs-devtools has some “error hints” too

venantius18:01:08

@jaen tbqh I’m not sure. the last time I touched this project was in July of 2015; the plugin does re-define core functions and thus can do more or less whatever it wants with the full trace context

venantius18:01:23

which, on the one hand, is evil, and on the other hand, magical

firstclassfunc18:01:27

@jaredly: so cool!

vise89020:01:47

hi all. i'd really like to use cljs for CLIs and scripts, but i find the overhead a bit much. i'd love to have just one file with a shebang that can just be run without ceremony.

vise89020:01:21

so i've been thinking about this approach with caching: what if i made an utility that takes the hash of the file, sees if there's a cache for that hash and, if so, run it?

vise89020:01:48

do you reckon it's possible/useful?

dnolen20:01:04

@vise890: bootstrapped ClojureScript runs on Node.js, also you have Planck on OS X

vise89020:01:04

where would i start?

dnolen20:01:33

caveats apply to both, but if you just want simple scripting it should be fine

vise89020:01:11

cool. i'll have to go with the bootstrapped cljs, i'm on linux

vise89022:01:07

@richiardiandrea: i'll have a look (grazie!)