Fork me on GitHub
#squint
<
2023-12-01
>
Cora (she/her)19:12:09

heh, I didn't realize we had str/split-lines and friends in squint

borkdude19:12:25

a lot has been added :)

borkdude19:12:29

not all of it though

Cora (she/her)19:12:37

that's still very helpful

Cora (she/her)19:12:43

it would be nice if we had slurp too

borkdude19:12:03

that's probably too platform-dependent

Cora (she/her)19:12:12

plus async vs sync

borkdude19:12:37

yeah. I have slurp in nbb.core but I'm not happy with it, it's now async while most of the time I just want to do fs/readFileSync UTF-8

borkdude19:12:59

the idea was to also add fetch + .text to it once fetch is available everywhere

borkdude19:12:22

can fetch also read files? :)

Cora (she/her)19:12:26

squint's could!

borkdude19:12:51

I mean without writing platform-specific code

borkdude19:12:51

neh, just use the node API for now

borkdude19:12:58

I read on SO that they don't support this

borkdude19:12:24

but who needs this if you can use the playground :)

Cora (she/her)19:12:35

yeah I couldn't get it to work in a console, it's complaining about file fetching not being implemented yet

Cora (she/her)19:12:47

"yet" is interesting, but it doesn't help me now

Cora (she/her)19:12:00

> Uncaught TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: not implemented... yet...

borkdude19:12:41

> about file fetching not being implemented yet This is because you haven't filled in your AOC token

Cora (she/her)19:12:56

oh, no, this is locally, trying to use fetch in a node console to get local files

borkdude19:12:10

try Node 20 or 21 or so

borkdude19:12:20

I use nvm use 20 which has fetch

Cora (she/her)19:12:32

this has fetch, it just doesn't support fetching from the filesystem

Cora (she/her)19:12:47

but it teases that it's a possibility by saying "not implemented... yet...

borkdude19:12:53

yeah they will never support this probably

Cora (she/her)19:12:42

āÆ node --version
v20.10.0
āÆ node
> fetch('file:///Users/cora/Code/aoc-2023/1')
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 97,
  [Symbol(trigger_async_id_symbol)]: 6
}
> Uncaught TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: not implemented... yet...

šŸ‘ 1
Cora (she/her)20:12:44

about the playground, where do you find the AOC token?

Cora (she/her)20:12:23

feeling like a dummy because I can't see it anywhere

Cora (she/her)20:12:38

ahhh you explain it here

borkdude20:12:58

yeah, look into your cookies on http://adventofcode.com :) I could have been clearer

borkdude20:12:29

beware of using an ns form, it doesn't work properly I'm fixing that right now. Just (require '["...."]) does work

borkdude20:12:41

or use (ns user ...) that also work, any other name doesn't

borkdude20:12:47

fixing this as we speak

1
Cora (she/her)20:12:28

it would be nice to be able to contribute to the playground, I really want a way to clear the output and to colorize compiler output

borkdude20:12:21

Feel free! The source is all in index.html :)

borkdude20:12:45

I just pushed the ns problem fix

borkdude20:12:05

(Github pages takes a minute or so to update)

borkdude20:12:40

I think you could just use the codemirror JS mode to display colorized output

borkdude20:12:46

and make the editor non-editable

Cora (she/her)21:12:48

I'm iffy on the formatting bits, but water.css is a simple add that makes everything look better.

borkdude21:12:31

Much better!

borkdude21:12:24

I think one minor improvement to showing results could be to partially show lazy results, like the first 20 elements or so

borkdude21:12:44

such that you don't have to call vec or doall on it every time

Cora (she/her)21:12:14

a progress spinner while evaluating would be nice too

borkdude21:12:50

I pushed something for displaying lazy results

borkdude21:12:01

sorry for the formatting ff-ups, my emacs isn't configured for this

Cora (she/her)22:12:57

no worries, my emacs isn't either, but I also use vs code and that's good at these languages

Cora (she/her)22:12:46

that looks great

Cora (she/her)22:12:23

what adds the AOC token form?

Cora (she/her)22:12:31

it needs to be styled so it's inline

borkdude22:12:53

> what adds the AOC token form? not sure if I understood it

borkdude22:12:27

that is the boilerplate= search param

Cora (she/her)22:12:36

ahhh, ok, I see

borkdude22:12:49

you can propose some changes for that too of course!

Cora (she/her)22:12:03

I wrapped the AOC form elements in a div and made it display as a row with appropriate spacing

borkdude22:12:24

easy to try out: https://squint-cljs.github.io/squint/?boilerplate=https://gist.githubusercontent.com/corasaurus-hex/17679ab93204ae2cdf7775eed9379a5f/raw/01a1dc7dde320f3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CiAgW3hzXQogIChqcy9wYXJzZUludCAoc3RyIChmaXJzdCB4cykgKGxhc3QgeHMpKSkpCgooZGVmbiBtYXRjaGVzLT5udW1iZXItMgogIFt4c10KICAobGV0IFtudW1iZXJzIChtYXB2IHRleHQtPmRpZ2l0IHhzKV0KICAgIChqcy9wYXJzZUludCAoc3RyIChmaXJzdCBudW1iZXJzKSAobGFzdCBudW1iZXJzKSkpKSkKCigtPj4gKGpzL2F3YWl0IChzbHVycCAxKSkKICAgICBwYXJzZS1saW5lcwogICAgIChtYXAgbWF0Y2gtbnVtYmVycy0xKQogICAgIChtYXAgbWF0Y2hlcy0%2BbnVtYmVyLTEpCiAgICAgKHJlZHVjZSArKQogICAgIGFwcGVuZCkKCigtPj4gKGpzL2F3YWl0IChzbHVycCAxKSkKICAgICBwYXJzZS1saW5lcwogICAgIChtYXAgbWF0Y2gtbnVtYmVycy0yKQogICAgIChtYXAgbWF0Y2hlcy0%2BbnVtYmVyLTIpCiAgICAgKHJlZHVjZSArKQogICAgIGFwcGVuZCk%3D

borkdude22:12:29

looks a lot better!

Cora (she/her)22:12:41

actually let me link to your explanation for how to get the token, too

borkdude22:12:06

yeah indeed... also on exception in the fetch function we could display some helpful info too

borkdude23:12:07

I'll look forward to an updated gist tomorrow, šŸ˜“

1
borkdude23:12:10

I'm trying to come up with a better util.inspect implementation for LazyIterable but I don't know how to do this "after the fact". I added a custom toString() on LazyIterable. If you undo the custom printing in index.html and then do:

(unchecked-set (.-constructor (range))
  js/util.inspect.custom (fn [this] "hello" #_(str this)))
I expected it to work, but it doesn't. Ah well, tomorrow.

borkdude23:12:45

I pushed the lazy + toString to a branch called lazy_print if you're interested

Cora (she/her)23:12:58

I hit my timebox for adding a tooltip with instructions for how to get the token

Cora (she/her)23:12:29

not sure what's up

Cora (she/her)23:12:41

I need to play with it to figure it out but it's my birthday and I'm off to dinner

šŸŽ‚ 1
borkdude23:12:11

congrats! happy birthday!

thanks3 1
Cora (she/her)19:12:36

I haven't gone back and figured out the help text yet, or clearing the append output and sticking it in a container

Cora (she/her)00:12:45

the hover was janky and busted

Cora (she/her)00:12:19

also introduced a css utility class thing for styling that form, makes it more understandable what all is going on

Cora (she/her)01:12:01

ok, added a button for clearing the output and added timestamps to all the output

Cora (she/her)01:12:08

and put a border around the output

Cora (she/her)01:12:29

that's all for me tonight

borkdude10:12:46

updated, thanks!