IRC channel logs

2022-12-10.log

back to list of logs

<cow_2001>i have this urge in me to do lazy stuff like in haskell in guile but i need to learn how to do it first.
<singpolyma>I'm sure you mean lazy stuff (like Haskell) in guile but my brain read lazy stuff (like Haskell in guile)
<cow_2001>what's the difference?
<cow_2001>my brain is locked into one interpretation
<cow_2001>you can have a sort of [n..] with (define (f n) (cons n (lambda () (f (1+ n you count the parentheses without paredit
<cow_2001>but not really
<cow_2001>oof
<singpolyma>(like Haskell in guile) would be, you know,writing Haskell code (Haskell syntax etc) and running it in guile
<cow_2001>oh boy. you'd need an haskell interpreter / compiler written in guile
<cow_2001>how big is haskell anyway?
<gnucode>cow_2001: quite complicated. Guix is having a hard time bootstrapping haskell.
<singpolyma>Written in something guile understands anyway. One route might be to use a haskell->js compiler to compile a haskell compiler then run the JS on guile (though I'm sure the ecmascript mode would need some love before that worked)
<cow_2001>oh boy.
<cow_2001>O_O
<cow_2001>you have a javascript inside guile?
<cow_2001>everyone nowadays have a wasm
<singpolyma>Yes, guile ships with ecmascript, scheme, emacs lisp, and brainfuck
<cow_2001>O_O
<singpolyma>There are also Lua and python in development out of tree
<cow_2001>1.5 Supporting Multiple Languages
<cow_2001>doesn't say how
<cow_2001>(language brainfuck)
<singpolyma>If you read the "compiler tower" section of the manual you'll get the idea I think. For historical reasons most of the manual covers the scheme implemention but the compiler tower is the important thing that makes guile itself and the scheme is quite frankly optional
<singpolyma>(though useful and popular)
<cow_2001>wow. O_O
<cow_2001>so it's a sort of like... jvm?
<cow_2001>this is probably statospherically above my head
<singpolyma>It's a different strategy than jvm, prioritizing ahead of time compiling, but there's an analogy there for sure. I usually compare it more to graalvm because of the polyglot-ness
<singpolyma>If you like scheme and just use it as a scheme engine that's totally fine if course. Just as if you like elisp and use it as an elisp engine that's also fine
<old>cow_2001: you can already do some kind of lazy evaluation with `delay` and `force`
<old>I don't know any Haskell, but I suppose argument are evaluated when used in the function right?
<old>In that case, a compiler is needed I'm guessing
<cow_2001>[1..] is the infinite data structure of a list 1, 2, 3, and so on
<cow_2001>you can [1..] !! 2 and it'll give you 3 without actually creating all natural numbers
<cow_2001>i think
<cow_2001>it's common to zip such a list with something else to enumerate that something else
<cow_2001>(i think)
<cow_2001>old: isn't (define (f n) (cons n (lambda () (f (1+ n))))) a bit like that lazy thing? except you have a bunch of API around it
<cow_2001>(define (f n) (lazy (delay (cons n (f (1+ n)))))) and (force (f 0))
<old>cow_2001: check for SRFI-41
<old>for streaming
<old>by lazy I meant that calling `(f a b)`
<old>`a` and `b` are not evaluated before being applied to `f`. Instead, they are evaluated at the moment that they are used in `f`
<old>or something like that
<haugh>I hate the attribute syntax in sxml/shtml. We have keywords now; why not use them? Am I missing something about the functionality of (foo (@ (bar baz))) as opposed to (foo bar: baz)
<haugh>or am I just young and spoiled
<haugh>if it's just backcompat I get that
<lilyp>I think with attributes it's be a little quirky to differentiate children from them
<lilyp>that's a big problem with #:rest too
<dokma>Has anyone used sqlite from Guile?
<dokma>Is there any official api?
<dokma> https://notabug.org/guile-sqlite3/guile-sqlite3
<dokma>Would that be the "official" one?
<civodul>dokma: the one above is used by a bunch of projects, notably Guix-related
<dokma>civodul: you're the author if I caught that correctly?
<civodul>dokma: i and others contributed to it, but i think it was started long ago by wingo
<dokma>oh I see...
<dokma>I guess that is the way to go...
<dokma>Thank you
<civodul>yw!
<mwette>lazy eval in Scheme can be performed with promises: (define x (delay (+ 1 2))) .... (+ (force x) 3) => 6
<mwette>and there is a multi-threaded version: futures