IRC channel logs

2023-12-31.log

back to list of logs

<freakingpenguin>Hi guile. I'm trying to write a function that takes a list of procedures and a val, then computes (p1 (p2 (p3... val))). I can get it working for a set count of procedures, but not a list. Would appreciate any help :) https://paste.debian.net/1302571
<cow_2001>freakingpenguin: wait!
<cow_2001>how about (fold compose identity procedures)?
<cow_2001>((fold compose identity procedures) seed)
<cow_2001>or ((apply compose procedures) seed)
<cow_2001>don't know about order of composition. you would have to look it up or experiment
<cow_2001>>_>
<cow_2001>sigh
<freakingpenguin>cow_2001: Thanks! ((fold compose identity procs) val) did it. Another issue was how I was passing args to the function. The lists weren't constructed how I thought.
<freakingpenguin>Only annoyance is I have to pass procs as a list, (apply-functions '(1+ 1+) 2) instead of (apply-functions 1+ 1+ 2). Doesn't seem possible to capture first N args in list and store last in val, only the reverse.
<freakingpenguin>And where I plan on using this, val's sexp will be much longer than the proc list.
<freakingpenguin>That should be (list 1+ 1+)... not ' >.<
<apoorv569>Happy new year everyone!
<tomnor>scheme@(guile-user)> (string-match "A|[AB]" "AB")
<tomnor>$2 = #("AB" (0 . 1))
<tomnor>This is what I would expect, 'A' is matched. But
<tomnor>scheme@(guile-user)> (string-match "A|[AB]+" "AB")
<tomnor>$3 = #("AB" (0 . 2))
<tomnor>Now 'AB' is matched
<tomnor>Trying the equivalent in Python gives the first alternative, 'A'. So it is different behaviour.
<Arsen>well, they're different RE engines
<tomnor>yes
<dsmith>Guile uses the C library regex
<tomnor>yes
<tomnor>I just compared...
<tomnor>But I was a bit surprised
<dsmith>But I would expect that "[ab]+" *would* match "ab"
<tomnor>Of course, but I was using the rx OR operator
<tomnor>And thought that the first alternative "wins"
<dsmith>Maybe the python doesn't return the longest match?
<tomnor>It does in other cases, its "greedy" per default
<tomnor>It has a non-greedy syntax though
<tomnor>But that is another story I think
<dsmith>Curious what python would do with "[AB]+|A"
<tomnor>It gives AB
<grtcdr>Hi guilers! I'm wondering if someone knows how to get Haunt to descend into post directories recursively, preserving the directories after export?
<grtcdr>I've got a very specific hierarchy: YYYY/MM/DD. The two first components are directories, the last is a Markdown file without an extension.
<grtcdr>I've defined my own commonmark reader whose "matcher" argument always returns #t, but because the posts are in nested directories, they're never matched.
<dthompson>grtcdr: posts do not map to any particular output file directly. it's up to your builders to generate the desired artifacts. so you're directory structure is more for your own organization
<dthompson>your*
<grtcdr>Ah, so the next step would be to define a custom builder that takes into account that file hierarchy?
<dthompson>it wouldn't use the file hierarchy but rather the post metadata
<dthompson>file name is not preserved in post objects. maybe it should be but I'm not convinced at this point.
<dthompson>use post-date to get the associated 'date' metadata field of a post
<grtcdr>My posts are limited in that regard, they only contain a "title" attribute, but this title does contain the date in YYYY-MM-DD, which directly translates to the filename (hyphens would have to be transformed to slashes).
<grtcdr>s/in YYYY-MM-DD/in YYYY-MM-DD form/
<dthompson>my intention with posts is that they form a simple database that you query against by inspecting metadata
<dthompson>parsing the title sounds unideal but sufficient
<grtcdr>That's a good approach, by the way, to contextualize my request, this project is a diary that I intend to bring to the browser, for no reason besides exploring the
<grtcdr>dthompson: Yeah, it is inefficient, would you say storing the date in the appropriate attribute, i.e. "date", and then displaying the date as the title is a better approach?
<dthompson>what's convenient about 'date' is that it gets parsed to a proper date object
<grtcdr>That would eliminate a format such as "Monday, 2024-01-01"?
<grtcdr>I think string->date has me covered in this regard
<dthompson>you'd have a metadata line like "date: 2023-11-08 10:00"
<dthompson>yeah whatever string->date can parse
<dthompson>you can then format that however you want in your output
<grtcdr>That's wonderful, thank you for your insight and help, I really appreciate it!
<dthompson>the default blog builder uses the 'title' metadata, though, so I think you're well into custom builder territory at this point
<dthompson>grtcdr: good luck, have fun!
<grtcdr>I totally am, it feels good to hack one's own static site generator. Thank you for this great project!
<dthompson>glad you're enjoying it! hope it's easy enough to hack on, that was my goal
<grtcdr>I called save-buffer to save ERC logs and that made a huge mess, should've known erc-save-buffer-in-logs was a thing.