squint

Chris McCormick 2025-08-24T10:01:11.435519Z

I wanted to enter the js13k game jam. I wanted to use "ClojureScript". I wanted to use "Reagent". Is there some way I could build a <13kb artifact with these constraints? Seems impossible. Solution: I forked https://bitbucket.org/sonwh98/mr-clean/ and spent two sleepless nights slop-coding it to build with squint-cljs , and somehow it worked! Demo: https://chr15m.github.io/eucalypt/ <- 10kb index.html + js + CSS artifact 😀 Demo source: https://github.com/chr15m/eucalypt/blob/main/demo/main.cljs Library: https://github.com/chr15m/eucalypt Tradeoffs: if you squint hard enough it looks like Reagent, but it certainly isn't. It's very much a scrappy fiddle. Lots and lots of bugs, and I used an LLM to slop-code it fast. That said, I plan to iterate on this, put together some tests etc. so maybe it will be useable in future. Of course you're welcome to take it for a spin and PRs are most welcome!

🆒 4
🔥 7
4
Harold 2025-09-11T21:39:59.075209Z

Ok, this doesn't work for the game jam, for well, reasons, but it's mental and potentially fun for other purposes:


  
    
  
  
    
    
  

1
👏 2
Harold 2025-09-11T21:42:43.997849Z

indentation brought to you by whatever HTML+ mode in emacs feels like doing with whatever this is. Ha! 🤭

😆 1
Chris McCormick 2025-09-23T09:23:05.240529Z

I got the Reagent homepage demos working with Eucalypt, including the Todo MVC demo. https://chr15m.github.io/eucalypt/ 👇 Also lots more tests.

🆒 2
🚀 3
Chris McCormick 2025-09-23T09:23:21.432549Z

RUN v1.6.0 /home/chrism/dev/eucalypt ✓ src/test/src/standard_attributes.test.mjs (3) ✓ src/test/src/multiple_instances.test.mjs (3) ✓ src/test/src/fragment_clickable.test.mjs (1) ✓ src/test/src/component_switching_bug.test.mjs (1) ✓ src/test/src/attribute_handling.test.mjs (6) ✓ src/test/src/list_rerender.test.mjs (2) ✓ src/test/src/todomvc.test.mjs (10) 1473ms ✓ src/test/src/multiple_select.test.mjs (1) ✓ src/test/src/nested_fors.test.mjs (3) ✓ src/test/src/range_slider.test.mjs (2) ✓ src/test/src/radio_buttons.test.mjs (1) ✓ src/test/src/enter_to_submit.test.mjs (1) ✓ src/test/src/various_events.test.mjs (3) ✓ src/test/src/timer.test.mjs (1) 675ms ✓ src/test/src/boolean_attributes.test.mjs (1) ✓ src/test/src/basic_components.test.mjs (4) ✓ src/test/src/select.test.mjs (1) ✓ src/test/src/checkbox.test.mjs (1) ✓ src/test/src/list_demo.test.mjs (1) ✓ src/test/src/numeric_input.test.mjs (1) ✓ src/test/src/select_attribute.test.mjs (1) ✓ src/test/src/fragment_switching.test.mjs (1) ✓ src/test/src/style_attribute.test.mjs (1) ✓ src/test/src/prop_change_rerender.test.mjs (1) ✓ src/test/src/text_input.test.mjs (1) ✓ src/test/src/ref.test.mjs (1) ✓ src/test/src/various_renderings.test.mjs (6) ✓ src/test/src/textarea.test.mjs (1) ✓ src/test/src/svg.test.mjs (1) ✓ src/test/src/local_state_rerender.test.mjs (1) ✓ src/test/src/click_swap.test.mjs (1) ✓ src/test/src/simple_component.test.mjs (1) ✓ src/test/src/empty_fragment.test.mjs (1) ✓ src/test/src/stateful_component.test.mjs (1) Test Files 34 passed (34) Tests 66 passed (66) Start at 17:22:35 Duration 4.06s (transform 268ms, setup 3ms, collect 3.05s, tests 3.30s, environment 9.14s, prepare 4.60s)

Chris McCormick 2025-09-23T09:24:09.832049Z

688 lines of vibe-coded squint-cljs. 😹

borkdude 2025-09-23T09:25:06.240839Z

w000t!

borkdude 2025-09-23T09:25:44.447779Z

this is insane :)

😄 1
Chris McCormick 2025-09-23T09:30:15.540539Z

I'll post something to #announcements if I can get it to the point where I trust the LLM generated code enough not to be completely embarrassed. I think I just need a lot more tests to get there.

borkdude 2025-09-23T09:33:52.610149Z

ok

Harold 2025-09-23T15:20:21.878389Z

I love how were at this funny moment in history where caring people are trying not to be embarrassed by their use of llms ("Why didn't I use chatGPT to do the calculations? Because I wanted them to be correct."), while other people are like, "Look at this amazing thing I made!" 🙂

Chris McCormick 2025-09-13T00:32:55.731849Z

I didn't get a game done in time, but I https://github.com/chr15m/eucalypt/tree/main/test/src. Still heaps of bugs though and I don't know if this Reagent-like-in-Squint angle is worth pursuing. 🤔 I may pursue it anyway just because it feels like something I will need in the future.

Harold 2025-09-13T01:16:15.624469Z

I got a lot of tests workingThat is rad.

Chris McCormick 2025-09-25T08:57:08.335039Z

It's a weird time for sure. I makes sense that can be true at the same time if you consider LLMs to be a new and powerful tool with many footguns.

👍 2
borkdude 2025-08-24T10:05:07.531329Z

This is amazing :)

😀 1
borkdude 2025-08-24T10:06:43.756129Z

btw preact could maybe also work if you want normal react API?

borkdude 2025-08-24T10:06:53.118579Z

3kb

borkdude 2025-08-24T10:07:08.689389Z

this is what the cljdoc front-end uses

borkdude 2025-08-24T10:08:58.690379Z

but I admire your courage to implement reagent from scratch in squint :)

😅 1
Chris McCormick 2025-08-24T10:46:58.894129Z

I tried out Preact and Hyperscript - I will look at them again to compare. Mostly it's about having a Reagent-like API.

👍 1
Harold 2025-08-24T13:04:47.761499Z

Wild. Another potentially useful data point (lying somewhere in a similar space to reagent / mr clean) would be replicant: https://github.com/cjohansen/replicant It's not 'reagent compatible' per-se, but it has a related (though simplified, and more data-oriented) model, and is small (no react dep)

👍 1
Chris McCormick 2025-08-24T13:32:44.890359Z

It would make a lot of sense to use replicant as a rendering engine. I wonder how hard it would be to get it to compile with squint? 🤔

👍 1
🙂 1
🤔 1
Harold 2025-08-24T13:39:00.360809Z

This is a cool thread - I'm a big fan of delivering small artifacts

Harold 2025-08-24T17:27:07.211159Z

It occurred to me that another fun possibility here would be to use p5.js, compile the game code with squint, and feed both through the closure compiler to try and tree shake / minimize it down below 13k. The first thing I tried didn't work (the p5.js file has some undefined stuff according to the closure compiler):

COMPILER_FILE="closure-compiler-v20250706.jar"
COMPILER_URL=""

if [ ! -f "$COMPILER_FILE" ]; then
    echo "Closure compiler not found. Downloading..."
    cCOMPILER_URL -o "$COMPILER_FILE" "$COMPILER_URL" || wget -O "$COMPILER_FILE" "$COMPILER_URL"
else
    echo "Have closure compiler."
fi

P5_FILE="p5.js"
P5_URL=""

if [ ! -f "$P5_FILE" ]; then
    echo "p5.js not found. Downloading..."
    cP5_URL -o "$P5_FILE" "$P5_URL" || wget -O "$P5_FILE" "$P5_URL"
else
    echo "Have p5.js."
fi

java -jar $COMPILER_FILE \
  --js p5.js \
  --js game.js \
  --compilation_level ADVANCED_OPTIMIZATIONS \
  --js_output_file game.min.js
But maybe it could be a starting point if someone wants to try.

👀 1
rafaeldelboni 2025-08-24T19:14:29.836539Z

Dude you are in another level! Crazy cool