IRC channel logs
2026-07-02.log
back to list of logs
<old>how does one can get a stringbuf in Scheme ?? <old>hmm guile colorized does not print circular list correctly. it seems to be hanging <old>dthompson: well I'm not sure. I'm currently working toward porting print.c to Scheme so that display/write can be suspendable <old>and I see a dispatch on scm_tc7_stringbuf <old>I can always just do tag matching on the object-address and do manual word reading if needed, but I wonder if this kind of object exist in Scheme <old>also anyone can tell why: (write (circular-list 1 2 3 5)) => (1 2 3 5 . #-3#) <dthompson>hmm I didn't know there was a type tag for a stringbuf type. <euouae>man I just got my 8mo 1-line doc patch accepted <euouae>I think this calls for a celebration, I have this vintage radioactive water bottle here, kept it for special occasions <sham1>old: that datum label seems very peculiar since the written datum itself doesn't have a datum label assigned <sham1>I could only assume that it's #-3# to sort of refer back to the initial pair. The more standard way would be #0=(1 2 3 5 . #0#) but that's not supported on Guile IIRC <old>sham1: I think this is to avoid double traversal <old>becuase you don't want to assign datum label ahead if you don't need to <old>so by keeping labels are diff I think this is the reason <old>#-3#, 3 elements back <old>ofc that's not readable so .. <old>not readable -> can't be `read' back <old>so I wonder does this make sens for yall? <old>(print (circular-list 1 2 3)) => (1 2 3 . #-4#) <dthompson>old: the output of write is never guaranteed to be readable. record types are the most common non-readable thing. <old>and: (let ((x (list 1 2))) (set-car! x x) (set-cdr! x x) (print x)) => (#-1# . #-2#) <dthompson>I'd have to read the algorithm to know where the indices come from <old>dthompson: right right. But it would have been nice to be able to print circular list in a way that can be read-back <dthompson>but you can't write a circular list as syntax <old>but we don't support datum label as of rn <old>that's R7RS syntax for circular reference AFAIK <old>right CL also I think <old>7 years old bug in Guile :-) <dthompson>r7rs leaves out so many important things... but includes this. baffling <old>ah I got the syntax wrong, it's #n= not #=n <old>a feature that nobody is going to used and will slow down the reader <dthompson>been doing this for some time and not once have I wished I could read in circular structures <euouae>I used AI to check my library for bugs and it spotted quite a few <euouae>the most notorious was in this line of code: (if (assq-ref 'read-only (%string-dump str)) ...) <euouae>the answer is that the predicate is always #f because I mixed up the order of the arguments, fix: (assq-ref (%string-dump str) 'read-only) <old>dthompson: I feel like these kind of features are nice on paper, but it complexify the language and its implementation <old>which can lead to difficult optimization <dthompson>it's certainly additional complexity, though I don't think it will slow down the reader because it's a branch that will almost never be taken <old>i.e., I have a printer in Scheme now that does support circular list. But it slows down printing of any list <old>so the exception is penalzing the rule <dthompson>but there's kind no way around that since data structures may be circular <old>kind of like in society I suppose <dthompson>you either need to detect circularity or limit recursion depth <euouae>that reader macro for #n= is useful if you're trying to write large structures with a lot of shared content <dthompson>I wrote a pretty printer recently and am just limiting recursion depth for the time being <euouae>but in such instances you just write a macro for your use-case and you're good to go <old>euouae: assq-ref is LIST KEY <old>I guess that\'s your error <old>always disliked the asymmetry between assq and assq-ref <euouae>anyway the point is AI spotted the bug immediately <euouae>I really pushed like 10 commits of bugfixes, that one was the most severe. <euouae>got me wondering what's the policy for guile for AI usage? I'm talking about "find me the bug here" and then human review + human patch + Suggested-by: AI bot trace line in git commit. Because I have a feeling it could really do wonders to fix some bugs <euouae>I have a feeling y'all be against it though because why not kill joy <dthompson>there's no policy currently but there needs to be <euouae>what are your feelings for such contributions <euouae>in particular I think that with AI I could really grasp some of the more esoteric parts of the guile VM that wingo wrote that (understantably) he doesn't have time for me to explain <dthompson>I think the policy should be no LLM-generated contributions <euouae>yeah you mean the patch itself right? some other projects go further and rule out all usage <dthompson>yes, all code/docs/whatever should be authored by a human. <euouae>I agree. I might try sometime to ask AI to find bugs in guile code and/or help me understand the esoterics of the VM <dthompson>much like how some people use proprietary text editors to edit free software, some will use LLMs as part of their workflow. the liability to the project is if the patch is generated. <dthompson>I do not use AI at all because I think it's net negative for the world even though it has some limited uses. <dthompson>but I have seen the success Mozilla and others have had with using LLMs to find bugs, not completely unlike using fuzzers <euouae>it definitely hasn't been net negative for me, the most value I've gotten from it is to have discussions on physics/math on concepts that would require me attending conferences & socializing successfully to replicate <dthompson>with such a narrow scope, sure, lots of people get some benefit. this ignores the externalities, of course. <identity>dthompson: R⁵RS and R⁷RS say «The ‘write’ procedure is intended for producing machine-readable output», and, either way, not being able to ‘read’ what you wrote sounds stupid <dthompson>identity: it produces machine readable output if the input is constrained appropriately <euouae>well you can't read back a scheme procedure <identity>lists are, including circular. i would expect Guile to signal an &implementation-restriction instead of writing what is essentially garbage <dthompson>a circular list is by definition not a tree and therefore, in my opinion of course, not something worth making readable <dthompson>but I recognize that it's possible with the above reader syntax <dthompson>any compound type can contain a circular reference <euouae>you can use the #n= macros for some basic infinite functional data structures but you should probably use some more advanced interface like SRFI-158 for example <euouae>I have actually not looked into this because I don't use such structures, I know they're very populr in haskell <euouae>e.g. infinite binary tree #1=(('left . #1#) ('right . #1#)) <euouae>I kind of bet if I dug into it more I'd be able to unearth a fix, but the point is that the people with the knowledge for this sort of thing aren't around to poke or ask <euouae>dthompson: do you think it's worthwhile sharing the AI conversation file to that bug above? <euouae>or do you think that to avoid nonsense it's best to only share human-written text that I've confirmed first? I'm asking because the conversation might be usefl to the report but I don't have the time to verify myself <dthompson>I think sharing AI generated text creates a lot of noise. much better for you to write in your own words <old>euouae: please don't dumping AI analysis on issues <euouae>we;;ll I sppose anyone who wants to fix the problem can run it through AI if they wanted <old>I don't have time to review as much as I would like, that would just be wasting my time having to review so AI analysis <euouae>yeah pormote me for reviewer then lol <euouae>8 months ago I had the stamina/energy to contribute tot the proejct but 8 months later I get reviews, it sucks :/ guile is glacial pace <euouae>no criticism on you in partcular I just wish wingo/courtes cared <old>I think they do care. Looking at the fact they have been there for more than 10 years and their number of commit, they certainly care <old>But you know, talking for my self here but I assume it applies to them as well, my son is more important than a programming language <dthompson>the capacity to review patches is almost nonexistent and that's a serious problem, it's true <euouae>that's not the point, the point is that when there's people with enertgy who want to contribute they get pushed away from the project because there isn't enoug maintainer time <dthompson>the solution was to give more people the commit bit <dthompson>but I don't know how many additional commiters we have since earlier this year <euouae>yeah I wish I had it for example, I don't know what's the right way to ask for it other than ask here <euouae>and additionally I believe I've emailed courtes / wingo about this problem and/or my wish but I don't tjhink they respnoded. I could be making this up <euouae>obvs your son is more improtant old lol... I have children too <old>my point being, we are all very busy and yes we could use a little more help for review <euouae>hey I did review patches for the project too <old>I've put hundred of hours in reviewing and fixing thing this year <euouae>to me perosnally it's just not clear at what point I get enough recognition to be like OK yeah we can hvae commit status on this guy <euouae>it's a general issue with projects but I liek giule more than otehrs. It seems a lot of projects its just a matter of being in the same univeristy or job as the project lead <dthompson>andy once said I could have such privileges but that hasn't happened <old>euouae: the maintainership situation could certainly improve yes <old>euouae: if you want something to get reviewed, ping me <euouae>review my application for maintainer <old>either @old on Codeberg or just by email: olivier.dion@polymtl.ca <dthompson>we need more committers, not maintainers. andy and ludo are good stewards but they can't do day-to-day stuff. <euouae>oh yeah right, I misspoke, I mean give me commit privileges <old>I can't. I don't have this power <old>and anyway, this require a discussion among other contributors as well <euouae>but OK if I do have any good patches I will ping you like you said <jan0t>do you use akku to manage guile third party packages? <jan0t>it is because i was seeing a library to talk to d-bus in guile <jan0t>and i saw it mentioning akku <jan0t>btw, I really like lisp but I am thinking of shifting from common lisp to guile <jan0t>because guile has a proper manual from gnu and the libs look more organized and standardized <jan0t>because common lisp is sparse and has almost to none docs <rlb>Of course that's not available via info/man/etc., and I suppose I haven't looked in to the license... Hmm. <identity>jan0t: it depends on the Common Lisp in question, i suppose, and on the Scheme too: Guile is but one implementation <identity>i guess Schemes do usually have decent manuals <identity>and portable libraries, in the form of SRFI <rlb>(I mostly relied on the physical common lisp book back when I was working with cl.) <identity>rlb: it *is* available as info, though with the license it is a bit roundabout <euouae>ekaitz: :) hey I'm nly here to complain today haha <euouae>jan0t: yeah I've used akku to publish but not for my projects for dependency management <jan0t>rlb: the hyperspec is a thing but we dont use raw functions, like the network part is really raw so we use libs and all <jan0t>but they are fragmented and most dont have a documentation <jan0t>for web development for example, you use at least 4 different libs and all of them have different substitutes <jan0t>in guile you have artemis that is straightforward and has a good docs <jan0t>but i am also newbie enough to not know much about the differences in scheme vs common lisp <jan0t>all i know is that namespace is different <euouae>where CL excels is interactive programming <rlb>ahh, yeah, I know nearly nothing about common-lisps package/library ecosystem. <euouae>scheme is not that great in that regard, AFAIK you can't just modify GOOPS structures on the fly while your program is running and have it all work out <ekaitz>euouae: in guile if you redefine things like + it doesn't change the behavior of the procedures you had defined before that use it <euouae>yes CL supports it, if you have Enemy instances and you add a 'status' slot, everyone gets it, etc <dthompson>goops classes can be redefined and have all instances update. it's an optional feature, however. <old>hmm weird that ,optimize (string-append "foo" "bar") is not yielding "foobar" <old>guess will add that to peval <euouae>but what are the properties of string-append result? <euouae>because "foobar" might have different string properties from the result of a string-append <dthompson>yeah the result of (string-append "foo" "bar") is not a constant <old>if both are string literal that should be ok <euouae>the result of string-append is a mutable string <dthompson>strings shouldn't be mutable but here we are <dthompson>so nice little optimizations like this are not correct in the general case :( <identity>same reason why (append '(a) '(b)) does not get optimized down to '(a b) <identity>it does get optimized down to (cons 'a '(b)), though, which is correct <old>hm I guess one needs to do it at expansion time then <dthompson>it's likewise a shame that pairs are mutable <JohnCowan>For ages the specification of Ada SPARK `sort` was insufficient: it merely required that the output be sorted, which means a conforming implementation could just always return an empty array, or an array of N times one of the original elements, etc... <probie>It's got half the spec you want. You want it to be sorted _and_ a permutation of the original array