IRC channel logs


back to list of logs

<leoprikler>ane: I don't think so. What if you are loading a compiled module without sources?
<leoprikler>though I have little knowledge over with-coverage-data and its intrinsics
<remby>is r6rs complete?
<remby>yeah I suppose so, the html docs say so, but the info says otherwise
<ryanprior>How do you read the Guile reference materials in Emacs?
<ryanprior>Found my answer: C-u M-x info, then select the guile info docs
<remby>info, search guile
<remby>that too
<ryanprior>How often are vectors used in idiomatic Guile?
<ryanprior>Coming from Clojure I make heavy use of vectors by habit. But comparing SRFI-43 to SRFI-1 it seems like Guile supports a much richer API for linked lists than for vectors.
<chrislck>well... guile is a lisp, not vecp
<ryanprior>I appreciate that chrislck =D
<chrislck>depends how you tend to use your data... sequential? random? need to append constantly?
<ryanprior>Random, few appends
<chrislck>if length is <100 likely equivalent performance but lisp/guile does teach you/require that you use lists well
<ryanprior>I do work with enough data that using linked lists is not an option
<ryanprior>Some typical operations might be to take a slice of from some offset to another, or from the offset searching forward until a predicate returns false, or every nth element.
<ryanprior>I'm looking for ways to do those things in Guile :)
***chrislck_ is now known as chrislck
<ryanprior>How do you look for features you want to use in Guile?
<ryanprior>For example, I'd like to partially apply a function. I tried searching the info docs for "partial" but there's a ton of hits, hard to know how many total, and I looked at a couple dozen that didn't apply before giving up.
<ryanprior>I tried searching for "partial appl" and there's no hits.
<ryanprior>I tried searching DuckDuckGo for " guile partial application" and all the hit are for packages in Guix that do partial application in some other language like common lisp or python
<ryanprior>So regardless of whether you know how to partially apply a function in Guile, if you're in my shoes and don't know and want to find out, what's the winning strategy?
<remby>ryanprior: is that also known as currying?
<remby>if it's a general concept it might just do to search with "scheme language" instead of guile
<RhodiumToad>there is srfi-26
<ryanprior>They are related but not the same! With currying, every function takes exactly 1 argument, so for n arguments you do n applications. With partial application, you can specify multiple arguments per partial application.
<remby>oh I see
<RhodiumToad>(cut foo 1 <>) returns a function of one arg which calls (foo 1 x) on that arg
<ryanprior>Okay srfi-26 does look helpful, I can get some mileage out of that. In general though how do you find which srfi gives you what you want? There's hundreds of em, do you have the most useful ones memorized?
<RhodiumToad>I have found that frustrating
<ryanprior>There's a list of implemented ones in the info manual, but beyond just scanning the one-line descriptions in that list, I don't know how to search in info manuals very well.
<RhodiumToad>it's often not at all obvious that some srfi applies to some task, and also there are often several srfi's to do exactly the same thing
<RhodiumToad>e.g. srfi-8, srfi-11, srfi-71
<RhodiumToad>(of which srfi-8 is a bit limited, srfi-11 is paren hell even by lisp standards, and srfi-71 relies on redefining standard syntax)
<ryanprior>lmaoooo the entry for sfri-8 says "documented in 'Multiple Values'" and the entry for Multiple Values says "(see SFRI-8)"
<ryanprior>[pointing spider mans intensifies]
<RhodiumToad>srfi-8 is the (receive) syntax defined under "Multiple Values"
<RhodiumToad>it's provided by including either (ice-9 receive) or (srfi srfi-8)
<ryanprior>Unfortunate that srfi-26 implements cut but not partial or right-partial. And cut can be used in place of partial, sure, but it can't be used in place of rpartial with a variable number of arguments.
<RhodiumToad>that seems harder to do efficiently
<ryanprior>The implementation would be something like
<ryanprior>(defmacro (right-partial f #:rest args) (lambda (#:rest more-args) (apply f (append more-args args))))
<RhodiumToad>I think append! would be safe there
<ryanprior>Yes that would make sense
<RhodiumToad>I'm pretty sure a rest-args list is always a new list, even if it came via apply
<RhodiumToad>but I'd have to check that
<ryanprior>Yeah I tend to go with copying by default unless I've identified a specific performance concern :)
<ryanprior>Especially when I'm working with persistent immutable data structures, which are also on my list of things to find or implement for Guile
<RhodiumToad>r7rs-small, at least, explicitly specifies that a rest-args list is newly constructed
<RhodiumToad>haven't checked r6rs or r5rs
<tohoyn>sneek, botsnack
<tohoyn>daviid: is it time to debianize g-golf?
<tohoyn>daviid: I've got a sponsor for Debian packages.
<tohoyn>daviid: BTW, does g-golf work for guile 3.0 now?
<leoprikler>daviid: The documentation for Scheme bindings has apparently been merged
<leoprikler>sneek later tell spk121 the documentation for scheme bindings has apparently been merged
<sneek>Got it.
***apteryx_ is now known as apteryx
<leoprikler>ryanprior: I think those SRFIs do not solely speak for Guile, but for what you can reasonably expect from *any* Scheme.
<leoprikler>Guile does have its own array API, which works on vectors, bytevectors, etc.
<leoprikler>I haven't looked into Clojure, but perhaps you could port some of the stuff you really need into a compatibility library?
***holger is now known as Guest69514
<cairn>I love the illustrations on the homepage. =)
<lloda>ryanprior: srfi-71 replaced almost all my uses of srfi-8
<lloda>some srfis are very standard, others have been superseded by newer ones, it's a very mixed bag
<lloda>often there are 3 or 4 that do the same thing in slightly different ways
***chrislck_ is now known as chrislck
<chrislck>Ongoing Queries wrt trying to clean up modules: I see in guile-json the convention to have a toplevel module (json) which re-exports publics from submodules (json builder) (json parser) etc
<chrislck>Question: what's the convention if the submodules must access each other? (@@ (top sub1) func1) must access (@@ (top sub2) func2)
<chrislck>(apart from complete refactoring)
<chrislck>Constraint: all .scms for this modules will be in the same folder.
<mwette>I'm looking for a solution to this problem: I want a way to evaluate a procedure of N arguments against all combinations of elements in N lists of unknown length. Any hints?
<mwette>^unknown at compile time, that is
<chrislck>import itertools :)
<leoprikler>mwette: unknown fixed length?
<leoprikler>chrislck: @@ is an option, so is autoload
<leoprikler>other than that you can of course introduce another layer
<leoprikler>e.g. (package foo) (package bar) (package foobar-common)
<mwette>meaning the lists are any length (e.g., not the same length) but (length l1)
<leoprikler>okay and it should give all pairs of 1 each, e.g. (1 2) (a b) => ((1 a) (a b) (2 a) (2 b))
<mwette>yes, like
<mwette>yes, if you meant ((1 a) (1 b) (2 a) (2 b))
<leoprikler>oops yeah
<leoprikler>hmm, you could make that a generator, but I assume you want a list as result?
<chrislck>nested named let loops?
<leoprikler>not really
<leoprikler>first you (map length lists)
<leoprikler>then you get something like (2 2 3 ...)
<leoprikler>and then you have a running index with all 0s of (length lists)
<leoprikler>hmm let me code that quickly
<mwette>I guess just a cartesian product of lists would work on for-each: (for-each (lambda x) (apply proc x)) (c-prod l1 l2 ...))
<leoprikler>what is c-prod in this case?
<chrislck>cross-product I guess
<leoprikler>the function your looking for, right?
<mwette>cartesian product -- cross-product can mean something else I think
<davexunit>does guile have anything built-in to mark a procedure as deprecated?
<chrislck>I'm thinking "nested for-loops go brrr"
<lloda>i like outer product, like in apl
<chrislck>oh yeah cross product needs ,use (geometry 3d)
<lloda>i have this
<lloda>it doesn't keep the structure, meaning that the result has rank 2 and not rank (number of arguments)
<lloda>you can fix the amend-map! if that's what you want
<mwette>OK -- thanks
<lloda>append-map! i mean sry
<leoprikler>Probably too smart for its own sake, but:
<mwette>leoprikler: thanks, i'll take a look later
<dsmith-work>Wednesday Greetings, Guilers
<lfam>I wonder, does anyone have a Guix package of the Glimpse image editor (fork of GIMP)?
<lfam>Sorry, wrong channel
<mwette>not working, but this is what I was thinking:
<leoprikler>mwette: expanding in-place to get the compiler to do the dirty work for you?
<leoprikler>If not, just modify mine to take a callback as first argument instead of returning a list.
<mwette>Well, I think it will be more efficent than building up the list of combos. It probably also scales better.
<leoprikler>mwette: fair enough, but what about
***ba is now known as bandali
<manumanumanu>lloda, ryanprior : srfi-71 is really the king of multiple values! I have started using it all the time, except for when I want to use letrec, since the expansion doesn't seem to be optimized the same way as guile letrec
<manumanumanu>I have an extension to it that does pattern matching using (ice-9 match) somewhere
<manumanumanu>Since everything not (values bla bla bla) can be assumed to be a pattern
<manumanumanu>I never nailed the semantics down fully, which is why I never quite released it though.
<manumanumanu>(let* ...) was easy.
<RhodiumToad>wait, why would something other than (values bla bla) be a pattern?
<manumanumanu>Since srfi-71 let is more or less void of extra parentheses, I made a version where a everything in parens except (values ...) which is already special syntax in srfi-71 an (ice-9 match) pattern
<manumanumanu>meaning I could potentially do (let (((fst snd thrd . rest) _ (list-partition odd? my-list))) ...) to bind the first three values in the list satisfying odd? in list-partition
<RhodiumToad>oh I see
<manumanumanu>or (let (((fst1 . _) (fst2 . _) (list-partition ...))) ...)
<manumanumanu>to get only the first values satisfying and not satisfying the predicate
<manumanumanu>but I am easily bored, and I got some problems where I couldn't figure out how to make it act like a let instead of let*.
<manumanumanu>so I left it. The code is easily 10 years old, and I was not that good with macros.
<leoprikler>speaking about ice-9 match, wouldn't match-values be a good addition?
<manumanumanu>like in racket?
<leoprikler>dunno, I rarely look at other schemes
<leoprikler>though matching hash-tables and list-no-order seems fun
<manumanumanu>guile already has a list-no-order-like matcher in (sxml match) (???)
<manumanumanu>but extending (ice-9 match) means breaking with upstream.
<manumanumanu>BUT: doing it in a backwards compatible manner is actually doable! You can check with syntax-local-binding is an identifier is bound as a valid pattern matcher and only then do something other than upstream
<manumanumanu>which brings the other problem: racket has named pattern matchers. To match a list you need to do (List a b c), which lends itself well to extendibility.
<leoprikler>but, but… that's more typing!
<manumanumanu>but it is extensible in a way that isn't a hack :) Trivia in Common Lisp went the same way IIRC ,but with even better pattern compilation. Trivia beats racket when it comes to generating good matching
<manumanumanu>Tonight's hacking done! good night!
<davidl>is there any srfi module that has basic list things like unique or flatten operations on lists?
<dsmith-work>davidl: srfi-1 has basic list stuff, but not unique or flatten, IIRC>
<davidl>dsmith-work: thx. I wrote my own unique.
<davidl>for posterity: (define (unique lst result)
<davidl> (if (equal? (length lst) 0)
<davidl> result
<davidl> (if (not (member (car lst) result))
<davidl> (unique (list-tail lst 1) (cons (car lst) result))
<davidl> (unique (list-tail lst 1) result))))
<leoprikler>w.r.t. unique, what about delete-duplicates tho?
<daviid>leoprikler: hello! yes I did see that, thanks, I was actually talking to one of the reponsible person for the site yesterday and he didn't mention but it ars he merged while we were conversing about this ...
<leoprikler>Ah, I see.
<leoprikler>Though to be fair, we are still waiting for GNOME to notice us. The next step would be to get either g-golf or guile-gi into peas.
<daviid>leoprikler: I actually initially asked them to be on the front page, and that is, surprisingly, quite a lot more difficult then i thought, but ...
<leoprikler>Imagine writing plugins for Gedit, Totem or Builder in Scheme.
<dsmith-work>As it was *supposed* to be.
<dsmith-work>"We plan to use GTK/Scheme bindings for coding small utilities and applications. When these bindings are more mature, it should be possible to write complete applications in Scheme."
<daviid>well, that is not what that page is for, it is for wrinting your own app in your own language, guile scheme is actually quite a lot superior to other choices imo, but let me focus on something i wanted to share with you ...
<daviid>and let's focus on trying to appear on the front page
<daviid>i wanted to suggest we rename that page "Guile Scheme", and not talking about any other scheme, nor what scheme is, how mny impl there are out there ... for two main reasons
<daviid>two reason to try to be i the front page i mean- (a) because on the parebnt page, the one users will see when they click 'language bindings', i'd like to appear as "Guile Scheme" (and others may want to appear as, say, "Racket", Chibi ...
<daviid>the second reason is because then that name can be on the front page, if they accept to add guile scheme to the front page ...
<daviid>the oother comment he made was: it is unlikely to happen because you have more then one implementation ... to what i asnwered - no problem, you add (ask to add) "Guile Scheme" to the front page notebook as a tab, with that title, and then a @subheading (a la texinfo, justr strong font) with "G-Golf", then velow the example, then another @subheading with guile-GI, then its example, or, did i say, anything other way to present that the
<daviid>gnome designers would prefer
<leoprikler>Even if we limit ourselves to Guile Scheme, though, there is the problem of having two warring implementations
<leoprikler>So you need nested tabs and everyone hates nested tabs
<daviid>so here we are, the last comment he made was 'he will ask, but nothing will change within the next few weeks, because they are reformating things for 4.0
<leoprikler>Also, some of those other Scheme implementations do come with Gtk bindings OOTB, they're simply not documented as part of GNOME.
<leoprikler>(and probably of questionable quality too, but eh…)
<daviid>they are not warring, and i don1t by that argumewnt (of them), 21st century, gnome team designers ca't think of a nice way to presnet more then one example (GI binding impl) for one language ... that doesn't make sense to me, even I, with no particular design habilities, could come up with some descent way to presne things ...
<daviid>anyway, i wanted to ask you to change the title page, that way the parent page will list Guile Scheme" and I can ask after 4.0 redesign is out ...
<daviid>forget about evaluation of G-Golf and Guile-GI, that is for users to make, not the gnome team, nor anyone of us, i defend that G-Golf is of excellent quality, with room for improvements of course, but the design anbd what is there is prety good (not perfect, but very good)
<daviid>but anyway, we will have asked ... and thanks for your work!
<leoprikler>no problem
<daviid>sneek: later tell tohoyn, you can certainly prepare things, and I will be pleased when G-]Golf is in debian, but I have to warn you that it might take more tjime and be more dificult then it seems - (a) g-golf doesn't not work with guile 3.0 (which introduced changes in the module system, that breaks module-use!) and debian wants to withdran guile-2.2 from bullseye
<daviid>by the way i thought python had more then one GI binding as well, just curious
<leoprikler>there is pygtk IIRC, but that has been deprecated since ages
<daviid>ah ok, so they really have one set of bindings then
<leoprikler>I'm also sure that between guile-gi and g-golf one of them will claim "victory" at some point and the features of the other might somehow be merged.