Fork me on GitHub
#clojurescript
<
2016-05-31
>
lspector00:05:31

Got it -- installed this https://nodejs.org/en/ and it says I should have npm now...

gastove00:05:56

Yeah, there we go

dnolen00:05:14

just landed cljs.spec.test in ClojureScript master, generative testing support for speced vars

dnolen00:05:18

write a spec, get tests!

skrat00:05:20

@dnolen congrats, this is good news. and of course well done, thanks to @mfikes as well

gastove00:05:21

oh raaaaaaaad

skrat00:05:20

@dnolen @mfikes is it possible to optimize extend-type to output the same optimized code as when implementing protocols in defrecord and accessing properties directly? In defrecord it compiles roughly to __self.foo, but in extend-type, it has to go through the keyword invocation

skrat00:05:03

just wondering whether you know it's NOT possible, as to save me some time researching it

lspector00:05:18

@mfikes and anyone else watching, I've taken several more steps with cljs-bootstrap (following the instructions at https://github.com/kanaka/cljs-bootstrap/blob/master/README.md, and digressing for several installations), node repl.js works (except it doesn't allow multi-line input, which is frustrating since that's one of the reasons I'm on this path... but pressing on...), but then ./script/gen_single.sh fails with:

MacBook-Pro-6:cljs-bootstrap leespector$ ./script/gen_single.sh
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Any clues anyone? (Context: just trying to get a simple terminal app running in a browser window, without a digression to learn Javascript or web development stuff. Have tried several other paths but currently cljs-bootstrap looks best even though I don't need the bootstrap part, because if I can get something like the terminal at http://clojurescript.net running then I should be in good shape... and that even allows multi-line input with shift-return or by pasting in a multi-line value)

gastove00:05:23

Oh that’s neat. I’m not at all familiar with readlink, but that smells like you might have a different (perhaps too old) version of it. man readlink will tell you if yours supports the -f option.

gastove00:05:11

Oh huh — looks like readlink might just pass -f to stat

gastove00:05:33

(This is probably not helping you, I fear 😕 )

lspector00:05:40

My man readlink does say it takes -f...

lspector00:05:01

Yeah, it seems like this rabbit hole just gets deeper...

lspector00:05:05

And maybe everyone always thinks this about the problems that frustrate them, but it seems like this should be so easy, to put a simple terminal-based program in a browser window, when we have Clojurescript and examples like http://clojurescript.net that are doing essentially what I want and aiming to show people how to do the same thing...

mfikes00:05:51

@lspector: Perhaps Replumb is “cleaner,” along with maintainers and a bit of a community around it. http://clojurescript.net was built by the Neil Armstrong of self-hosting

lspector01:05:12

@mfikes: The stuff in the readme at https://github.com/Lambda-X/replumb does look good, although I'm a bit worried about the stuff that many would think is too obvious to put there, like how to compile things and what to move to my server, etc. But maybe I should just switch gears to this, try to clone the project, see if I can make the demo REPL work, and then try to dumb it down to a running a simple interactive terminal app...

mfikes01:05:15

While http://clojurescript.net was an exploratative experiment leading to fundamentally new capabilities that never before existed, Replumb (upon which http://clojurescript.io is the flagship consumer) is a measured, well-reasoned library, designed for re-use by the community.

lspector01:05:41

Hm. Not sure Replumb can deal with multiline input... Ah -- it can 🙂. It was a bit hard to tell because of parinfer, which was munging my pasted-in multi-line expressions. I don't know if this will be an issue for my usage, but FWIW I think that parinfer is a really clever, really impressive, deeply problematic anti-feature 😕. I know some people love it and it's great that it's available for them, and of course those who have provided it are doing a great service... but for me (and my students when I teach) parindent is problematic and parinfer magnifies the problems...

dnolen01:05:48

@skrat probably possible yes

lspector02:05:02

@mfikes: It was a total joy to get http://clojurescript.io repl working, following the excellent directions at https://github.com/Lambda-X/cljs-repl-web, which ran without a hitch and I could move the target folder to my institution's server, point a browser at it, and it runs. Beautiful. Now I just have to remove everything except the terminal window and swap my terminal-based program(s) in to replace the REPL loop. This is definitely the most promising approach I've found, for someone like me who is a Clojure programmer but totally ignorant of Javascript and web programming.

mfikes02:05:07

Well, I can vouch that ClojureScript generally allows you to be ignorant of JavaScript (as I am).

lspector02:05:38

@mfikes: awesome. I think if I can nail this terminal-app-in-a-web-page thing then I'll be able to maintain my ignorance indefinitely 🙂... by making anything that I want to put online into an old-school terminal app, and running it in exactly the same shell.

lspector03:05:48

Trying to remove stuff from a copy of the http://clojurescript.io repl (https://github.com/Lambda-X/cljs-repl-web) in order to field a simple terminal-based app. Assuming that the html that's being served comes from the only .html file I see in the project, resources/public/index.html, I edited that, but this seems to have no effect on what I get from running boot dev and then browsing . For example, if I change what's in the title tag I still get the same title... Does anyone know where to hack to change what comes when browsing the site?

lspector03:05:15

Oop -- now that works -- must have been browser cache?

lspector03:05:01

But it's still pretty mysterious to me what I should remove from that .html file to get just the terminal field. Everything I try seems to leave most of the rest (e.g. all of those buttons) intact and/or to mess up the terminal window. I guess a lot must be hidden in those links in the header?

lspector03:05:03

On the plus side, I see the button for switching input mode now, which is great.

lspector03:05:14

But it's looking much less trivial than I hoped to strip out everything except the terminal field from the window, and to replace the REPL loop with a R*PL-like terminal-style interactive program of my own. If anyone has pointers on how to do those things to the http://clojurescript.io REPL I'd love to learn of them.

lspector05:05:16

From a little more poking, it looks like some of what I'll need to remove is in src/cljs/cljs_repl_web/views.cljs and that I may have to understand a fair bit of this just in order to remove it....

abdullahibra11:05:23

what is the best way to record from mic and save from browser?

lspector14:05:22

Working to turn http://clojurescript.io into a way to share a terminal app. Figured out how to hide most of the non-console stuff, by commenting out calls to reagent/render in src/cljs/cljs-repl-web/core.clj. Yay 🙂.

lspector14:05:54

But how to replace the REPL loop of http://clojurescript.io with my own. Not clear from my rummaging through the project code. Alternative, which will work fine for me and seems like it must be easier: Just use the REPL and make my functions available for calling within it, so that the user can just type something like (start) to start my terminal app running in the REPL. But, two questions: 1) Where can I put my code so that it will be callable within the REPL?, and 2) What can I use in that code to get something like read, read-line, print, and println to work properly within the REPL?

lspector15:05:46

With http://clojurescript.io, how can I define functions that will be callable in the REPL, which is in namespace cljs.user? The cljs.user namespace appears not to be defined in the cljs-repl-web-devel project but to be imported somehow (?), so I don't see how to add it directly there. I tried to use in-ns but that appears not to be supported in Clojurescript. I could create a separate file/namespace in src/cljs/cljs_repl_web, but how would I then get that to be visible in the REPL? The only instances of "cljs.user" that I see in the project are in src/cljs/cljs_repl_web/app.cljs, and I don't see how to change that code either to add functions to the cljs.user namespace or to make another namespace also accessible within the REPL.

volrath16:05:54

Hi guys, I'm new to the community and new to Clojure(script).. I've been playing with it over the past week and right now I'm facing a problem using cljsjs that I don't know if it's a bug or just me screwing up. Is this the right place to ask?

volrath16:05:54

alright, here's my current setup: Using boot with:

[adzerk/boot-cljs "1.7.228-1"]
                 [pandeiro/boot-http "0.7.3"]
                 [adzerk/boot-reload "0.4.8"]
                 [adzerk/boot-cljs-repl "0.3.0"]
                 [com.cemerick/piggieback "0.2.2-SNAPSHOT"]
                 [weasel "0.7.0"]
                 [org.clojure/tools.nrepl "0.2.12"]
                 [compojure "1.5.0"]
                 [cljsjs/three "0.0.76-0"]

volrath16:05:26

and I just have this file:

volrath16:05:16

(ns three-test.core
  (:require cljsjs.three))

(enable-console-print!)

(println "hey!" (THREE/Scene.))

volrath16:05:45

If I compile and run this, console log shows exactly what I expect

volrath16:05:12

but as soon as I change something, hot reloading throws me a warning

volrath16:05:29

WARNING: No such namespace: THREE, could not locate THREE.cljs, THREE.cljc, or Closure namespace "" at line 8 src/three_test/core.cljs

volrath16:05:24

I get that warning in console and in the browser

spinningtopsofdoom16:05:34

you want

(ns three-test.core
  (:require [cljsjs.three]))

(enable-console-print!)

(println "hey" (js/THREE.Scene.))

volrath16:05:40

got it.. so stupid!

spinningtopsofdoom16:05:54

to access javascript variables from ClojureScript you start with the js/ i..e. js/jQuery, js/React.

volrath16:05:29

right, tried everything but that... thanks!

spinningtopsofdoom16:05:49

No problem happy to help

lspector17:05:26

I can't seem to refer to my own namespaces from the http://clojurescript.io repl, whether by trying to include them in cljs.user, or by trying to get the repl to see an additional namespace, or with a call to require or ns in the repl itself. Any help on getting my own code callable within the http://clojurescript.io repl?

chrisetheridge17:05:48

Anyone know of a good library for using D3 with React?

vinnyataide20:05:17

Hello, my http://goog.net Jsonp import is not resolving in my cursive ide "http://goog.net cannot be resolved"

vinnyataide20:05:54

is that a bug or is there something wrong with my conf? I'm trying to debug my om next tutorial app

pesterhazy20:05:55

@vinnyataide: it's probably hard for cursive to locate this ns as it's not clojure-provided but included in Google Closure

pesterhazy20:05:01

i.e. it's a special case

vinnyataide20:05:43

@pesterhazy: okay then, my application is giving no error messages, was just a dark shot, thanks.

dnolen20:05:32

@vinnyataide: you need to add Google Closure I think as library for that to work?

vinnyataide20:05:46

@dnolen in the project file? I don't think that's the case since the goog Uri import is working

dnolen20:05:03

@vinnyataide: hrm weird, might be question for the #C0744GXCJ channel then

lspector23:05:08

Hi @richiardiandrea and @tomek, I'm following up on a thread from the clojure google group. I downloaded the project at and am planning to run a changed copy of it (just the console field) on my own server. I can make that work, but what I can't figure out how to do is to make my own functions callable within the resulting REPL. Can you help with that? Where can I put my code and how can I make it visible from the REPL?

richiardiandrea23:05:44

@lspector: of course we can help! I have very limited time now, but I can suggest you to read this: http://lambdax.io/blog/posts/2015-12-21-cljs-replumb-require.html on how a require in bootstrap works. TL;DR...you need to provide a file in your :src-paths

lspector23:05:43

Thanks @richiardiandrea -- I'll read that, try to figure it out, and touch base here later.

Jacobin23:05:16

So I started a new project using lein new re-frame myproject +routes +handler and tried to remove the # URL and use HTML5 push state instead - however it seems that visiting the about page directly loads the homepage instead of the about page. Visiting the about page via the homepage works fine though - code here -> https://github.com/ashleyconnor/reframe-template