Re: Cross-compiling Guile 3.0.4
> The #f passed to ‘compile-and-load’ suggests that ‘boot.el’ was not > found in the search path. Could it be that it’s been stripped from your > source? No, it's here and compiles without errors for native target, but I think now I get it. Somehow it does not find boot.el from sources, but finds in guile from host, if it present in it. This was not the case before, because I moved all the source files into separate package.
Re: vector-last / vector-ref with negative indices?
Thank you for the replies. I ended up sending a patch to add support for (vector-last) since I found it useful. https://lists.gnu.org/archive/html/guile-devel/2020-12/msg9.html Aleix On Sat, Dec 19, 2020 at 10:58 PM Aleix Conchillo Flaqué wrote: > > Hi, > > This month I'm trying to go through Advent Of Code one more year > (previous years I didn't get too far) and I've been finding myself > writing the same patterns multiple times that could be avoided by just > having a helper function. > > One of them is getting the last element of a vector. It is a quite > common operation when solving these types of problems. For example > Python as you might know uses negative indices. > > I have looked around and haven't seen it (unless I completely missed > it which would be shameful) but wouldn't it be good to have this > built-in by default? > > Instead of having to write: > > (vector-ref v (- (vector-length v) 1)) > > you would write: > > (vector-last v) or even better (vector-ref v -1). > > Interestingly Racket doesn't offer those functions either as far as I can > tell. > > Basic use case? Get the maximum element of a sorted vector which would > be done in constant time. > > I'm trying to solve the problems idiomatically, to the best of my > limited knowledge, with Scheme. It is possible that the times I'm > using vectors I should think about it differently and not use them, > but I'm not 100% sure. > > What am I missing? > > Thank you in advance, > > Aleix
Re: Unbound variable warning/exception
Hello ! Looking in the all of core Guile could save time! I can see already an emacs geiser trick to add it automatically haha. Auto-completion + auto-use-module = Awesome! Cheers, Jérémy Le 21 décembre 2020 00:11:38 GMT+01:00, Christopher Lam a écrit : >The exception printer would be a good one to upgrade. > >The dilemma is whether to search available modules in the current >repository, or in the whole of core guile. Do we want to show e.g. "Unbound >variable: vector-for-each. Did you forget (use-modules (srfi srfi-43))" ? > >On Sun, 20 Dec 2020 at 21:36, Ludovic Courtès wrote: > >> Hi, >> >> Aleix Conchillo Flaqué skribis: >> >> > On Fri, Dec 18, 2020 at 5:26 PM Christopher Lam >> > wrote: >> >> >> >> Hi guilers, I saw in guix the incredibly useful unbound-variable >> exception >> >> printer written by Ludovic. I've adapted for use in gnucash as >> >> https://github.com/Gnucash/gnucash/commit/6f951784 -- there are now in >> >> guile 3.0.4 many more unbound-var warnings than in 3.0.2 -- wouldn't it >> be >> >> a useful hint to add to the warning in core guile as well? >> > >> > Wow, this is great! >> > >> > This should definitely be added to guile by default. >> >> In Guix, the hint is displayed by an 'unbound-variable exception >> handler, not by the 'unbound-variable printer; I think doing it in the >> printer could be confusing. >> >> Perhaps what could be done is export an 'unbound-variable handler that >> does all this, and have the REPL use it? >> >> Thanks, >> Ludo’. >> >> >> -- Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
Re: Writing a procedure in different style
On Sun, Dec 20, 2020 at 06:57:34PM +0100, Zelphir Kaltstahl wrote: > Hello Tomas! > > I think you are right about it only being down one stack frame down. The > checks are performed on what contains the next thing which is recurred on. Nice explanation :) > For a moment I thought "But isn't the null? check done twice in the > first cond part?" [...] This is one of the fantastic (and scary) things I often experience in this (scheme-y) context (take SICP, or the Little Schemer). Everything looks so easy, but whenever I try myself, I realise that I've been taken along a path along high mountains, with breathtaking views, and down there it gets messy and there are crocodiles. It takes a long time to massage one's messy, lowly programs into a form which approaches that deep beauty. But it's fun :) Cheers - t signature.asc Description: Digital signature
Re: Writing a procedure in different style
Hey Tomas, On 12/21/20 1:31 PM, to...@tuxteam.de wrote: > On Sun, Dec 20, 2020 at 06:57:34PM +0100, Zelphir Kaltstahl wrote: >> Hello Tomas! >> >> I think you are right about it only being down one stack frame down. The >> checks are performed on what contains the next thing which is recurred on. > Nice explanation :) > >> For a moment I thought "But isn't the null? check done twice in the >> first cond part?" [...] > This is one of the fantastic (and scary) things I often experience > in this (scheme-y) context (take SICP, or the Little Schemer). > > Everything looks so easy, but whenever I try myself, I realise that > I've been taken along a path along high mountains, with breathtaking > views, and down there it gets messy and there are crocodiles. > > It takes a long time to massage one's messy, lowly programs into a > form which approaches that deep beauty. I definitely agree! When I went through the book and also through some SICP exercises, I was amazed by how much is contained in just a short snippet of code and how nuanced it can be. I wonder how much crap code I write on the job, when I am not given as much time, as I take in my free time, and even in my free time, I often notice, that I could have written things more succinctly or in a more idiomatic way or that some special case was not covered. If I look at my time spent on writing code in a functional style, while trying to not unnecessarily increase runtime complexity, compared with time spent on code, that makes use of mutation or even global state, simply hoping that things will work out later, I also get an idea of how much more one can think about a short program and how much more there is to think about. Writing code, a simple thing to learn, a very long (never ending) journey to master. I hope that the whole virus stuff will be over soon and I manage at some point to join an event in the e-lok (it was e-lok something, wasn't it?) ; ) Best regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl