Re: Four problems with Scheme 48 1.8
Andreas Rottmann <[email protected]>
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Martin Ward <[email protected]> writes: > (1) Compiling with gcc version 4.4.0 gives an error on "make test": > > FAILURES: > Test case *3 [misc-big-tests] FAILED: >>From expression (* 47123 46039) EXPECTED value 2169495797 of 2169495797 > INSTEAD got -2125471499 > > '(#{Check-failure #{Test-case *3} (actual (* 47123 46039) -2125471499) > (expected 2169495797 2169495797) #{Procedure 983 (equal? in > scheme-level-1)}}) > > Compiling with gcc 4.0.1 seems to work OK. > I'll leave that one to more knowledgeable people than me. > > (2) I cannot figure out how to define a macro such as: > > (defmacro substr (str from . rest) > (if (null? rest) > ; two argument form of substr: > `(let ((s ,str)) > (substring s ,from (string-length s))) > ; three argument form of substr: > `(substring ,str ,from (+ ,from ,@rest)))) > Scheme48 doesn't have `define-macro'-style macros (which are a bad idea anyway, as they are inherently unhygienic); you'd either have to use syntax-rules, or use explicit-renaming macros[0]. For the above example, I syntax-rules suffices: (define-syntax substr (syntax-rules () ((substr str from) (let ((s str)) (substring s from (string-length s)))) ((substr str from count) (substring str from (+ from count))))) > (3) scheme48 won't accept ++ as a symbol name for some reason: > ++ is not a valid identifier according to R5RS (from the section "Lexical structure"): <identifier> --> <initial> <subsequent>* | <peculiar identifier> <initial> --> <letter> | <special initial> <letter> --> a | b | c | ... | z <special initial> --> ! | $ | % | & | * | / | : | < | = | > | ? | ^ | _ | ~ <peculiar identifier> --> + | - | ... So while `+' is a valid identifier, identifiers can not start with `+' in general. > scheme48 > Welcome to Scheme 48 1.8 (made by martin on Mon Jul 13 10:50:38 BST 2009) > Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. > Please report bugs to [email protected]. > Get more information at http://www.s48.org/. > Type ,? (comma question-mark) for help. >> (load "ALL2.scm") > ALL2.scm > Condition: (&interrupt post-major-gc) > 1> > Condition: (&interrupt post-major-gc) > 2> > > > ALL2.scm is 6.7MB of scheme source. > I think your heap size is too small; try starting scheme48 with a larger heap size, e.g.: % scheme48 -h 30000000 HTH, Rotty -- Andreas Rottmann -- <http://rotty.yi.org/>