IRC channel logs

2015-10-08.log

back to list of logs

<nalaginrut>morning guilers~
<nalaginrut>oops, I realized that I used 'unless' in a complete wrong way
<nalaginrut>fortunately, there's only one line code is wrong in Artanis
<ArneBab_>that speaks for a nice encapsulation
<amz3>héllo
<ArneBab_>hi
<davexunit>hmm, is there any way in SRFI-37 to know when the '--' token was encountered?
<davexunit>don't think there is, and that really throws off my plan.
<mark_weaver>davexunit: why do you need to know? as long as SRFI-37 treats all arguments after "--" as normal arguments (not options), isn't that good enough?
<davexunit>mark_weaver: I am experimenting with a better command line syntax for 'guix environment', in which the user doesn't have to quote the command they want to run.
<mark_weaver>skimming the source, it seems that they handle "--" specially in several places
<davexunit>my initial thought was:
<mark_weaver>davexunit: yeah, I saw your messages, and it sounds good to me.
<davexunit>guix environment --ad-hoc guile -- guile -c '(display "foo\\n")'
<davexunit>so, instead of using SRFI-37, I can split the arguments list before-hand
<mark_weaver>sure, if needed that sounds reasonable
<mark_weaver>(I haven't looked carefully)
<davexunit>the reason being that 'guix environment' already treats operands as package names
<mark_weaver>ah, although I guess maybe those "--" strings I saw in the code had to do with long option arguments
<davexunit>so without knowing the position of the operand relative to the '--' token, I can't distinguish between package operands and command operands.
<mark_weaver>davexunit: well, if SRFI-37 ignores options after the "--", then maybe you could do the split after SRFI-37 has extracted the options?
<mark_weaver>although I suppose it doesn't matter much either way
<davexunit>mark_weaver: it doesn't ignore them, but rather treats each token thereafter as an operand
<davexunit>even if it looks like a flag
<mark_weaver>well, that's what I meant by "ignore". it doesn't treat them as flags. I'd been using the word "options" as "flags".
<davexunit>oh sorry
<mark_weaver>I see code in srfi-37 that seems to handle "--". near the end.
<mark_weaver>see the line with comment: ;"--"
<davexunit>but there's still the lost context. the args-fold procedure will just call the operand handler for all of them.
<mark_weaver>and the code surrounding it.
<davexunit>but for 'guix environment', the operands before and after '--' must be treated differently
<davexunit>but AFAICT there's no way to know in args-fold
<mark_weaver>well, they are still operands
<mark_weaver>is the "--" reported as an operand?
<davexunit>no
<mark_weaver>ah, I see.
<mark_weaver>hmm
<mark_weaver>I wonder if it's unconventional to treat the operands following "--" specially, other than to inhibit their interpretation as flags.
<mark_weaver>I wonder what GNU getopt_long does
<davexunit>perhaps it is
<davexunit>the alternative approach is to change the 'guix environment' syntax further
<davexunit>and have packages *not* be operands
<davexunit>but there's some amount of unconventional stuff going on either way
<davexunit>for instance, 'sudo' and 'ssh' both have some way of detecting the first operand that signifies a program name
<davexunit>and processes all further opts as operands
<davexunit>'sudo guile --help' shows guile's help, not sudo's.
<mark_weaver>if you want to split the arguments at the "--" before passing to SRFI-37, I'm okay with that :)
<davexunit>mark_weaver: okay I'll give it a shot.
<ArneBab_>why does (floor 5.0) show 5.0 in the REPL, but (floor 5) show 5?
<ArneBab_>(= (floor 5.0) (floor 5)) ⇒ #t
<taylanub>I think I'll upload a clone of the guile repo to my GitHub account to be able to easily share the state of my work. I feel bad associating guile and GitHub...
<remi`bd> https://git.framasoft.org
<remi`bd>framasoft.org is an organization promoting free software in france
<remi`bd>their git repository service is nice and doesn’t come with the problems inherent to github
<taylanub>remi`bd: I'm afraid GitLab is non-free software
<taylanub>well, the "Enterprise Edition" is...
<davexunit>taylanub: git.framasoft.org is surely running the community edition
<davexunit>which is free
<taylanub>I see
<mark_weaver>ArneBab: (floor 5.0) is 5.0 because if the argument is inexact, the correctness of the result 5.0 is not known.
<mark_weaver>(floor 5) is 5 because the result is known to be an exact 5.
<mark_weaver>ArneBab: see the section on "Exactness" of the R5RS for more info
<amz3>davexunit: do you have solution the problem are raised on the mailling list regarding the building of the output ast using parser combinators?
<amz3>s/are/that I have/
<davexunit>amz3: I haven't seen such a post
<amz3>no problem
<davexunit>amz3: I haven't gotten an email, but it's in the archives online, so I'll read that.
<amz3>not interesting enough
<amz3>I will write a parser using your lib
<amz3>to exemplify the problem
<davexunit>amz3: oh cool you are using haunt :)
<amz3>:p
<amz3>I don't explain in terms of code what the problem is
<amz3>I don't recall the exact behavior of parser-combinator
<davexunit>amz3: it's cool that you have a working markdown parser!
<davexunit>very exciting.
<davexunit>amz3: fyi, my parser combinator library is based off of the same document that you linked to, with the same limitations.
<amz3>I don't use lift
<amz3>I'd like to move to your version as soon as
<amz3>I find a solution that is good
<amz3>first I need to check that the problem exist
<davexunit>my approach would be to translate markdown to sxml directly
<davexunit>because markdown is by definition a format for producing HTML
<davexunit>you can even embed html snippets in it
<davexunit>so sxml seems a natural representation.
<davexunit>civodul: speaking of all this document authoring stuff, Skribilo ought to be a useful tool to use in conjunction with Haunt since it can parse the Skribe format and do fontification for source code snippets.
<davexunit>but, I don't know how to use it yet.
<davexunit>I perused the manual but wasn't sure how I would go about reading a Skribe document and converting it to SXML.
<ArneBab>I just added a nicer API to the simple Python Scheme integration by wedesoft: https://gist.github.com/ArneBab/ab3e54bb16b317ee6d5d
<ArneBab>import guile
<ArneBab>guile.call("write", "Hello World!")
<ArneBab>
<ArneBab>mark_weaver: thank you!
<ArneBab>mark_weaver: why do they compare as #t?
<ArneBab>the result is not known to be exactly 5 — it confused me that on the one hand they are equal, but they aren’t shown equal.
<lloda>those equals are not the same
<taylanub>ArneBab: = tests numeric equality, which is lax on exactness. like 5.0 == 5 in C AFAIK. but they are not the same Scheme object, so they're not eqv?.
<civodul>davexunit: the Skribe format is just Scheme with square brackets to introduce literal text
<civodul>the 'chapter' procedure returns an AST node, and so on
<taylanub>ACTION wonders why (rnrs hashtables) doesn't throw an exception when an immutable hashtable is mutated, and instead simply ignores the attempted mutation
<ArneBab>taylanub: ah, yes, eqv? is #f
<ArneBab>(eqv? (round 5.0) (round 5)) ⇒ #f
<ArneBab>thank you!
<ArneBab>bbl
<davexunit>civodul: I guess I just don't know how to take a Skribe file, read it, and get a data structure that I can work with to produce SXML.
<davexunit>I'd like to use the Skribe format to write my blog posts from now on with Haunt.
<davexunit>and I'd also like to take advantage of Skribilo's fontification.
<davexunit>which makes me wonder if just using Skribilo would be better than this whole Haunt thing
<rekado>davexunit: I'm using Skribe with Haunt for my blog.
<rekado>davexunit: code is here: http://git.elephly.net/?p=software/elephly-net.git;a=tree
<davexunit>rekado: haha how are you a more advanced Haunt user than I am? thanks!
<davexunit>wow the skribe reader is tiny
<davexunit>okay, I'm going to snarf that and credit you and civodul appropriately :)
<rekado>I had an itch to scratch. My blog was completely disfunctional after my move to GuixSD, as we don't have Hakyll (and packaging it is hard).
<davexunit>then I can commence with migration away from Pelican.
<davexunit>and seriously dog food this thing
<rekado>see also haunt.scm, which defines a couple of additional things.
<davexunit>awesome stuff :)
<davexunit>thanks rekado
<davexunit>you are truly a wizard
<rekado>also note that I'm using "eval" there where I probably should be doing some macro stuff instead.
<rekado>hah, a wizard! Far from it.
<rekado>I'm just a really patient plumber.
<civodul>rekado: ooh, neat!
<davexunit>rekado: ah yes, you can use a macro there instead.
<rekado>I must admit that I'm not as comfortable with macros as I should be. But I'm also not ashamed enough to use "eval" in Scheme... (it's a different story in other languages).
<amz3>davexunit: what is expecting match-lambda as arguments? I can't find it in guile procedure index
<amz3>I'm inverstigating parse-match, seems like the thing i was looking for :-)
<amz3>IIUC parse-bind is basically «maybe 'g o f'»
<taylanub>w00t, SRFI-126 sans ephemeral tables was pretty easy to implement in Guile. oh, I'm yet missing quasiquote. https://github.com/TaylanUB/guile/blob/stable-2.0/module/srfi/srfi-126.scm
<taylanub>(I won't propose that as a patch for the time being; it's primarily to have a sample implementation for the SRFI)
<amz3>got it via sources
<davexunit>amz3: match-lambda is undocumented, needs to be fixed.
<davexunit>but
<davexunit>it expands to something like
<davexunit>(lambda (thing) (match thing ...))
<amz3>obvioulsy, but I was not sure with the macro et al.
<amz3>(define-syntax match-lambda
<amz3> (syntax-rules ()
<amz3> ((_ (pattern . body) ...) (lambda (expr) (match expr (pattern . body) ...)))))
<davexunit>yeah thats it
<taylanub>we can extend the reader, but can we extend quasiquote? I just implemented #hash((a . x) (b . y) ...) as part of SRFI-126 but adding the quasiquote integration seems harder...
<remi`bd>isn’t ` a some kind of reader-macro for the special operator “quasiquote”?
<remi`bd>s/a some/some/
<taylanub>yeah, I mean the macro 'quasiquote'. it's defined in psyntax.scm, where dragons lie.
<remi`bd>oops, sorry
<taylanub>np
<davexunit>rekado: btw I'm very jealous of your really slick theme
<davexunit>the CSS is very nice
<amz3>davexunit: parse-match is very nice, one last check and i rewrite my parser using it
<amz3>ACTION likes it too
<davexunit>amz3: oh cool! let me know if you run into issues.
<taylanub>when I have a reader extension for #foo, I need to register an extension for the char 'f'. how can I make this work with other extensions with 'f' as the first letter?
<davexunit>rekado: I saw this in your haunt.scm: (@@ (haunt builder blog) render-post)
<davexunit>guess it would be a good idea to make that public
<remi`bd>taylanub: couldn’t you, in your reader macro, see if it’s a #foo and if not call the old reader macro?
<taylanub>remi`bd: hmm, pretty tricky. I'd need to save the old 'f' macro, then when I detect something that isn't 'foo' I'd need to "unread" the letters I read from the input port, so the old macro can read them
<taylanub>are our hash functions salted?
<paroneayea>taylanub: I don't think salting applies here
<paroneayea>a rainbow table wouldn't be effective against the size and non-dictionary'ness of inputs here
<taylanub>paroneayea: it was a generic question...
<taylanub>AFAIUI salting hash table hashes is a generally good idea, against hash collision DoS attacks
<taylanub>I just asked for my sample SRFI-126 implementation by the way, not that I need it for something
<davexunit>interesting document about threading macros in Racket
<davexunit> http://pkg-build.racket-lang.org/doc/threading/index.html
<davexunit>I wrote a threading macro that handles a basic case where the "hole" is assumed to be at the end of the argument list
<civodul>these macros look pretty cool
<davexunit>yeah
<davexunit>civodul: here's my not-so-fancy macro of a subset of that: https://git.dthompson.us/sly.git/blob/HEAD:/sly/utils.scm#l73
<davexunit>lambda~> is cool
<davexunit>and so is and~>
<civodul>indeed
<davexunit>speaking of generally useful libraries, I've been meaning to write a zipper implementation to throw at guile-user
<civodul>would be nice!
<davexunit>I just throw things at guile-user and hope that other people improve them for me ;)
<civodul>that's a clever strategy :-)
<civodul>davexunit: your Git server is full of goodies!
<civodul>parser combinators, etc.
<davexunit>some more working than others ;)
<davexunit>I'd love to see more work done on parser combinators
<civodul>heh
<davexunit>it cannot handle left recursive grammars right now, because I didn't know how to implement it without completely destroying what makes the implementation elegant.
<davexunit>but for right recursive grammars it works just fine.
<ArneBab>BY-SA and GPL: creativecommons closed the chasm in the sharealike/copyleft community: http://draketo.de/english/free-software/by-sa-gpl
<ArneBab>ACTION is deeply happy about that!
<paroneayea>ArneBab: \\o/
<paroneayea>ArneBab: great to see this
<paroneayea>ArneBab: I was pushing for this hard before I left CC, but work happened long after I went
<paroneayea>for several years!
<ArneBab>paroneayea: I have been part of some of that work :)
<paroneayea>ArneBab: oh cool
<ArneBab>took a lot of de-FUDding :)
<ArneBab>but it’s great that it worked!
<ArneBab>and also great to hear that you were part of it, too!