[gambit-list] silex string-append problem

Marc Feeley feeley at iro.umontreal.ca
Sat Jan 14 08:22:11 EST 2012


On 2012-01-14, at 7:34 AM, Sascha Ziemann wrote:

> 2012/1/13 Marc Feeley <feeley at iro.umontreal.ca>:
>> 
>>> *** ERROR IN out-print-table-data, "silex/silex.scm"@4774.13 -- Number
>>> of arguments exceeds implementation limit
>>> (string-append
>> 
>> Just replace (apply string-append x) with (append-strings x).
>> 
> 
> Thanks! This fixes the problem without the need to patch silex:
> 
> (cond-expand
> (gambit
>  (define %apply apply)
>  (define-syntax apply
>    (syntax-rules (string-append)
>      ((_ string-append list)
>       (append-strings list))
>      ((_ func list)
>       (%apply func list)))))
> (else #f))

Something like the following definition will also solve the problem, but without relying on a syntactic pattern.

(define apply
  (let ((old-apply apply))
    (lambda (f args)
      (cond ((eq? f string-append)
             (append-strings args))
            ((eq? f string)
             (list->string args))
            ;;...
            (else
             (old-apply f args))))))

Marc




More information about the Gambit-list mailing list