IRC channel logs

2020-03-23.log

back to list of logs

<mwette>alextee[m]: my fav book is this: https://www.scheme.com/tspl4/
<alextee[m]>mwette: thanks
<mwette>named-let is the coolest thing ever
*alextee[m] is trying to figure out why his hello world example says auto-compilation failed
<hugo>alextee[m]: I can give you some pointers if you want
<alextee[m]>hugo: yes, please! this is what i'm getting when i run the example program https://paste.debian.net/1136055/
<hugo>That's a weird problem
<hugo>Guile usually places it's auto-complied files under ~/.cache/guile/ccache/<guile-version>
<hugo>Check if you have write access there
<alextee[m]> https://paste.debian.net/1136056/ here's the script
<alextee[m]>it's owned by root for some reason
<hugo>The code in itself looks good. Are you sure that the coding: utf-8 can be in the shebang-lines?
<hugo>But it being owned by root would be the problem
<alextee[m]>hugo: worked now! thanks
<hugo>Hurray!
<alextee[m]>im not sure about the coding: utf-8, it said in the manual it had to be in the first 5 lines so i assumed that's where it goes. i guess i should put it in a comment after the !#
<hugo>When I bother placing it's in a commend below the !#
<hugo>However, usually I don't bother. UTF-8 is enough of a standard to be able to do that
<alextee[m]>oh i'll omit it then. i thought it was needed but probably not
<hugo>Might be a problem on windows
<hugo>But everything is a problem on windows
<alextee[m]>that's true lol
<alextee[m]>well, i just read a file and wrote to another file \o/ snowball from here
<hugo>Check out with-input-from-file and with-output-to-file if you haven't already. default input and output to a given file
*alextee[m] looks for examples
<hugo> https://git.hornquist.se/calparse/tree/module/output/html.scm#n416
<hugo>Maybe not the best example, but it's the one I have in front of me
<hugo>Whenever i run display or similar inside html-generate without a specified port it gets written to fname
<mwette>alextee[m]: suggest in your example you use (main . args) and add an expression at the end: (apply main (program-arguments))
<alextee[m]>ah so it's basically a shorthand for call-with-output-file, except you dont need to specify the output port?
<alextee[m]>(when printing)
<hugo>Yes. It's just a simple wrapper
<alextee[m]>mwette: what does (main . args) do ?
<hugo>Wait, it's not a simple wrapper, since it modifies state
<mwette>you get args as a list of the arguments so if I call (main "A" "B" "C") you get args defined as (list "A" "B" "C")
<mwette>(program-arguments) is a procedure that returns the command line arguments)
<mwette>if (program-arguments) returns ("A" "B" "C") then (apply main (program-arguments)) runs main with those args: (main "A" "B" "C")
<mwette>(a . b) is notation for a pair (cons a b). A list ("A" "B" "C") is shorthand for (cons "A" (cons "B" (cons "C" . '())))
<mwette>where '() is "end of list"
<hugo>mwette: '() is the empty list, and a list is defined as either the empty list, or a pair which contains a list in it's cdr slot.
<alextee[m]> https://paste.debian.net/1136060/
<alextee[m]>mwette: like this? it seems to run the program twice now
<mwette>right, take out the "-e main"
<alextee[m]>oh, nice
<mwette>another way would be to use "-e run-main" and (define (run-main) (apply main (program-arguments)))
<mwette>like "def main(args): ..." in python, you still need to execute main and pass the args
<alextee[m]>i guess this is useful when you have more than 1 functions you want to be able to call from outside the file
<hugo>I would recommend using `-e function' for the same reason you use `__name__ == "__main__"' in python
*alextee[m] doesn't know what that does in python
<hugo>__name__ == "__main__" checks if the file was loaded as a script (instead of as an library). Allows one file to do double duty as both program and library
<alextee[m]>ah i see. so it's probably better practice to use -e run-main
<alextee[m]>well, i'll skip that for now, i only intend to use this as a standalone program
<mwette>yeah, just get something running and start learning
<alextee[m]>👍
<daviid>str1ngs, spk121: I am thinking to change the gtype-id slot, init-kw and acc to g-type, #:g-type and !g-type wdyt?
<mwette>anyone know what font in x11 I get for the thumbs-up? It shows up as garbage here
<daviid>str1ngs: don't shoot at me :), but i'm also thinking to change <gdk-event> accessors (which are actually methods in this particular case) for !button, !click-count, !coords ... instead of the 'old' (guile-gnome inspired) names, gdk-event:buttton ... which would be quite a lot more 'consistent' with the rest of G-Golf ... wdyt?
<str1ngs>daviid: not a problem with me I have not had a chance to port to the new accesses yet :). I got busy fixing nomad bugs :)
<str1ngs>accessors*
<daviid>ok, I'm gona do it
<daviid>let yu know ...
<str1ngs>sounds good
<spk121>daviid: could be fine for slot, init-kw. is exclamation-point + type used elsewhere in g-golf for accessors?
<daviid>spk121: everywhere, for reasons described here - https://www.gnu.org/software/g-golf/manual/html_node/GOOPS-Notes-and-Conventions.html#GOOPS-Notes-and-Conventions - Accessors Naming Convention
<spk121>cool. it is sad that both modern day keyboards and Scheme the language are so conservative with regards to punctuation and sigils. If only there were frustrated APL programmers in the scheme world. haha
<daviid>:):) and by everywhere, it also means all imported GObject subclass properties, all have a slot, init-kw and accessor respecting this convention
<daviid>like, just to give 1 example, (!background-color (make <clutter-actor>)) -| (0 0 0 0)
<spk121>makes sense
<jcowan>Languages are conservative because the keyboards are.
<jcowan>The SRFI for immutable texts proposes (double) guillemets for literals, but that's not required for conformance. When everything else in R7RS-large is finished (Deo volente) there will be a docket for voting on lexical-syntax proposals.
<spk121>Maybe your accessors should use left arrow, ;-) ↤g-golf
<daviid>spk121: I did think quite a long time about all this (several years), looking for a 'better' character, but because accessors may be used to mutate the sot value, it si an ascii char, very 'visible', very easy o 'identify' ... I always came back to use !
<spk121>daviid: fair. Unless you are writing for personal use, you need to stick to the common denominator characters
<daviid>spk121: also, because/thanks to the MOP, you and users may change that if they wish to, but I must tell you that I have been quite pleased with that convention (and its character)
<daviid>left arrow, by convntion, to me, would mean to reverse of a transformation, that would not be good in the context, imo
<daviid>i thougut about @, but to texi, urli, and does not 'trigger' a schemer 'danger signal for the mutability
<daviid>which we can not avoid (only if using libguile, whch I don't want to in G-Golf)
<daviid>str1ngs: I ushed the announced change about <gdk-event> accessors, here is an updated version of the related example - http://paste.debian.net/1136081/ - this is looks quite a lot 'cleaner' imo
<daviid>str1ngs: is this nomad bug g-golf related maybe?
<wheeler>Does anyone know if the *substitute function is regex or verbatim? I'd like to replace a line in the configure phase beginning with "plugindir=" for example.
<str1ngs>daviid: bug's what not the best choice of works. more like user requested enhancments
<str1ngs>was not*
<daviid>str1ngs: ok
<str1ngs>daviid: if your plate is clear, I have some backlog stuff you can look at if you want? lol
<daviid>str1ngs: hum :):), i really want to fix the 'mutiple' import problem first, then gi-arguments bugs and missing types
<str1ngs>daviid: anything in here are workarounds for g-golf http://git.savannah.nongnu.org/cgit/nomad.git/tree/typelib/util.h?h=feature-windows#n27
<str1ngs>though some might be fixed now. I can go through them and double check if you want
<str1ngs>nomad_app_send_message is fixed you can ignore that I think.
<daviid>str1ngs: i'm not going to look at these now
<daviid>because the above is by far more urgent, as it is, one can not write a simple gtk app
<str1ngs>okay that's why I've left these on the back burner. let me know when your plate is not as full
<daviid>*that would use a trevview and/or a list sore ...
<daviid>ot: a few years ago, someone here pointed to a vpn h/w equiment, i kind of thn i remember the name was 'cube' or something like that, and the (free h/w somehow) company was, iirc, in belgium, anyone knows/remember and could give me a link?
<spk121>daviid: before importing stuff from goops from multiple modules, you can ask GOOPS to merge all the generics by using "(default-duplicate-binding-handler (cons 'merge-generics (default-duplicate-binding-handler)))"
<spk121>that's a procedure from (oop goops)
<daviid>spk121: this is not sufficient
<daviid>you need to do this per module
<daviid>trust me :) and this gives terrible heinsenbugs
<daviid>spk121: i've add ned less conversations with andy about this, and he didn't accept to keep the previous behavior, guile-2.0 was doing what you think is 'owrking', but it fails - guile 2.2 nd 3.0 must see the declareation on a per module basis, and in the repl, to actually implement correctly the expeted behavior
<daviid>tought i think it is a design mistake, that 's what it is, 2.2 and a later do not take the single call 'in consideration'
<daviid>spk121: also, connect is a guile core procedure, be carefull, and if you wish, look at wha does g-golf for it ... i copied from guile-gnome ...
<daviid>spk121: when things work, the warning should not appear - if a user report such a warning, the generics were not merged
<chrislck>fun: (= +inf.0 +inf.0) -> #t
<chrislck>some mathematicians would have a seizure
***apteryx is now known as Guest47456
***apteryx_ is now known as apteryx
<RhodiumToad>why would +inf not be equal to itself?
<abcd>I guess because there can be infinities of different magnitudes
<RhodiumToad>maybe so, but +inf represents only one of them
<abcd>or a non-specified representative of the set of them
<RhodiumToad>anyway, it is usual in floating-point work for infinities to be equal, the only value not equal to itself is NaN
<bricewge>Hello
<RhodiumToad>good morning
<bricewge>Is there a function like for-each but that fail when proc return #f
<bricewge>?
<wingo>moo
<wingo>bricewge: and-map
<bricewge>wingo: Thanks. I already used it but I forgot about it...
<bricewge>Strangely I can't find it in the manual https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html#Procedure-Index_fn_letter-A
<RhodiumToad>it is indeed not documented
<chrislck>RhodiumToad: I'm just being facetious :P
<chrislck> https://www.quora.com/Is-infinity-equal-to-infinity
<chrislck>next, I'll expect guile to do differential equations and fluid dynamics just by manipulating symbols :P
<chrislck>(hmm maybe the macro system is turing complete and can actually do it?)
<RhodiumToad>those answers are pretty crap, frankly
<chrislck>i'm sure someone will explain why (number? +inf.0) is #t
<chrislck>(because the spec say so!)
<luni>i would to ask a question about the maximum dimension of a vector i could use in Guile. I notice than when the i try to use a vector with the maximum size that exceeds #e1e7 i have that the requested amount can't be allocated in the heap. How to circumvent / solve this issue? Thanks in advance
<RhodiumToad>what do you want to store in your vector?
<luni>non integer numbers
<luni>this is because i'm trying to use the finite difference method for a simple fluid cavity problem and in my simple implementation i still have to store the full vector using iterative technique to advance in time
<RhodiumToad>floats? of what precision?
<luni>maybe few decimal digits would be enough
<RhodiumToad>you probably want to use a uniform numeric array rather than a vector
<luni>but there is any difference between a vector and an array if not in the number of dimensions?
<RhodiumToad>the difference is using a uniform numeric vector rather than a plain vector
<luni>so what i have to do to use a uniform numeric array? ... now i'm looking at the documentation (6.6.13 Arrays) ... is this what i have to use?
<luni>i don't realize the difference between a uniform numeric vector and a plain vector to be honest...
<lloda>a plain vector can have anything in it
<lloda>#(a 1.3 (a list of symbols))
<lloda>a uniform numeric vector can only have numbers of the particular type
<RhodiumToad>luni: in addition to the arrays part, see also srfi-4
<lloda>and it's a memory fixed format, so you can pass it to C etc with just a pointer
<luni>ok... thank you a lot for the help
<lloda>tbh if you won't care about passing the numbers to and from C a plain vector works just as well
<RhodiumToad>from the point of view of memory usage?
<luni>anyway even using uniform numeric arrays [e.g. (make-u8vector upper-limit)] the upper limit is the same that when i used (make-vector upper-limit 0). My question was about what to do to increase the upper limit
<luni>basically maybe i have to see how to extend the heap size ... but i don't know for sure so for that reason i was asking information about
<peanutbutterandc>Hey there!
<peanutbutterandc>Do we have any haunt-hackers here? (the static site generator written in guile)
<jonsger>peanutbutterandc: what is your problem?
<peanutbutterandc>jonsger, I am trying to deploy a dummy haunt site using gitlab: https://gitlab.com/peanutbutterandcrackers/hello-haunt
<peanutbutterandc>But all the links to posts throw a 404: https://peanutbutterandcrackers.gitlab.io/hello-haunt/
<peanutbutterandc>I was wondering if there is a clean solution to that issue somewhere. I can see that if I set #:prefix "hello-haunt" to builders and then move the index.html out from hello-haunt directory to the one above it, the problem might be solved. But that's quite ugly. And I was wondering if there was a clean solution to it
<daviid>luni: fwiw, I se on #scheme that you are doing matrix stuff using vectors, you might be interested to look at guile-cv - https://www.gnu.org/software/guile-cv/ - which does that (the manual is available online, with a procedure index ... code available o savannah - ll on the website) - I never come to the upper-limit you refer, although manipulating hude images
<daviid>
<daviid>luni: for performance reasons, most of the 'expensive procedures' are written in C
<luni>thank you daviid
<peanutbutterandc>jonsger, any ideas, please?
<jonsger>not really. I'm also starting to learn haunt and not an expert of guile
<daviid>luni: np!
<peanutbutterandc>jonsger, I see. Well, we're two peas in the same pod for now, then. :) Happy hacking with guile!
<peanutbutterandc>daviid, You do not happen to be Mr. David Thompson, do you?
<daviid>peanutbutterandc: no
<peanutbutterandc>daviid, I see. I was wondering if we were talking about haunt in front of the creator of haunt itself. :)
<peanutbutterandc>Do you might have any ideas regarding the matter, perchance?
<daviid>peanutbutterandc: no, i don't use haunt, though i should, all my website use custom sxml static generators as well, never had tme to port to haunt, which would be better
<peanutbutterandc>daviid, I see. During this time, I realize that guix and guile's websites are powered by haunt. So that is super cool. I have also found something that compiles s-expressions (in guile) to JS. But have forgotten it's name.
<daviid>luni: welcome! if you happen to give it a try, highly recommened to read the 'Configuring Guile for Guile-CV' and 'Image Structure and Accessors' sections of the manual, then you good to try and have little fun, hopefully, it can be used even by none advanced schemers, includig beginners (just guile's config s a bit 'scary', unfortuately, but if you follow the steps i the manual, even 'blindingly', you'll be good ...
<daviid>
<daviid>
<daviid>sneek: how about you copy my last message to luni and keep it till they appear, then deliver nicely, ca yu do that for me? :)
<daviid>peanutbutterandc: I'll other answer the JS related qiz, I know nothing about JS
<civodul>sometimes in statprof/gcprof, the "cumulative seconds" column is completely crazy
<civodul>like some procedures have a figure 100x the total execution time
*jonsger submitted Guile 3.0.1 to openSUSE :)
<civodul>woohoo!
<jonsger>it's the first of 3.0 branch. So it will be a bigger migration...
<jonsger>I could done that earlier but I waited for Guix 1.1.0 :P
<civodul>heheh
*daviid hopes that maintainers will look at and integrate what ever they feel best for what is in the wip-exception-truncate branch, for 3.0.2
<wingo>civodul: that's because each activation on the stack counts
<wingo>gprof does the same fwiw
<alextee[m]>is there an easy way to get the nth element from a list other than using the car/cdr stuff?
<alextee[m]>built-in way*
<brendyyn>alextee[m]: list-ref
<alextee[m]>brendyyn: thanks
<bjoli>ArneBab: too late for me. A guy that visited me yesterday called me today and said he woke up with dry coughs and fever. I'm working from home anyway, but it is not like I am looking forward to a 3 week isolation with my 3 year old.
<bjoli>alextee[m]: just so you know, list-ref is O(N). If you find yourself doing a lot ot list-refs, you should probably switch to using vectors instead of lists
<alextee[m]>ah i see. well i dont care about performance for this. i'm just trying to store each argument in a variable
<alextee[m]>i am doing this btw: (let* ((myarg1 (list-ref args 1)) (myarg2 (list-ref args 2)) ... )
<alextee[m]>there's probably a shorthand for it somewhere
<peanutbutterandc>Is there any haunt user here currently?
<bjoli>alextee[m]: (ice-9 match) is the module you are looking for. That way you can do destructuring of a list
***bjoli is now known as manumanumanu
<manumanumanu>alextee[m]: https://www.gnu.org/software/guile/manual/html_node/Pattern-Matching.html
<manumanumanu>(match args ((arg1 arg2 arg3) code here))
<alextee[m]>manumanumanu: nice, thanks!
<manumanumanu>alextee[m]: I have been thinking about porting the racket pattern matcher, since it produces better code than the guile one for some cases. That code is intense though, so I'm not really sure I could :P
<manumanumanu>it is under a MIT or apache license (you may chose), which is sublicenseable
<hugo>manumanumanu: Might take a look at the racket pattern matcher then.
<hugo>In my current project I extended let* with my own simple pattern matcher
<manumanumanu>hugo: you are the kind of guy that could actually manage :D
<manumanumanu>there is a great video about the compilation process it has (yes, it is a macro, but it is more like a compiler)
<manumanumanu>hugo: https://www.youtube.com/watch?v=IikGK8XP5_Q
<alextee[m]>i noticed that i could use format without including use-modules (ice-9 format)). is that not needed?
<hugo>I will check it out when I have a bit of time!
<civodul>wingo: hmm ok
<hugo>I took a quick look at the source, and it already has started to look a bit scary https://github.com/racket/racket/tree/5bb837661c12a9752c6a99f952c0e1b267645b33/racket/collects/racket/match
<manumanumanu>the benefits of the compilation is mostly for clauses like ((list a b 3) ...) ((list 1 b 3) ...) which will be a lot faster with the racket matcher for more complex patterns
<hugo>alextee[m]: (ice-9 format) is included in the default repl module list. It is however not included in complied code, but a weaker version of ice-9 format is included there.
<wingo>civodul: kcachegrind also has something similar fwiw
<hugo>In short, include it if you plan to use it
<wingo>there is a checkbox for whether to count cycles or not
<hugo>manumanumanu: match being more or less a compiler isn't that suprising. Isn't most of compilation just reducing the syntax tree through pattern mathes?
<alextee[m]>hugo: ah i see
<manumanumanu>much of the complexity comes from: being racket (ie: having to work across languages (including typed racket) and working with the racket internals)
<manumanumanu>hugo: there is a very nice optimizer
<manumanumanu>as well
<hugo>I really need to read up on this. How does the racket internals compare to guile's?
<hugo>(Guile is the only scheme I have looked at in depth)
<manumanumanu>it will do racket's counter-part of syntax-local-binding to be able to inspect
<manumanumanu>what something will be at runtime
<wingo>manumanumanu: fwiw there is a lot of optimization left to do for match-like patterns in guile
<manumanumanu>the coolest things it brings is of course being user expandable. That could be implemented without much of the fanciness of the racket pattern matcher in general
<wingo>that is independent of code generation
<wingo>i.e. guile could do a better job without changing match macro implementatin
<manumanumanu>wingo: yup, but I really think implementing optimizing the conditional branches of (a b 3) (1 b 2) is easier to do in the pattern matching. It would be nice to have it in the compiler, which would make it general, but it is a rather special case.
<manumanumanu>wingo: what would be nice with a new pattern matcher is that it could be made user-extensible.
<wingo>is it? seems to fall under "macro writer's bill of rights" to me
<wingo>dunno
<manumanumanu>I love that talk as well :D
<wingo>yes agreed, there are other reasons to change pattern matcher implementation :)
<hugo>wingo: What are the macro writer's bill of rights?
<manumanumanu>a talk by kent dybvid
<manumanumanu>g
<manumanumanu>dybvig
<manumanumanu>you can find it on youtube
<mwette>wingo: If you have a few minutes, I tracked down bug #38486, compile does not terminate, to named-let in compute-significant-bits in cps/specialize-numbers.scm. This case works in 3.0.1.
<hugo> https://www.youtube.com/watch?v=LIEX3tUliHw
<mwette>I'm not sure I'd be good at going down further. Any hints?
<mwette>wingo: bug #38486 is reproducable in 2.2.7
<wingo>interesting
<wingo>i wonder why it's not a bug in 3.0
<manumanumanu>wingo: the talk on racket's insides (by samth) on the pattern matcher explains what kind of optimizations the racket pattern matcher does. I suspect I am too dumb to implement something like it, though :D
***wxie1 is now known as wxie
<wingo>mwette: you have nerdsniped me :P
<mwette>lol
<alextee[m]>is there a way to have named arguments when formatting strings?
<alextee[m]>like i want to replace all ~a's with the same string, and also i don't know how many ~a's there will be
<alextee[m]>quick look here doesn't show anything resembling that https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html
<wingo>mwette: fixed :)
<mwette>sweet
<manumanumanu>civodul: I will submit a fixed patch for adding SRFI-171 later tonight with most of your feedback fixed (and good reasons for not fixing one thing). Trying to compile against it now. If that works, there is a patch coming your way.
<civodul>manumanumanu: awesome!
***wxie1 is now known as wxie
<manumanumanu>This is my first non-trivial addition to an OSS project that isn't my own, so I am just happy that you took your time to review the patches. :D
<manumanumanu>transducers are great, and I think it complements john's generator srfi's with a nice, eager construct.
<manumanumanu>The hardest part of this whole srfi thingie has been the english. I am happy for Arthur's history as a copywriter, since he cleaned up a lot of stupid mistakes.
<dsmith-work>Hey Hi Howdy, Guilers
<manumanumanu>good morning, dsmith-work
<manumanumanu>civodul: regarding the question about #:declarative #t. Are the modules declarative by default? I thought I had to add it myself
<civodul>manumanumanu: they're declarative by default at -O2 and above, if i'm not mistaken
<manumanumanu>thanks.
<manumanumanu>that makes sense.
<alextee[m]>my first guile program is ready! i use this to generate a manifest.ttl as part of my build https://git.zrythm.org/cgit/zplugins/tree/plugins/manifest_gen.scm
<alextee[m]>probably very badly written scheme/guile :D
<civodul>alextee[m]: not bad! :-)
<civodul>instead of (eq? x #t), you can just write x
<alextee[m]>oh! thanks
<hugo>alextee[m]: Good work! Some notes: I assume your cons on line 119 is to allow two statements inside the true-clause of the if. Instead use begin, which is made for that exact grouping (or in this case just use when instead of if, since you lack an else-clause).
<hugo>Also take a look at (ice-9 rdelim), which contains more advanced IO operations (so you don't have to reimplement cat yourself).
<alextee[m]>hugo: thank you! i was searching for something like "when", that's what i wanted
<alextee[m]>i'll look into rdelim, there's got to be an easier way of cat'ing a file
<stis>heya guilers!
<str1ngs>hello stis
***nckx is now known as impressed_bot
***impressed_bot is now known as nckx