Fork me on GitHub
#off-topic
<
2021-08-12
>
lilactown19:08:56

tl;dr there's a project that compiles sqlite3 to wasm so you can use it on the client, and jlongster implemented an IndexedDB backend for it so that you can persist data across sessions

mauricio.szabo20:08:21

So... I was playing around with nbb recently (Babashka, but for Node, please check it out, it's quite fun!) and decided to try something really weird - make deref work the same as Clojure (so "block" the main thread). That's not really possible with Node.JS (you can't "block" the main thread) but hey, we're abstracting away the interpretation over SCI, why not give it a try? I found an interesting side-effect while I made the first incomplete (but already kind of working) proof-of-concept: top-levels became full async! So, the code below:

(def p (promises/delayed 200 1))

(def a (+ @p (inc 1) (+ @p (inc @p))))

(defn foo [] (let [a (+ 1 @p)] a)
  (defn bar [x] (+ x (foo))))

(prn :FIRST a)
(prn :SECOND (get {:a @p :b @p} :a))

(defn foo [] (let [a (+ 1 @p)] a))
(defn bar [x] (+ x (foo)))
(prn :THIRD (bar 10))
Would print :SECOND 1, then :THIRD 12, and finally :FIRST 6. At first I thought it was an weird bug, but looking better, it seems that as these "top levels" don't depend on each other, they can run whenever they are "ready", without having to wait for the previous one to run. So... it's not a bug, it's a feature? :rolling_on_the_floor_laughing:

borkdude20:08:13

you could make top-level "promises" sequential, but that would be an opinionated choice... what if users don't want that behavior? :)

mauricio.szabo21:08:14

Hahahaha, yeah, the problem is that the user will not have a way to know that they are "promises" 😄.

borkdude21:08:47

but you can discover if you have your own promise type at the top level right?

borkdude21:08:58

so then you should probably handle them sequentially

borkdude21:08:13

to preserve the semantics of normal program execution

borkdude21:08:51

because there is no other way how your promise type could have ended up on the top level if there wasn't a deref

mauricio.szabo14:08:36

Well, I ended up fixing it, but it was somehow interesting to see that strange behavior. Somehow, it remembered me of Haskell's IO ideas.

borkdude15:08:35

except that the IO monad pollutes your code a lot while this isn't actually noticeable at all :)

👍 3
p-himik21:08:34

Another nice quote from "Tools For Thought", by David Rodman this time: > A really good program designer makes an artist out of the person who uses the computer, by creating a world that puts them in the position of 'Here's the keyboard, and here's the screen. Now once you learn a few rudimentary computer skills, you can be a superstar.'

sova-soars-the-sora21:08:03

That's great! And there is a wide spectrum for that. I'm thinking of Word/Pages as word processors... let you make books basically! And then there's stuff like Social networks that let you be an artist in a tiny bounded submission box (with photo option), and then there's Visual Basic that lets you make pretty sophisticated desktop programs without the need for much code... This also reminds me of designing musical instruments. Ableton is a DAW (digital audio workstation) and they have created a physical piece called the Push (Ableton Push... v3 already?) and it can basically turn anyone with some simple music opinions into a powerful artist with recording, looping, setting up voices / instruments, and ensuring that all the buttons on the Push are in the key you specified so there's never a "wrong" or out-of-context note. Pretty legit, and kinda along the lines of good program design ... good instrument design.

p-himik03:08:41

Yeah, those are good examples. Shame we can't easily bridge the gap between "that looks interesting but I don't believe I can do it" to "I'm actually gonna try it". At least, not en masse.

jkxyz11:08:59

I really liked this essay on computers and creativity: https://www.mollymielke.com/cc

p-himik12:08:02

Thanks, I'll take a look!

idiomancy21:08:40

hey, this is such a dumb question, and totally off topic, even for this channel, but... I'm really trying to learn to get into American football and none of my friends are into it.. so I have no one to ask: Does anyone here know how to watch/stream American football games? Like there's a pre-season game tonight, how would I watch that? Do I need a cable subscription? Is there some package I can buy that lets me watch all the games in the season? Is there any way to watch them for free? Can you watch them streaming online or do I need, like, an antenna? I'm so sorry. This is so basic. I feel it. I feel the basic.

dpsutton21:08:44

if you are in the US you can get a cheap digital antenna and watch the broadcasts on nbc/abc/fox if you have a local station. otherwise kinda anywhere you can stream television. hulu and youtube both have options although it's usually about $70 a month for live tv

dpsutton21:08:02

and for $50 a year you can get https://watchnfl.tv/ which purports to stream every nfl game live

idiomancy21:08:04

actually, I think that says that blackouts are in effect, which I think means games that are local to you (I am in the US) don't get streamed because cable companies have some kind of ownership?

idiomancy21:08:18

right? I had been learning about this recently in regards to baseball

seancorfield21:08:16

@idiomancy A blackout means the game is not sold out so if you are local, you usually can't watch it on TV locally -- you have to attend in person (but you can usually see it via cable/satellite via some service, regardless of where you live).

seancorfield21:08:32

If a game is sold out, they also let it air on local TV.

seancorfield21:08:26

(according to my wife who is the massive sports fan in this house -- I've lived here 22 years and I still don't "get" American football!)

idiomancy21:08:15

wow that's great intel! thank goodness for partners who are cooler than we are!

idiomancy22:08:14

(and thank goodness for clojure community members who are cooler than me :P)

seancorfield22:08:52

My wife is definitely a Very Cool Person 🙂

Alex Miller (Clojure team)22:08:21

well she obviously has good taste Sean ;)

😄 6
3
18
3
3