IRC channel logs

2020-09-02.log

back to list of logs

***catonano_ is now known as catonano
<johnjay>does guile have an equivalent of melpa
<johnjay>where you can just download new things?
<str1ngs>johnjay: closest thing is guix
<str1ngs>johnjay: which you can run on ubuntu
<johnjay>aiee
<johnjay>no wonder you develop on it
<str1ngs>develop on which?
<johnjay>guix
<johnjay>i'll see if i can install it as you said
<str1ngs>johnjay: in the guix source is ./etc/guix-install . run that and have it user substitutes when it asks yes/no. it's that easy
<str1ngs>s/user/use
<johnjay>by the way i'm suprised you had to define something like find-first in util.scm
<johnjay>does guile not have basic things like that?
<str1ngs>in scheme/nomad/util.scm?
<johnjay>i think i'm in emacsy
<str1ngs>let me check what it's doing there
<johnjay>i only see it used once in event.scm
<str1ngs>he could have used (srfi srfi-1) find in place of that maybe
<johnjay>oh my bad
<johnjay>i thought you were the sole author
<str1ngs> https://www.gnu.org/software/guile/manual/html_node/SRFI_002d1-Searching.html
<str1ngs>no emacsy was created in 2013 for a google summer of code project.
<str1ngs>then kinda got not used. janneke cleaned it up. and I've been semi maintaining it
<str1ngs>but i'm not the author if you see the git logs
<johnjay>ah gotcha
<str1ngs>I'm the author of Nomad that uses emacsy. probably the only project that does. at least that I know of.
<johnjay>ah ok. so you kind of adopted it since it was useful for nomad
<johnjay>makes sense
<str1ngs>right, it makes sense. janneke is busy making hurd a thing :)
<str1ngs>contributions welcome too of course. :)
<johnjay>thanks.
<johnjay>just to sanity check myself, in scheme anything not #f is true?
<johnjay>because in srfi-1 it says find looks for the first one that satisfies the predicate. which means the same as it not being #f
<str1ngs>'() is #f
<str1ngs>try in a REPL
<johnjay>and his definition of find-first says that it looks for the first entry that is not false.
<johnjay>but that's the same thing
<str1ngs>thinking..
<johnjay>'() can be #f sometimes according to what i'm reading here
<johnjay>but most of the time it is considered true
<johnjay>which is weird coming from common lisp/elisp
<johnjay>(if '() 1 2) => 1
<johnjay>but yeah regardless idk if that definition makes sense or not
<brendyyn>,L elisp
<brendyyn>(if '() 1 2) => 2
<str1ngs>johnjay: '() is null not false btw
<johnjay>o_o
<johnjay>ok
<brendyyn>i think in scheme everything is true except for #f its self.
<str1ngs>right I confused things there for a second.
<johnjay>brendyyn: in this file it says to write a version of srfi-1::find that finds the first element that is not false, rather than the first one that is true
<johnjay>but that means the same thing. heh
<str1ngs>johnjay: I still think find could be used here
<str1ngs>with find you control the predicate anyways.
<johnjay>right
<johnjay>maybe emacsy isn't the best place to be poking around for scheme code to learn from then
<str1ngs>(find (lambda (i) (is-a? <buffer>) (buffer-list))
<str1ngs>johnjay: I think it's more there is many ways to skin a cat.
<johnjay>ye
<brendyyn>johnjay: guix is the largest application built on guile i think. im learning from that slowly.
<str1ngs>err (is-a? i <buffer>)
<johnjay>str1ngs: is emacsy mostly complete to what you want it to do?
<johnjay>for nomad that is
<str1ngs>not complete, but it suffices. I'll probably improve on it overtime. I'd like to replace coroutine.scm
<str1ngs>.... for example.
<str1ngs>johnjay: nomad is much better place to explore emacsy IMHO
<str1ngs>it has working buffers and minibuffer and a REPL
<str1ngs>emacsy is well designed in the big picture.
<str1ngs>johnjay: https://www.nongnu.org/emacsy/manual/emacsy.html is a good read. and covers nomad's use case as well.
<johnjay>ah yeah you're probably right
<chrislck>#nil is also falsy
<dsmith-work>UGT Greetings, Guilers
<apteryx>hello! what is the difference between a stable and non-stable sort?
<apteryx>i.e., sort vs stable-sort
<dsmith-work>Stable preseves order
<apteryx>I see, thanks. This is of importance when multiple items are "equal".
<dsmith-work>from wikipidea "maintain the relative order of records with equal keys"
<johnjay>question. when I do the example in the guile manual it doesn't display the output of $HOSTNAME
<johnjay>even though I have it set to something in the shell
<wingo>moo
<dsmith-work>johnjay: What example?
<johnjay>the guile manual starts out with an example of a function which calls getenv on the current shell to get HOSTNAME
<johnjay>but (my-hostname) in the prompt just prints $2 = #f
<johnjay>but echo $HOSTNAME is a string
<dsmith-work>Is it exported?
<johnjay>i have no idea what that means
<johnjay> https://www.gnu.org/software/guile/manual/guile.html#Linking-Guile-into-Programs
<dsmith-work>What says: env | grep HOSTNAME
<johnjay>hrm. it's blank.
<johnjay>how is $HOSTNAME defined then?
<dsmith-work>ok, then say: export HOSTNAME
<dsmith-work>and try your example
<dsmith-work>The shell has variables, and environmemnt variables.
<dsmith-work>They are set the same, but only when you "export" a variable does it go into the environment.
<dsmith-work>Oh, you can also set an env var tmporarily on the command line.
<johnjay>it's not my example. it works now lol what
<johnjay>so environment variables... are not the same as the variables.
<johnjay>sigh
<dsmith-work>Yeah. By "your example" I of course ment the example you were attempting.
<dsmith-work>In the shell, rigfht.
<johnjay>apparently i have to learn a little more about bash then
<dsmith-work>HOSTNAME=foo somecommant
<johnjay>right i know about that
<dsmith-work>will temporarily export HOSTNAME while running the command.
<dsmith-work>bash also has the extension: export VAR=Value
<dsmith-work>where it sets the variable and exports all in one go
<johnjay>ye
<dsmith-work>Hmm. This looks like it explains: https://bash.cyberciti.biz/guide/Export_Variables
<johnjay>dsmith-work: ok that makes more sense. a little
<johnjay>although it raises the question
<johnjay>was that guile example made on a different system where HOSTNAME was typically exported?
<johnjay>i'm on latest ubuntu and it isnt
<dsmith-work>It's just an example. Whoever wrote it probbaly assumed people know how the shell does ENV vars.
<johnjay>i guess so.
<johnjay>it's a bit jarring because it comes immediately after hello world
<johnjay>so you kinda expect something like that to "just work"
<dsmith-work>Probably better would be to return "localhost" in the else case. Or maybe raise an exception, though that's probably too much for a simple example.
<dsmith-work>The point of the example is how to add guile to a C prog, not how to read env vars.
<johnjay>right
<dsmith-work>I was working on an embedded linux thing with an LCD display running X. Worked great from command line. As root. Failed with a segfault on boot. As root!
<dsmith-work>Some library code was assuming HOME was set and was segfaulting on the NULL returned from getenv.
<dsmith-work>So. No guarantees env vars are set.
<wingo>so
<wingo> https://ecraven.github.io/r7rs-benchmarks/
<wingo>turns out, chez runs with a heap of around 170 MB
<wingo>minimum. by default.
<wingo>at least in the runs i have recorded
<wingo>makes gc overhead less than guile :P
<wingo>e.g. on cpstak guile runs in a heap of around 10 MB
<wingo>because working set size is not large. but frequent gc's, and a fair amount of overhead for that
<wingo>if you start guile with a similar heap size, speed is 2x as much
<dsmith-work>wingo: Sounds like it's time for initial-heap-size arg
<wingo>well there is GC_INITIAL_HEAP_SIZE, which you can set e.g. GC_INITIAL_HEAP_SIZE=150m
<wingo>not documented, but it is a libgc thing
<dsmith-work>Ahh.
<wingo>hum. maybe i am misinterpreting, i am using the maxresident from `time` but for chez i think i am running it under guix
<wingo>so perhaps the maxresident was for guix environment
<wingo>yarrr
<civodul>hey!
<civodul>"echo + | guix environment --ad-hoc chez-scheme -- time chez-scheme" suggests 41M maxresident
<civodul>"echo + | time guile" says 35M (REPL with guile-{readline,colorized})
<wingo>hey :)
<wingo>yeah my "time" invocation was inside, i think (?)
<wingo>and this is for running a file, not interactive
<wingo>so could be heuristics are different
<wingo>anyway, been thinking off and on about gc
<wingo>generally thinking about what is the next thing for guile
<wingo>well specifically thinking about perf anyway
<wingo>is it continuing to do compiler things, or is it jit improvements, or aot -- or is it the gc?
<wingo>i am thinking it may be the gc.
<wingo>which is complicated of course. bdw-gc is verrrrrrry good in its niche
<wingo>and us not havingn to maintain a gc is likewise very good
<civodul>it's also annoying at times, but yeah, not having to think too much about it is good
<civodul>it seems to me we have a top-notch compiler but an unoptimized runtime
<civodul>there are prolly things we can do there
<civodul>many small things and also bigger things (like UTF-8, maybe)
<wingo>honestly we are pretty good for the compiler, except lack of register allocation for native code.
<wingo>that will give us a good perf bump eventually but i think it may not be the lowest-hanging fruit
<wingo>it's irritating tho, and probably 100h-200h of work with C and the JIT could fix it; i just would prefer to not write more compiler in C. but perhaps that is simply irrational, dunno
<wingo>civodul: how is guile for guix right now? you are on 3.0 for everything, right?
<stis>hi guilers!
<wingo>heya stis :)
<civodul>wingo: yup, everything 3.0.4 even!
<civodul>it's doing good overall, though i'd really like to improve Guix perf all around
<civodul>most of the work is probably on the Guix side
<civodul>but there may also be a few things to do in libguile for instance
*wingo nod
<civodul>the other day i found replacing 'display' with 'put-string' in hot code had a noticeable impact
<civodul>as an example
<wingo>weird
<civodul>well, iprin1 (!) "does things" :-)
<civodul>even for display
<civodul>(which i didn't expect)
<civodul>then Guix uses 'write' a lot to serialize sexps, and that too is costly
<wingo>ah you mean put-string is faster
<civodul>yes
<wingo>yeah i can understand that
<wingo>hehe iprin1 :) a function of an old vintage, probably need to reclaim that part of the cave ;)
<civodul>:-)
<wingo>so for gc, if we ever wanted to do things there, the c interface is going to be a mess to evolve. possible but a mess
<wingo>so one thing is to move more and more things to scheme
<wingo>like we reclaim srfi-1, moving all that code back to scheme
<civodul>yes, that's a good idea anyway
<wingo>yeah
<wingo>so maybe that's the thing to noodle on in the short term
<civodul>i can help on this front
<civodul>yeah
<wingo>cool :) i think we can work on it just by committing replacements in scheme and directly deprecating the C versions
<wingo>maybe that is a bit harsh tho
<wingo>many c interfaces can be deprecated now and then removed in 3.2
<wingo>but some will need to remain and forward to scheme
<wingo>i guess for srfi-1 tho everything is internal already
<wingo>so we can just remove that c code; nice ;0
<wingo>:) rather
<str1ngs>hello wingo, a really cool guile target would be wasm.
<wingo>str1ngs: i agree :) i would rather wait until tail calls are there tho, otherwise things get needlessly gnarly
<wingo>the exception handling proposal also has an algebraic effects extension planned, which is neat :)
<str1ngs>wingo: understanble
<johnjay>dsmith-work: that's kinda lame
<str1ngs>wingo: I had read up on the tail call limitation for wasm as well.
<johnjay>i mean... how can you login without a home dir
<johnjay>i'd say the library is in the right in that case
<str1ngs>services login without a HOME all the time.
<johnjay>eh. this is why i prefer to program in anything but bash
<str1ngs>johnjay: are you using getpwnam?
<str1ngs>I believe they use this in the beginning of the guile manual.
<johnjay>yes it's in the hello part
<wingo>str1ngs: yeah it is quite tricky. https://docs.google.com/document/d/1oi6ROZJuE-hBb21Tgq-XcUegPktecF52gADzBJcYL34/edit#heading=h.1ugrinxqnqf has details
<str1ngs>johnjay: does that work okay? I think they use root for that IIRC
<johnjay>you're right they do
<wingo>the problem is that wasm has a kind of "realm" register that they want to keep pinned, and tail calls complicate that
<str1ngs>wingo: aye, maybe it's best to wait till wasm is better standardized/mature
<wingo>the standard is fine, it's the implementations that need to land. v8 has an implementation, though not optimized. spidermonkey wants to optimize before landing, but it's not a priority
<str1ngs>johnjay: getpwnam works okay though?
<civodul>wingo: the C functions for SRFI-1 are SCM_INTERNAL and can just be removed without further ado
<civodul>which is cool
<wingo>civodul: yeah that is cool!
<str1ngs>wingo: I've been meaning to play with wasm more. but I can't find a GNU specific way.
<wingo>would be nice if we could get efficient string manipulation in scheme, like if it could be as efficient as srfi-13
<civodul>oh you were talking about the other ones too
<civodul>yeah
<str1ngs>wasm woudl be real handy for Nomad. since we could avoid using JS
<civodul>people complained that string-contains is so naive
<dsmith-work>johnjay: The startup script that started the X server didn't set HOME. That's ok. The error was not checking return from getenv()
<wingo>maybe if we had sub-bytevectors and utf8, we could internally allow strings to expose their utf8 buffer. i am assuming we don't want to add cons strings and all that
<civodul>yeah
<wingo>we could allow strings to expose either a readable or a writable buffer, and do copy-on-write if needed...
<wingo>i think we have all the machinery for that, currently
<civodul>yes, more or less
<wingo>shared stringbufs are read-only
<wingo>i think
<civodul>yes
<civodul>but yeah, being able to expose buffers would be nice
<wingo>maybe you can make explicitly shared and mutation-sharing strings
<str1ngs>johnjay: I think the (getenv "HOME") could be improved. ideally it's not good to uses 'getenv without checking if it's #f.
<wingo>well, maybe that is a good 3.2 focus. improve the run-time, move more things to scheme
<wingo>maybe change to utf-8, maybe not :P
<wingo>maybe add utf-8, instead of replacing... i don't know.
<wingo>maybe we need a deprecation cycle for our strings -> utf-8
<wingo>maybe we get lloda to land his arrays :)
<civodul>yup :-)
<civodul>sounds like good ideas!
<dsmith-work>wingo: About strings and utf-8. Consider how Rust handles filenames as a different type.
<civodul>i was wondering also about low-end devices
<civodul> https://issues.guix.gnu.org/40626
<wingo>dsmith-work: yeah that is a different but related mess!
<wingo>civodul: istr we fixed statprof to be more helpful; you may want to update https://issues.guix.gnu.org/40626#5
<str1ngs>dsmith-work: I like the idea of paths as a type. I think SBCL does that too?
<str1ngs>or CL
<dsmith-work>I've heard CL has some very funky filesystem stuff. Handles weird non-posix things that pre-date unix.
<str1ngs>ahh forgive my CL ignorance. though path types are intresting
<johnjay>hrm. question about emacs. i know there's a ton of stuff glommed onto it like news readers or music players
<johnjay>is that the same as having them be in guile but separate?
<str1ngs>johnjay: not really, its more like gloomed *into* it.
<str1ngs>or w/e that word is :P
<johnjay>right but. why not just have your guile news reader, guile music player, guile hex editor, etc
<johnjay>what's the benefit of rolling them all up into an elisp blob
<str1ngs>it would not be like emacs, though say in nomad we have <terminal> so it's more like Emacs
<johnjay>right web browser is another thing
<johnjay>what i mean is is emacs just this way due to historical accident
<str1ngs>it's not one elisp blob though. its package that are auto loaded when needed
<johnjay>or is there some benefit to "giant program that does everything in scheme"
<dsmith-work>Heh. When emacs eventually uses Guile, that will all be there. (not likelly though)
<rekado>johnjay: if you are familiar with browsers as a platform for JavaScript applications then it’s a small step to see Emacs as a platform for Elisp applications.
<str1ngs>rekado: has a good analogy
<str1ngs>or think of it as eclipse but in elisp.
<johnjay>hrm. so it's like running programs on a virtual machine
<rekado>while browsers are rather heavy (*much* heavier than Emacs, by the way) you don’t consider web-delivered JavaScript applications as part of the browser and something weird.
<johnjay>right. i expect javascript to be in my browser
<str1ngs>johnjay: guile is more like a virtual machine. but yes much closer to a VM
<str1ngs>as in bytecode
<dsmith-work>I kind of think that emacs is current embodiment of the lisp machines of yore.
<johnjay>yeah it sort of is lol.
<dsmith-work>People use emacs as their X window manager!
*str1ngs breaks out his space-cadet keyboard.
*dsmith-work recently rewired CapsLock to be Hyper
*str1ngs dawns rocket suit.
<str1ngs>I use space as Ctrl leader
<johnjay>but have you required Menu to be Iso-Shift-level whatever
<johnjay>i'm on the verge of getting rid of my enter key
<johnjay>C-m is sufficient
<str1ngs>I never use C-m maybe I should?
<johnjay>well i kid. but i tried using emacs on bsd in the terminal and weirdness happened
<str1ngs>emacs treats C-m special it is hardwired to RET. not 'new-line
<johnjay>had to use ESC for meta and F1 for help, backspace didn't work
<str1ngs>err 'newline
<johnjay>also themes didn't work due to color limitations. tsdh-light was the only light theme that worked on low color terms
<str1ngs>for Nomad I use (define-key global-map (kbd "C-m") (lambda _ (insert #\newline)))
<str1ngs>though that will probably not work in a minibuffer
<johnjay>according to the guile manual the idea of guile is to be emacs but for everything
<johnjay>so browser has scheme, music player has scheme, etc
<str1ngs>right, re extensible
<johnjay>that's why nomad seemed interesting. i just haven't heard of a lot of things that use guile and that's the selling point
<str1ngs>there are things. like Lilypond GnuCash etc
<johnjay>the manual mentioned those. i'd never heard of any but gnucash
<str1ngs>I plan to take Nomad a step farther. nomad-shell will be a wayland compositor
<str1ngs>so ya, think of a desktop with a minibuffer etc
<str1ngs>jonsger: did you try M-x terminal btw?
<str1ngs>johnjay: ^
<ArneBab_>johnjay: Emacs provides the buffer as abstraction for operations which is also a user-editable datastructure. Looking at the sheer size of a simple IntelliJ plugin compared to the same functionality in Emacs, the Emacs design really shines. I have yet to see anything where it’s easier to add your own small tools.
<ArneBab_>johnjay: lilypond dominates musical score creation.
<dsmith-work>johnjay: Were you using emacs in a terminal or in X? (you get much more key code options when in X)
<ArneBab_>johnjay: It’s like the LaTeX of music score creation, except that there doesn’t exist anything like MS office that gets even close.
<johnjay>dsmith-work: in terminal
<johnjay>bsd forces you to install x lol
<johnjay>ArneBab_: i guess lisp shines in adaptability the most? idk
<johnjay>IntelliJ sounds like some massive 1G eclipse plugin
<johnjay>also it's kind of weird gimp dosen't use guile
<johnjay>i think it uses tinyscheme or something
<ArneBab_>johnjay: it’s not just that. It’s also stuff polished by time.
<ArneBab_>1G? I give it 16G to keep IntelliJ fast :-)
<johnjay>ah ok
<johnjay>it kind of puts the guilemacs question into perspective
<johnjay>when you ask for guile emacs do you mean a guile text editor or do you mean every emacs package ported to scheme? different hings
<str1ngs>ArneBab_: btw not exactly related to your GI_TYPELIB_PATH issue the other day. but I've improved nomad's declaration to not use propagation at all now. probably submit a patch in the next couple of days.