hi,

i have a main Scheme+ module that exports an overload macro:
(define-module (Scheme+)

  #:use-module (growable-vector)
  #:use-module (ice-9 local-eval)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1) ;; any,every
  #:use-module (srfi srfi-69) ;; Basic hash tables
  #:use-module (srfi srfi-31) ;; rec
  #:use-module (srfi srfi-26) ;; cut

  #:export (!*prec set-infix-operators! overload overload-procedure
overload-operator overload-function $nfx$ def $bracket-apply$ <- ← ->
→ <+ ⥆ +> ⥅ declare $> $+>  condx ≠ ** <v v> ⇜ ⇝ repeat % << >> & | )

... code cut ...

(include-from-path "overload.scm")

...

the overloads macros defined in overload.scm like that:

(define-syntax overload

  (syntax-rules ()

    ;; arguments are symbol of function to be overloaded, procedure
that do the overloading, list of predicate to check the arguments
    ((_ funct-symb proc (pred-arg1 ...))
     (overload-procedure funct-symb proc (pred-arg1 ...)))

    ((_ funct-symb proc (pred-arg1 ...) quote-operator)
     (begin
       (overload-operator funct-symb proc (pred-arg1 ...))
       (update-operators))
       )

    ((_ funct-symb proc (pred-arg1 ...) quote-operator quote-n-arity)
     (begin
       (overload-n-arity-operator funct-symb proc (pred-arg1 ...))
       (update-operators)))))

i just show one macro of file


and a program that use the Scheme+ module and overload macro:

(use-modules (Scheme+)

....

(include "guile/logiki+.scm")

finally logiki+.scm use overload:

(initially overload.scm was included from here and it worked well but
now it is in Scheme+ it gives the error in subject)

;; overload tests

(define (add-pair p1 p2) (cons (+ (car p1) (car p2)) (+ (cdr p1) (cdr p2))))

(overload + add-pair (pair? pair?) 'operator)  ;; line 4818

(define (mult-num-vect k v) (map (λ (x) (* k x)) v))
(overload * mult-num-vect (number? list?) 'operator)

{t <+ {3 * '(1 2 3) + '(4 5 6) + '(7 8 9)}}
(display t) (newline)

when run i have this error:

scheme@(guile-user)> (load "start-λογικι-guile+.scm")
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/guile/site/3.0/Scheme+.scm
;;; compiling /usr/local/share/guile/site/3.0/growable-vector.scm
;;; compiled 
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/growable-vector.scm.go
;;; compiled 
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/Scheme+.scm.go
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong type to apply: #<syntax-transformer overload>

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
In ice-9/boot-9.scm:
   2836:4  4 (save-module-excursion _)
  4388:12  3 (_)
In 
/Users/mattei/Library/CloudStorage/Dropbox/git/library-FunctProg/guile/logiki+.scm:
   4418:0  2 (_)
   4418:0  1 (_)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)
scheme@(guile-user) [1]>

i found really poor info on this error:

https://stackoverflow.com/questions/50057773/sicp-practise-3-51-wrong-type-to-apply-syntax-transformer-cons-stream

any idea?

regards,
Damien

Reply via email to