IRC channel logs

2019-09-03.log

back to list of logs

<apteryx>is the jargon "tuples" correct to denote lists of two elements or more in Scheme/Lisp?
<daviid>apteryx: i would it denotes a list of lists
<daviid>or a list of something, coud be records as well, anyway, it comes fro sql
<daviid>and 'something' is not necessary binary
<daviid>it could be any n-items in each tuple
<daviid>including 0 (zero), 1, 2 or more, is what I wanted to say
<jcowan>In statically typed languages, lists have all elements with the same type whereas tuples have a potentially different type for each element. In Lisp it makes no difference.
<jcowan>It's also typical for lists to be variable-length and tuples fixed-length.
<rlb>Let's say I need to get the actual binary argv values. It doesn't look like guile has a function for that right now, but I was trying to recall if I'd seen any coordinated plans on that front -- i.e. when you need binary args, env vars, paths, users, groups, etc. (some way to handle POSIX apis that really just return "char *"). For some of them, perhaps I can change the locale temporarily if that's safe, but perhaps not for argv?
<rlb>I can of course just handle it via C, but if I do end up needing to do a lot of that, I figured it might be worth trying to do something that could help guile proper, if we knew what something we might want.
<rlb>I thought I vaguely recalled some discussion a while back, but wasn't sure.
<rlb>Oh, and does guile already have some fast bytes<->hex-string converters? I wrote a couple, but imagined I might have overlooked a srfi or something.
<wingo>rlb: iirc we don't have a good solution yet. there has been a fair amount of discussion but you'll have to dig through the archives :/
<lloda>is (let-syntax ((%macro (syntax-rules () ((_ a) a)))) (define (fun a) (%macro a))) an ok thing to do? re: fun being a top level or module level def
<wingo>lloda: fun is a top-level/module-level def in that case
<wingo>let-syntax does not create a lexical contour, at least at the top level
<lloda>wingo: ok, thanks
<lloda>(let-syntax ... (define f (case-lambda ...))) works fine, but (let-syntax ... (define-inlinable-case f (case-lambda ...))) throws psyntax errors, so I think my define-inlinable-case is borked
<lloda>This one fwiw https://notabug.org/lloda/guile-newra/src/master/mod/newra/base.scm#L98
<lloda>oh the error is reference to identifier outside its scope for the macro introduced in let-syntax
<lloda>that sounds familiar
<g_bor>Hello gentle people!
<g_bor>It seems like that guile error reporting in srfi-19 is not quite right.
<g_bor>if string->date is given an empty string as first parameter, then it reports a bad-date-format-string.
<g_bor>It might well be that I misunderstand the intention of the error, but I believe that something like the input does not match the template should be reported.
<g_bor>The error text suggested to me to look for an error in the template...
<g_bor>Wdyt?
<civodul>g_bor: i guess string->date should accept the empty string, indeed
<civodul>we could also check what srfi-19 says, but i don't see why it wouldn't be allowed
<z0d>any recommendations for libraries to convert s-exps to HTML? something like html-writing, https://www.neilvandyke.org/racket/html-writing/
<lloda>z0d: I've used this for kml https://www.gnu.org/software/guile/manual/html_node/SXML.html#SXML
<lloda>it's include with Guile
<lloda>included
<z0d>thanks
<jcowan>g_bor, civodul: What kind of sense does "" make as a date? Is it today, tomorrow, or the Unix epoch? An exception must be thrown; the only question is which exception, and SRFI 19 gives no guidance here, as it predates any stanardization of exceptions.
<g_bor>jcowan: yes, I agree with that.
<civodul>jcowan: oh, i think i was confused: i thought we were talking about the template of date->string, but no, we're really talking about string->date
<civodul>so yeah, you're prolly right
<g_bor>The only thing is that I feel that an exception referring to the input, not to the template should be thrown.
<g_bor>I think that the error message is misleading this way.
<jcowan>It's often hard to know which one is at fault: if you are trying to match "Monday" against "~a", it will match the "Mon" and not know what to do with the "day", but perhaps you meant "~A" after all.
<roelj>Is there a predicate to detect an alist item: (A . B)? Something like 'pair?'?
<jcowan>(lambda (x) (and (pair? x) (not (null? (cdr x)))))
<roelj>jcowan: Thanks, but inputting '(A B) returns #t.
<jcowan>Oh, if you want to match that, pair? is indeed your only option.
<roelj>But why is (pair? '(A B)) => #t?
<civodul>roelj: the tragedy of Scheme IMO is that there's no disjoint type for "proper list"
<civodul>hence all this weirdness, the O(N) 'list?' predicate, etc.
<civodul>maybe we should change that in Guile 5
<roelj>heh
<roelj>Well, it's fun at times.. :)
<roelj>Can't wait for Guile 5 though.. ;)
<civodul>"can't wait" is ambiguous actually
<civodul>could mean you're impatient or that you literally cannot wait
<civodul>we'll let the ambiguity float around
<roelj>Or just that one is looking forward to it
<rlb>wingo: thanks - I'll poke around later.
<str1ngs>daviid: in g-golf all classes have a base class of <gobject> and a slot 'g-inst?
<rlb>I was also thinking about mwette's mmap proposal a while back to add an mmap interface, and in particular the use of GC_exclude_static_roots to mark the mapped region to avoid scanning. I ended up wondering if that was actually necessary on most platforms (just from some hints in the libgc docs), and if it could also be a problem, since I didn't see any way to unmark a region, say after you munmap it...
<civodul>rlb: i think libgc looks at /proc/self/maps to determine the set of current mappings
<civodul>so if you munmap a page, it just won't scan it anymore
<rlb>But if you've marked that range as unscannable, and then you munmap it and it's reused my malloc later?
<civodul>hmm, good question
<civodul>yeah, dunno
<rlb>i.e. then it should be scanned, but won't, unless libgc knows how to notice that.
<civodul>though note that malloc areas are not scanned by default
<civodul>only GC_malloc areas are
<rlb>OK, well I really meant "malloc" in the general sense, i.e. if libgc grabs that region again, since it may use mmap to get memory?
<rlb>I think it can be configured that way, and may do that by default on some platforms, but not sure.
<rlb>But there was a change note talking about issues on irix that made it sound like maybe on most platforms libgc already ignores malloced regions (which is what you were saying?), and if so, then there you could avoid the problem by just not making the GC_exclude_static_roots call in the first place (if there's even a problem in first place).
<rlb>Anyway -- just wondering -- I'll investigate if/when it's relevant to the things I'm working on.
<civodul>wingo: BTW, shouldn't we add 'guile-3' and 'guile-3.0' to %cond-expand-features?
<heisenberg-25>Hi, is there any sample code or library that I can use for producer-consumer threads in guile?
<nly>hi heisenberg-25
<nly>a sample generator https://git.savannah.nongnu.org/cgit/emacsy.git/tree/emacsy/circular.scm?h=new-mru#n94
***slyfox_ is now known as slyfox
<GNUtoo>hi,
<GNUtoo>(define %vm-domain-name "ftp.replicant.cyberdimension.org")
<GNUtoo>(string-append "/etc/" %vm-domain-name "/config")
<GNUtoo>what is the type of %vm-domain-name? strings?
<GNUtoo>*string
<GNUtoo>when I copy that in a file and run guile ./file and (write (string-append "/etc/" %vm-domain-name "/config")) it does what I expect
<GNUtoo>it prints it
<GNUtoo>but in GuiX I get that:
<GNUtoo>ERROR: In procedure string-join:
<GNUtoo> procedure string-append: Wrong type (expecting string): %vm-domain-name
<GNUtoo>is it a GuiX specific issue?
<civodul>hi GNUtoo!
<GNUtoo>hi
<GNUtoo>ah the issue seem to be in some other part of the configuration
<civodul>GNUtoo: it looks as if you wrote: (string-append "/etc" '%vm-domain-name)
<civodul>note the ' (quote)
<civodul>Scheme has strings and symbols
<civodul>symbols are sorta like strings, but immutable, and without double quotes around them
<GNUtoo>ah it's ' not `
<GNUtoo>I've been looking everywhere in the manual for what is `
<civodul>right, but if you want to refer to the variable, you need to remove that quote
<GNUtoo>what does ' or ` do?
<GNUtoo>it eval what's inside the parenthesis?
<GNUtoo>is it like (eval %vm-domain-name) ?
<civodul>see "quote" and "quasiquote" at https://www.gnu.org/software/guile/manual/html_node/Expression-Syntax.html#Expression-Syntax
<GNUtoo>Thanks a lot!
<civodul>you can try things out at the REPL (read-eval-print loop)
<civodul>just run "guile"
<civodul>and then try: (define x 42)
<civodul>'x
<civodul>x
<GNUtoo>I just tried that and I now understand that
<Tirifto>Hello! Anyone accustomed to editing Skribilo documents in Emacs here?