IRC channel logs

2022-12-18.log

back to list of logs

<mwette>nice recruiting job, cwebber
<roptat>hi! is there a function that evaluates whether a predicate is true for all members of a list?
<argv>roptat: not an expert, but you can use filter and match the length
<xd1le>roptat, every
<xd1le>?
<xd1le>from sfri-1
<argv>eevry is better
<argv>s/eevry/every
<chrislck>flatwhatson: are you coping with aoc?
<chrislck>ACTION gives up after 11a
<flatwhatson>chrislck: i had to tap out, 11a was also my last
<chrislck>o/
<flatwhatson>they're fun but started to overrun my "free time" budget :)
<chrislck>later ones are more maths than code
<argv>flatwhatson, chrislck do you mind if i ask for your solutions? I did it until 10a but this was my first time with Guile and it would be interesting to see other guile solutions.
<flatwhatson>argv: https://github.com/flatwhatson/advent-2022
<xd1le>s/sfri/srfi
<argv>I'll check it out, mine are here btw if you want to see: https://git.argc.in/ankit/aoc-2022
<argv>what is the significant of using % before variable names? Is it some convention?
<flatwhatson>it's just a convention for globals
<argv>ah I see
<chrislck>argv: https://github.com/christopherlam/aoc2022
<argv>looks like i could've saved some effort with ice-9 match 😅
<chrislck>flatwhatson: ooh peg, how fancy
<chrislck>ACTION likes golfing a tad too much
<argv>chrislck: heh, initialized vectors in day 5
<chrislck>tfw day5b is shorter than day5a
<argv>heh for me day 7 was the one where i lost sleep
<argv>missed the case where dirname can be same under different trees, wrote two different implementation and got same wrong answer
<dadinn>hi all
<dadinn>i am experimenting with syntax-case macros, and found that datum->syntax fails to work as described on this page: https://www.gnu.org/software/guile/manual/html_node/Syntax-Case.html
<dadinn>,(datum->syntax #f 'stuff)
<mwette>Can you show your code?
<dadinn>the docs say: " If template-id is false, the datum will have no lexical context information. "
<dadinn>while my code throws error: In procedure syntax-wrap: Wrong type argument in position 1 (expecting syntax object): #f
<mwette>hmm ... reading the source, it seems to take #f
<mwette>can you try adding bogus source? (datum->syntax #f 'stuff #:source (vector "foo.scm" 1 1))
<mwette>maybe bug crept in w/ update to reader
<mwette>So, if try your expression at the repl prompt it returns #<syntax stuff>
<mwette>I think it may be something else.
<mwette>In your code.
<dadinn>I just enter (datum->syntax #f 'stuff) in the REPL, nothing else. My guile version is 3.0.5
<dadinn>if I do (datum->syntax (syntax #f) 'stuff) then it returns #<syntax stuff> without error... but how do I check that it is indeed without any context?
<dadinn>I am not sure I actually even need this. This is my code: https://termbin.com/o7nia
<dadinn>I am trying to define those symbols (pid, loop, line, port) to be returned verbatim, without any context. Unlike expect-port which I would expect to be captured in the context calling the macro.
<dadinn>I also have this defmacro implementation which seem to work fine: https://termbin.com/h85qc
<mwette>mine is 3.0.8
<dadinn>Just wanted to experiment whether I understand syntax-case correctly enough to be able to rewrite it hygienically :/
<mwette>maybe use your (syntax #f) workaround until you can use 3.0.8 or whatever fixes that
<mwette>to check (source-properties (datum->syntax #f 'stuff)) => '()
<roptat>xd1le, thanks, than's exactly what I wanted, I was looking for "forall" in the manual but of course it wasn't under that name ^^'
<lilyp>forall sounds rather close to for-each ;)
<roptat>"for_all" is the name of that function in OCaml
<roptat>that's why I thought of this name
<civodul>roptat: speaking of which, ocaml 5 is out!
<dadinn>mwette: my assumption about source-properties is that it only contains the filename line and column where the syntax object was defined. I would assume that is not the same as the lexical context which is used by the syntax transformer? Is there some way to retrieve that information? it's called "template-id" in the docs :/
<mwette>I think they are essentially the same. Guile now (internally, at least) uses a vector version of source properties alist.
<mwette>You can look in ice-i/psyntax.scm, at macroexpand.
<mwette>rlb: I get the drift that you are working on update to string handling in Guile. Does your work address the task of moving strings to/from bytevectors? Currently, two copies are required (e.g., string->utf and bytevector-copy!).