IRC channel logs

2022-02-12.log

back to list of logs

<rlb>wingo: ok, thanks. I thought maybe there'd been some mention of needing -j1 or something.
<stis>Hello guilers!
***karlosz_ is now known as karlosz
<blacked>What is guile programming language?
<blacked>What can i do with it?
***blacked is now known as pingpongball
<pingpongball>Lets say if i learn GUILE, devote my entire life on guile programming making projects, contributing.  what can i do if i want?
<pingpongball>Does guile have robust gui libraries, if i want to make something?
<pingpongball>like javafx, swing in java, QT based.......
<pingpongball>so this is guile manual
<pingpongball> https://www.gnu.org/software/guile/manual/guile.html
<alextee[m]>Is there an example guile script for writing xml to a file?
<vijaymarupudi>pingpongball: Guile has g-golf, which uses GTK. It's fairly complete, but still in development.
<vijaymarupudi>pingpongball: The sky is the limit with Guile, it has very good C interop, so if there's a C library for it, it'll work with Guile
<vijaymarupudi>pingpongball: Most importantly, the more time you spend with it, the more you'll
<vijaymarupudi>see that your thinking about programming changing and improving
<vijaymarupudi>alextree: (call-with-output-file "filename.xml" (lambda (port) (sxml->xml sxml-tree port)))
<vijaymarupudi>alextree[m]: ^^
<alextee[m]>vijaymarupudi: thx, found this also https://www.gnu.org/software/guile/manual/html_node/Reading-and-Writing-XML.html
<ArneBab>janneke: I used yours and dthompson's websocket-modules to build a game driven by the server via websocket: https://dryads-wake.1w6.org/ — thank you very much for that code!
<alextee[m]>is there a scheme style that looks similar to C? like with the brackets being in lines below so you can see where each "block" is
<alextee[m]>most of the code I find has things like `)))))` which makes it hard to write large code blocks
<vijaymarupudi>I think `))))` is considered the way to go. Do you have an editor that highlights matching parens?
<chrislck>alextee[m] if you use emacs the auto-indent will make you love your parens
<alextee[m]>vijaymarupudi: highlighting is useless if the matching paren is 100 lines above
<alextee[m]>I can only see 30 lines or so in my editor
<ArneBab>alextee[m]: when editing parenthesized scheme code, I depend on the echo area telling me which part I just closed.
<vijaymarupudi>Ah, in that case, jumping to the corresponding upper paren is how I do it, in vim it's % and in emacs it's C-M-b
<alextee[m]>ArneBab: chrislck I use vim (I know I know...)
<alextee[m]>vijaymarupudi: oh % is neat, haven't used it before. thanks
<vijaymarupudi>vim's % was saving my life in Guile before I switched to emacs (which was in the last 2 months)
<vijaymarupudi>You might also like this: https://github.com/junegunn/rainbow_parentheses.vim
<vijaymarupudi>And https://github.com/guns/vim-sexp
<vijaymarupudi>vim is surprisingly good to sexp languages, especially with having vim-surround handy
<vijaymarupudi>for*
<alextee[m]>neat, thanks
<chrislck>no matter what editor you use: don't.orphan.the.parens - they get lonely
<singpolyma>I agree that the common style of doing `)))))))` contributes to why outsiders find lisps unreadable. Similar problems to python
<singpolyma>But I don't think we'll ever convince lifters to let us use a delimiting style 🤷‍♂️
<alextee[m]>this has a nice example https://dthompson.us/rendering-html-with-sxml-and-gnu-guile.html
<alextee[m]>I'm not exactly sure how to output the top xml line though, or comments
<alextee[m]><?xml version="1.0" encoding="UTF-8"?>
<alextee[m]>ah you can use strings ""
<rekado_>sneek: botsnack
<sneek>:)
<rekado_>alextee[m]: (sxml->xml '(*TOP* (*PI* xml "version='1.0'") (hello "world")))
<alextee[m]>rekado_: ah neat, thanks. I see that mentioned towards the top in the manual but for deserializing
<alextee[m]>a serialization example would be nice under Scheme Procedure: sxml->xml tree [port]
<alextee[m]>I'll send a patch when I'm done
<alextee[m]>hmm what about comments? <!-- -- >
<alextee[m]>can't find an example and I think strings would get encoded
<tohoyn>daviid: here is my wishlist for g-golf: 1. fixing the <g-settings-action> bug 2. support for variants 3. inheriting from g-object classes.
<vijaymarupudi>alextee[m]: try (*COMMENT* "comment-string")
<vijaymarupudi>Assuming that Racket's SXML documentation applies: https://docs.racket-lang.org/sxml/SXML.html
<alextee[m]>vijaymarupudi: Invalid name starting character "*COMMENT*" *COMMENT*
<vijaymarupudi>Ah, never mind then
<mwette>program-bindings from (system vm program), documented in the manual, no longer exists. Anyone know the replacement?
<alextee[m]>the XML output seems to be all in one line
<alextee[m]>I guess it needs some kind of fold
<mwette>Yes. I often run my generated xml through a pipe to "xmllint --format"
<alextee[m]>I see the racket docs have an example here https://docs.racket-lang.org/sxml/srl.html
<alextee[m]>mwette: there's no way to do it via guile? seems pretty hacky but I'll go with xmllint if there's no simple way to do it
<rekado_>the sxml module in racket has more features than the one in guile
<rekado_>I suggest staying with the guile docs (or the sources of modules/sxml
<rekado_>)
<pingpongball>civodul :)
<pingpongball>shold i learn guile or common lisp
<rlb>To answer my earlier question, if you have a #! script (say test/something) that you've pre-compiled to test/something.go, you can get guile to use it via:
<rlb> #!./guile \
<rlb> -C . -s
<rlb> !#
<rlb>If you always plan to invoke it as test/foo.
<alextee[m]>this is kind of a noob question but is there a way to use variables (string type) inside a `() list and make the variable expand to its string?
<mwette>not clear
<mwette>(let ((foo "abc")) `(string ,foo)) => (string "abc")
<alextee[m]>er sorry '() not `()
<tohoyn>New version of Theme-D has been released. It contains improved support for quasiquote. See http://www.iki.fi/tohoyn/theme-d/.
<alextee[m]>mwette: https://paste.debian.net/1230672/
<alextee[m]>line 102 comes out as "desktop-file"
<alextee[m]>instead of expanding that string
<alextee[m]>same in line 128
<mwette>alextee[m]: yea '->` on line 54 would make it work, methinks
<alextee[m]>oooh I see the difference now https://www.gnu.org/software/guile/manual/html_node/Expression-Syntax.html
<alextee[m]>thanks mwette
<alextee[m]>had to also use ,desktop-file to make it expand
<alextee[m]>but it works now 👍️
<vijaymarupudi>I must say, zrythm looks really, really nice
<vijaymarupudi>I had no idea it existed, but now I'm hooked :)
<alextee[m]>: D it's really smooth now with gtk4 thanks to hardware acceleration
<vijaymarupudi>I would love to see zrythm on the frontpage of Guile's website: https://www.gnu.org/software/guile/ , next to GnuCash, Lepton-EDA, etc.
<vijaymarupudi>It's a nice visually striking example too :)
<vijaymarupudi>alextee[m]: That sounds great! Looking forward to breaking out my MIDI keyboard later today :)
<alextee[m]>👍️ if we could get it in the home pages of guile and gtk it would be good publicity
<alextee[m]> although the guile scripting functionality is kinda experimental and I don't know if anyone actually uses it yet: https://manual.zrythm.org/en/scripting/intro.html
<vijaymarupudi>Takes a while for stuff to stabilize :)
<hugo>Does Guile have a proper library for interpolating variables in strings, e.g. "Hello, ${name}"?
<hugo>I'm thinking of rewiving my old library which does so, and properly release it otherwise
<rekado_>hugo: it doesn’t. I rolled my own for the Guix Workflow Language.
<dsmith>hugo: Not strings, but there is quasi-quote. Which is lispier kind of thing.
<hugo>rekado_: Can you share a link?
<hugo>dsmith: I'm well aware, but for the "real world" you need strings, and writing converters for everything is often too much workk
<rekado_>hugo: https://git.savannah.gnu.org/cgit/gwl.git/tree/gwl/sugar/reader.scm#n29
<rekado_>note that for … reasons it’s entangled with a reader extension
<rekado_>it’s more complicated than what you might need
<hugo>rekado_: https://github.com/HugoNikanor/guile-fmt My code for comparison
<rekado_>it also does variable lookups in keyword lists
<rekado_>solves a slightly different problem
<rekado_>yours looks nice, though
<rekado_>(mine doesn’t build strings and thus doesn’t get to build format strings)
<hugo>I'm not completely sure how yours work
<hugo>But it sounds like I should do a propper release of my library
<alextee[m]>is there a way to do string split using string delimiters (not characters)?
<rekado_>hugo: the tests are here: https://git.savannah.gnu.org/cgit/gwl.git/tree/tests/sugar.scm
<rekado_>it’s a little too specialized to be generally useful
<rekado_>alextee[m]: do you mean matching delimiters? You could use the string index to find the first and then the next location of a delimiter, and then cut out what’s between
<alextee[m]>oh let me try that
<hugo>alextee[m]: Python solves it through regex, you could do the same (but manually) in Guile https://docs.python.org/3/library/re.html#re.split
<alextee[m]>hmm maybe using python will be easier here
<alextee[m]>i need to do some string manipulation and generate something based of it, so I could do the string manipulation in python and output an intermediary format that's easy to work with in guile
<rekado_>string-fold is nice
<spk121>I wrote printf in Guile once. https://github.com/spk121/mlg-lib/blob/master/module/ryu/printf.scm
<rekado_>if you can do all the work in one pass you can use string-fold to accumulate whatever result you want based on past results and the current position in the string
<alextee[m]>is there example code somewhere I can copy paste?
<alextee[m]>I basically need to split a string and pick some stuff from it and generate a list with the data, then I want to use that list to output xml elements
<alextee[m]>(generate appstream release entries from my changelog)
<hugo>spk121: Is that called as (printf "%i\n" 500) ?
<vijaymarupudi>alextee[m]: working on a example
<rekado_>alextee[m]: better to see example input and output
<spk121>hugo: yeah, or asprintf if you want a string
<rlb>alextee[m]: I had to implement that for lokke for clojure.string/split, but I also required pcre so that the rx syntax would be consistent across platforms, and I doubt that the code would be very useful to you.
<alextee[m]>rekado_: this is the input https://git.sr.ht/~alextee/zrythm/tree/master/item/CHANGELOG.md?view-source and the output would be something like <releases><release><version>abc</version><release><version>def</version></release></releases>
<rlb>fwiw (again, not likely useful to you directly): https://git.sr.ht/~rlb/lokke/tree/main/item/mod/lokke/ns/clojure/string.scm#L70-106
<alextee[m]>I was thinking to split on "## ["
<alextee[m]>rlb: that looks pretty complex
<rekado_>alextee[m]: are you aware of https://github.com/OrangeShark/guile-commonmark
<rekado_>?
<rlb>alextee[m]: thought I haven't used them, guile also has built-in lalr and peg parsers, depending on what you need.
<rlb>rekado_: hah, nice - hadn't seen that.
<rekado_>I’ve used the PEG parser. It’s fun.
<rekado_>there are also some examples in the Guix code.
<rekado_>(for the importers IIRC)
<alextee[m]>rekado_: looks neat, not sure if it's worth bringing in a dependency though
<hugo>My fmt code above also uses PEG!
<hugo>spk121: Your printf is nice, but fills the same role as guile's built in format
<rekado_>if it’s *just* for versions and nothing more then guile-commonmark is too much
<rlb>If it's just for simple rx/versions, perhaps just sed/awk/...?
<rlb>i.e. just use that to preprocess/extract up front or similar.
<alextee[m]>it's for most of the information like the list of changes etc but if I can split on strings I can hack something together
<vijaymarupudi>I think such a function should be in Guile tbh
<rlb>And if you stick to POSIX it should work everywhere.
<rlb>fsvo everywhere
<alextee[m]>rlb: yeah that's what I was thinking, just invoking some python even to get an easier-to-parse string
<alextee[m]>python is already a dependency
<rlb>oh, well then, yeah, that might be the easiest thing for now.
<rlb>I wondered about suggesting pcre as an optional guile ./configure --with..., and then maybe an ice-9 string split, etc. based on that, and I'd be happy to contribute the code for either/both, but for pcre at least, we'd probably want to wait until we switch to utf-8 since pcre can't handle guile's current strings directly...
<singpolyma>Could implement pcre in top of the PEGs also
<rlb>(Might also see if I could easily adapt what I have to work with the built-in rx functions if/when I get time.)
<spk121>hugo: yeah, everything in that library is kind of a joke. printf, trigraph support,
<vijaymarupudi>alextee[m]: I would double check edge cases, but maybe this? https://paste.gnome.org/phduk8ycp
<rlb>wingo, civodul: I've wondered about improving support for dialects that want similar enough semantics to guile/scheme. For example, I wondered about allowing a "language: lokke" declaration (like the "coding: utf-8" declarations), so that dialects don't have to re-implement some of the load path searching code if they just want what guile normally does.
<rlb>Otherwise, they have to (in some situations) re-implement and track changes to functions like primitive-load-path.
<rlb>?
<rlb>i.e. if they want the same load vs load-compiled search semantics, etc.
<rlb>(search and autocompile semantcs, etc.)
<rlb>But maybe that's not likely to be a general need; perhaps lokke is unusual in how closely it matches guile/scheme behaviors...
<rlb>i.e. clojure namespaces *are* guile modules, the 1-1 mapping, etc.
<alextee[m]>vijaymarupudi: thanks! trying to get it working, getting some errors now
<rlb>For now I suppose I'll just have to make lokke's load-file more sophisticated (and more likel primitive-load-path.)
<alextee[m]>vijaymarupudi: seems to work!
<vijaymarupudi>alextee[m]: Great! I'll might cook up a patch, I recall needing something like this multiple times in the past
<civodul>rlb: i think wingo is enthusiastic about providing #lang support as in Racket, and i concur :-)
<civodul>so yes, we could have "#lang lokke" at the beginning of a file
<rlb>Oh, ok - maybe that had been mentioned, and I forgot. Have to see how that works in racket.
<vijaymarupudi>Also interested in this feature :)
<lilyp>One minor problem with #lang is that it's not really cross-language, though
<faLUKE>hello. Is there a (more or less) easy way to install guile 1.8 on Ubuntu? I tried compiling sources, but I obtain a segfault
<lilyp>That's some ancient requirements you have – Guile 1.8 is available in Debian 8.
<lilyp>(Ubuntu 16.04 also carries it)
<faLUKE>lilyp: I'm using ubuntu 20.04
<lilyp>You might want to try to resurrect those ancient debs.
<faLUKE>lilyp: they carry a chain of dependancies, it's pretty hard and clumsy to make them work
<lilyp>Other than that, Guix carries a package for Guile 1.8 which will probably work but drive you down another rabbit hole :)
<lilyp>I do recommend getting Guix though
<faLUKE>lilyp: I use ubuntu unfortunately
<lilyp>I'll be away for a while, perhaps someone else has a better idea
<faLUKE>thanks anyway
<civodul>you can install Guix on top of Ubuntu
<civodul>however, i'd recommend avoiding Guile 1.8: it's been obsolete for years
<civodul>if you really need it, perhaps you'll find patches in Git in its branch
<faLUKE>sorry. just solved. for misteryous reasons I just could dkg install guile-1.8.deb
<faLUKE>dpkg
<civodul>great
<faLUKE>bbl
<mwette>I had a patch for #lang support in 2.2-era. I was just looking to add to guile-3.0.8 but it looks like some changes toward that direction may be there (e.g., compute-compiler in (system base compile). So some non-trivial changes there. Old stuff is here: https://github.com/mwette/guile-contrib/blob/master/patch-2.2.4/load.patch
<civodul>oh nice
<singpolyma>#lang would be cool. Right now I'm using a scheme wrapper script to get ecmascript loaded in places that just assume scheme and don't have a --language equivalent
<rlb>The main thing (I think) I'd want initially is the ability to have #lang choose the compiler, assuming that doing so, along with registering the dialect's file extension(s) would be enough to get normal behaviors for the files from the existing load/compile-related functions.
<mwette>my 2.2 thingy would look at #lang or file extension (via call to "add-lang-extension")
<rekado_>whenever I’m not identified with NickServ whatever I write here is silently dropped
<rekado_>in #bootstrappable at least I’m told that I can’t post when that’s the case
<daviid>rekado_: same for all of us i think, it would be nice to fix 'this' if possible
<rlb>I've wondered how corner cases should be handled, i.e. (use-modules (foo)) when say foo.scm, foo.clj, and foo.go exist in a dir (or in the load/compiled path(s)).
<rlb>s/i.e./e.g./
<dsmith>rlb: Here are two opeions: Either a search order (configurable?) and first one found wins, or an error if there is more than one.
<alextee[m]>I wrote a small example in doc/ref/sxml.texi, where should I send the patch?
<alextee[m]>guile-devel?
<alextee[m]>ok I see other patches in there so that's probably it
<alextee[m]>sent
***vijaymarupudi_ is now known as vijaymarupudi