hello,
is it possible to overload an existing operator in Guile?

example overload + to concatenate vectors.

for example in Scheme (+ i admit) i can do :
; first stage overloading
(define-overload-existing-operator +)

; second stage overloading
(overload-existing-operator + vector-append (vector? vector?))

and use it like that:
> (+ #(1 2 3) #(4 5 6))
'#(1 2 3 4 5 6)
> (+ #(1 2 3) #(4 5) #(6 7 8 9))
'#(1 2 3 4 5 6 7 8 9)
> {#(1 2) + #(3) + #(4 5 6)}
'#(1 2 3 4 5 6)

is it possible and how to do it using GOOPS (guile object oriented
programming system) , i already did some sort of thing with new object
, but not with an existing operator like + that apply to numbers only.

Regards,
Damien

Reply via email to