Fork me on GitHub
#squint
<
2022-09-04
>
borkdude09:09:35

@laheadle letfn is now available in the new npm version

Lyn Headley13:09:59

That is excellent!

borkdude13:09:27

I found one bug with this and pushed the fix

borkdude13:09:51

another bug... just a minute

borkdude13:09:29

fixed in bumped version

borkdude11:09:00

I think this could be very interesting for #cherry / #clavascript https://twitter.com/jarredsumner/status/1566367757704146949 You could do import { } from './foo.cljs'

borkdude12:09:30

clava-immer: a library written in clavascript that offers some core functions like assoc and dissoc as used with immer, to produce "immutable" collections: https://github.com/clavascript/clava-immer The varargs functions in clavascript currently produce too much boilerplate so clava-immer could be a nice project as a goal to reduce JS output size of

borkdude16:09:41

I clarified the purpose of ClavaScript in the README:

ClavaScript is not intended as a replacement for ClojureScript but as a tool to
target JS for anything you would not use ClojureScript for, for whatever reason:
performance, bundle size, ease of interop, etc.

borkdude16:09:08

@lilactown @corasaurus-hex I made a temporary commit which allows you to directly get the spread operator:

(defn foo [x ^:spread y] y) (foo 1 2 3) ;;=> [2 3]
I think it's tempting to emit this when people write [x & y] - the only difference between clojure and clava would be when y is not passed, then in clojure y would be bound to nil but in clava to [] if we directly use spread and don't do any other processing.

borkdude16:09:45

I guess we could use (defn foo [x ^:... y]) :P

borkdude16:09:55

oh whadda you know, (defn foo [x ...y]) already works!

🤯 1
lilactown16:09:27

what situations would nil vs [] break code?

borkdude16:09:42

situations where you write (if y .. ..)

lilactown16:09:43

in practice, nil is often punned to an empty seq anyway

borkdude16:09:14

I actually fixed a case of that in CLJS proper:

borkdude16:09:16

I think it would be nice if we could use the spread operator more in clava, to get the better perf and smaller output, e.g. also for passing varargs without using apply

💯 1