Fork me on GitHub
#lumo
<
2017-05-02
>
pesterhazy13:05:36

Built another tiny tool using lumo: https://github.com/pesterhazy/untree

pesterhazy13:05:51

such a relief not having to resort to python for something like that

pesterhazy13:05:53

speaking of which, is there a way to precompile the cljs for distribution with npm? I'd like to reduce startup time for this simple tool

$ time echo abc | untree
abc
echo abc  0.00s user 0.00s system 43% cpu 0.002 total
untree  1.86s user 0.18s system 120% cpu 1.697 total

pesterhazy13:05:07

basically the idea is to include the cljs compiler output in the npm package so that the binary only needs to run the bundle.js with node (which I imagine is significantly faster)

pesterhazy13:05:05

I'm assuming here that it's ok to ship compiled js on npm - but I'm guessing that's how much of the compile-to-js node world works (e.g. if you're using Babel/CoffeeScript/PureScript)

pesterhazy13:05:25

any pointers appreciated

dominicm13:05:37

@pesterhazy in true unix tradition: does it work with filepaths that have newlines in?

pesterhazy13:05:53

@dominicm emphatically not 🙂

pesterhazy13:05:28

I should add a -0 option for use with find's -print0 option

dominicm13:05:24

unstructured text sucks

pesterhazy13:05:58

although if you have newlines in your file names, you deserve all the broken trees in the world

dominicm13:05:14

& yet they're perfectly valid 🙂

plexus14:05:14

@pesterhazy Calvin bundles the compiled js, you can look there for an example.

pesterhazy14:05:18

calvin starts in .8s so that's twice as fast

pesterhazy14:05:09

time node -e 'console.log(1 + 2)' takes only 0.1 s so there's still room for improvement

pesterhazy14:05:07

calvin's binary is 2.1M, no wonder it takes some time to parse/run

alex-dixon16:05:41

Is there a way to use Lumo with a connected REPL via Cursive/IntelliJ? I’ve attempted to start lumo with a repl on a specific port and connect to it using a remote REPL config in IntelliJ but that doesn’t seem to work 😞

pesterhazy16:05:06

I don't think it'll work with Cursive yet, as Cursive uses nREPL as its protocol

pesterhazy16:05:40

lumo supports socket-repl, so you can connect to it via netcat or emacs's inf-clojure

richiardiandrea16:05:44

No I confirm the above ☝️ it works for now only in inf-clojure which is not an editor really 😀

alex-dixon16:05:37

Drat. Welp, thanks for confirming. What would it take to have lumo support nREPL?

richiardiandrea16:05:22

@alex-dixon it would basically need to implement the nrepl protocol (which I think uses bencode for data)

alex-dixon16:05:00

I guess I should equally wonder what it would take for Cursive to support lumo’s protocol…but seems like nREPL is something like a standard in CLJ/CLJS?

pesterhazy16:05:00

I think @cfleming has looked at unrepl and might support it in the future

pesterhazy16:05:23

unrepl is a new protocol based on the socket-repl, and should eventually target lumo as welll

pesterhazy16:05:57

but it might still be a bit of work to get there

anmonteiro16:05:46

I’ve definitely talked to Colin about supporting Lumo

anmonteiro16:05:11

Lumo 1.4+ supports an undocumented --dump-sdk option that dumps every bundled file to the filesystem

anmonteiro16:05:34

IIRC that’s everything he needed to start adding support for Lumo in Cursive

richiardiandrea16:05:05

unrepl should definitely be the supported protocol, moving things to socket repl has always been the long term target for Clojure anyways

pesterhazy16:05:29

best of all, unrepl is upgradable from socket repl, so should be a smooth addition

plexus17:05:27

@pesterhazy you probably figured it out by now but still seemed a good topic for a quick blog post: https://lambdaisland.com/blog/02-05-2017-nodejs-scripts-clojurescript

pesterhazy17:05:42

perfect timing 🙂

pesterhazy17:05:08

by the way there are case-insensitive cljs regexs #"(i)e"

plexus17:05:28

(now why the heck isn't slack showing a preview...)

pesterhazy17:05:40

do you have og-tags?

plexus17:05:17

so how do you write a regexp that starts with a capturing group that captures the letter i?

pesterhazy17:05:02

sorry it's #"(?i)e"

pesterhazy17:05:19

capturing groups don't start with question marks

plexus17:05:26

nice, I did not know that!

cgrand18:05:27

@alex-dixon @pesterhazy @richiardiandrea what about using tubular to connect cursive to lumo socket repl?

pesterhazy18:05:49

@cgrand, do you have a link?

pesterhazy18:05:55

hah cool, that could work

pesterhazy18:05:52

@cgrand, how's your unrepl-in-cljs work coming along?

cgrand18:05:19

@pesterhazy upgradable socket repl

cgrand18:05:16

The upgradable socket repl is in another castle repo. Lumo is supported. @mfikes got it working on a dev branch of Planck.

cgrand18:05:36

@pesterhazy What's missing is a cljs port of the unrepl printer.

pesterhazy18:05:58

so planck was missing a socket server altogether

pesterhazy18:05:08

lumo already had that

pesterhazy18:05:38

would this be a correct description: cljs-js-repl adds a nicer api for building unrepl on top of that?

pesterhazy18:05:56

I did see that, I guess I'm not understanding how things hang together

cgrand19:05:22

@pesterhazy switching to #unrepl

anmonteiro21:05:12

@dominicm how did you end up solving the shebang thing?

anmonteiro21:05:23

I don’t remember

anmonteiro21:05:38

#!/bin/sh
"exec" "/usr/bin/env" "lumo" "$0" "$@"

(println "hi" )

cfleming22:05:44

@alex-dixon @pesterhazy @anmonteiro Right, I definitely plan to support Lumo soon, but don’t yet sorry.

anmonteiro22:05:09

hey, no rush!