squint

Chris McCormick 2026-05-01T05:48:25.985149Z

Did some testing and Squint is about 112kb compiled for the browser whereas Scittle is 184kb. ๐Ÿค”

borkdude 2026-05-01T06:57:14.882579Z

What do you mean โ€œin the browserโ€? It depends what kinds of dependencies you use. Squint itself is small

Chris McCormick 2026-05-02T10:44:37.147319Z

I mean the ability to dynamically run cljs-like code, similar to what Scittle does. The Squint core is small but to parse cljs-like requires the full compiler. Is that right?

borkdude 2026-05-02T10:46:22.088909Z

you mean with the evaluate stuff. yes, the compiler is written in CLJS so it pulls in a lot of stuff

Chris McCormick 2026-05-02T10:59:56.202609Z

Hm I wonder if it would compile with :lite ๐Ÿค”

borkdude 2026-05-02T11:07:44.402899Z

compile what? it's already JS

borkdude 2026-05-02T11:08:03.004249Z

sorry wrong thread

borkdude 2026-05-02T11:35:31.247319Z

Lite is really limited, I don't think it'll work

๐Ÿ‘ 1
Chris McCormick 2026-05-02T12:40:51.815789Z

The size actually went up. ๐Ÿ˜

Chris McCormick 2026-05-01T06:25:46.539829Z

TIL: Squint's datastructure manipulation primitives compile out to about 1kb and if you include atoms and atom manipulation fns it's 3kb. So with that it's possible to bundle-out cljs-like datastructure functions into a separate library that can be use from JS to do things like assoc_in on native JS datastructures. I got to thinking about this when building very small JS based frontends with van.js and I don't like the data model that LLMs default to. It would be far better if I could have a top level single-source-of-truth datastructure and do cljs-style manipulation on it. I wonder if this would be useful/interesting to anybody else or am I off chasing butterflies again?

Chris McCormick 2026-05-01T06:26:13.904519Z

Implementation is trivial:

export {
  get,
  get_in,
  nth,
  peek,
  contains_QMARK_,
  assoc,
  assoc_BANG_,
  assoc_in,
  update,
  update_in,
  conj,
  conj_BANG_,
  merge,
  merge_with,
  into,
  dissoc,
  dissoc_BANG_,
  pop,
  select_keys,
  empty,
  atom,
  deref,
  reset_BANG_,
  swap_BANG_,
  add_watch,
  remove_watch
} from './src/squint/core.js';

Chris McCormick 2026-05-01T06:26:32.701629Z

Build it like this:

npx esbuild squint-ds.js --bundle --minify --format=esm --outfile=squint-ds.min.js

Chris McCormick 2026-05-01T06:27:42.047289Z

This is something I have personally needed when working on JS codebases. I wonder if there is any interest on having this squint-ds.min.js artifact built and available on e.g. npm and CDNs? I could put together a PR against the squint repo if that sounds like a good idea.

borkdude 2026-05-01T06:56:31.896799Z

Why not use squint core directly ?

Chris McCormick 2026-05-02T10:43:51.990739Z

I'm thinking of the no-build use-case.

borkdude 2026-05-02T10:46:46.726329Z

you can use squint core without a build? it's just a lib

Chris McCormick 2026-05-02T10:57:57.141029Z

That's true.

borkdude 2026-05-02T10:58:49.754419Z

Having another lib re-export functions that already exist in the other lib should tell you this?

Chris McCormick 2026-05-02T11:00:45.586569Z

I guess the idea of having access to assoc etc. in a 1kb file excites me more than having it in a 61kb file.

borkdude 2026-05-02T11:08:42.643049Z

oh right, you want minified

borkdude 2026-05-02T11:08:44.966799Z

I missed that

borkdude 2026-05-02T11:35:02.711769Z

I think that's reasonable since we also already have a umd build