unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* error Wrong type to apply: #<syntax-transformer
@ 2023-08-03  9:09 Damien Mattei
  2023-08-03  9:36 ` Damien Mattei
  0 siblings, 1 reply; 13+ messages in thread
From: Damien Mattei @ 2023-08-03  9:09 UTC (permalink / raw)
  To: guile-user

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



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-08-09 13:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03  9:09 error Wrong type to apply: #<syntax-transformer Damien Mattei
2023-08-03  9:36 ` Damien Mattei
2023-08-03  9:58   ` Jean Abou Samra
2023-08-03 11:01     ` Damien Mattei
2023-08-04  8:23       ` Damien Mattei
2023-08-04  8:31         ` Jean Abou Samra
2023-08-04 12:45           ` Damien Mattei
2023-08-08 19:38     ` Maxime Devos
2023-08-08 20:17       ` Damien Mattei
2023-08-08 23:00       ` Jean Abou Samra
2023-08-09  9:42         ` Maxime Devos
2023-08-09 10:25           ` Maxime Devos
2023-08-09 13:22           ` Jean Abou Samra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).