Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
Hi Alex, Alex Shinn alexsh...@gmail.com skribis: This is not a bug. R5RS states: The keyword at the beginning of the pattern in a syntax rule is not involved in the matching and is not considered a pattern variable or literal identifier. R6RS forbids _ as a literal. R7RS retains the R5RS ignoring of the initial keyword, adds _ as a wildcard, but allows it to be used as a literal. So this code would only break in R6RS. Interesting, thanks for the clarification. So I guess the safest decision for Guile is to keep the current behavior. Thanks, Ludo’.
Re: Guile 2.0.6 - some tests fail
diff --git a/test-suite/tests/ftw.test b/test-suite/tests/ftw.test index 33537d0..a3be1a7 100644 --- a/test-suite/tests/ftw.test +++ b/test-suite/tests/ftw.test @@ -189,7 +189,7 @@ (up (lambda (n s r) (cons `(up ,n) r))) (skip (lambda (n s r) (cons `(skip ,n) r))) (error (lambda (n s e r) (cons `(error ,n) r - (equal? (file-system-fold enter? leaf down up skip error '() %test-dir) + (equal? (pk 'never-enter (file-system-fold enter? leaf down up skip error '() %test-dir)) `((skip , %test-dir) (pass-if test-suite/lib.scm (flat file) @@ -200,7 +200,7 @@ (skip (lambda (n s r) (cons `(skip ,n) r))) (error (lambda (n s e r) (cons `(error ,n) r))) (name (string-append %test-suite-lib-dir /lib.scm))) - (equal? (file-system-fold enter? leaf down up skip error '() name) + (equal? (pk 'flat (file-system-fold enter? leaf down up skip error '() name)) `((leaf ,name) (pass-if ENOENT @@ -320,7 +320,7 @@ (not (scandir /.does-not-exist.))) (pass-if no select -(null? (scandir %test-dir (lambda (_) #f) +(null? (pk 'no-select (scandir %test-dir (lambda (_) #f)) ;;; Local Variables: ;;; eval: (put 'with-file-tree 'scheme-indent-function 2) diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test index 613d269..f00e693 100644 --- a/test-suite/tests/ports.test +++ b/test-suite/tests/ports.test @@ -1188,7 +1188,7 @@ (equal? (string-append (assoc-ref %guile-build-info 'top_srcdir) /module/ice-9/q.scm) (with-fluids ((%file-port-name-canonicalization 'absolute)) - (port-filename (open-input-file (%search-load-path ice-9/q.scm))) + (pk 'canon (port-filename (open-input-file (%search-load-path ice-9/q.scm (delete-file (test-file))
Re: Guile 2.0.6 - some tests fail
Hi Jan, FYI, your email had Content-Type: multipart/alternative, where one part was your email's main text (reproduced below) and the other part was the patch. This was an improper use of that MIME type, which suggests that the user agent should normally show only one of the parts. It caused my user agent (Gnus v5.13) to show only the patch. Content-Type: multipart/alternative is most commonly used to include both HTML and plain-text variants of the same text within an email. Mark Jan Synacek jsyna...@redhat.com writes: Hello, I'm sorry for such late responses. Sure, I will try. I will not have that computer available until the next monday though.. I also tried the tests (without the patch) on my home laptop and they passe= d. I use plain ext4 there, no lvm. Cheers, Jan
Re: [PATCH] Implement ‘hash’ for structs
l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: I guess this 'if' is to avoid an infinite loop if the struct points back to itself. However, it apparently fails to detect cycles in the general case. Yes, indeed. Here’s an updated patch that uses the ‘depth’ argument of ‘scm_hasher’ for that, as is done for pairs. I don't think 'depth' is an appropriate name for that argument. The way it is used when hashing vectors (see below) implies that it is roughly proportional to the number of elements to traverse, not the depth: --8---cut here---start-8--- case scm_tc7_wvect: case scm_tc7_vector: { size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj); if (len 5) { size_t i = d/2; unsigned long h = 1; while (i--) { SCM elt = SCM_SIMPLE_VECTOR_REF (obj, h % len); h = ((h 8) + (scm_hasher (elt, n, 2))) % n; } return h; } else { size_t i = len; unsigned long h = (n)-1; while (i--) { SCM elt = SCM_SIMPLE_VECTOR_REF (obj, h % len); h = ((h 8) + (scm_hasher (elt, n, d/len))) % n; } return h; } } --8---cut here---end---8--- I would do something that preserves the meaning of 'd' consistent with its use above. Maybe it should be called something like 'effort'. Thanks, Mark
Re: [PATCH] Implement ‘hash’ for structs
Hi, Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: I guess this 'if' is to avoid an infinite loop if the struct points back to itself. However, it apparently fails to detect cycles in the general case. Yes, indeed. Here’s an updated patch that uses the ‘depth’ argument of ‘scm_hasher’ for that, as is done for pairs. I don't think 'depth' is an appropriate name for that argument. Yeah, it’s debatable. It’s called just ‘d’ in hash.c, and Andy renamed it to ‘depth’ in 2.1. I think ‘depth’ conveys the idea that it’s about limiting the recursion depth. I’d keep it this way for consistency. Thanks, Ludo’.