in the past Scheme+ was a module/package ,no more now.
i perheaps bad explained, the problem,about the error, it can. not be found overload.scm.
About package, all was in package, but it is quite impossible to do infix, with precedence, and WITH overload without knowing from each procedure used in scheme+, precedence procedure, infix procedure, how the overloaded procedure had became. That is the + operator existing at the beginning of Scheme+ loading is not the same after being overloaded and then the infix procedure and precedence must know it... i have not other solution but (include files) progrssively, example:
(provide (all-defined-out))
(require srfi/42) ; Eager Comprehensions
(require "matrix.rkt")
(require "matrix-by-vectors.rkt")
(require "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/overload.scm")
(include "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/Scheme+.rkt")
(include "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/assignment.rkt") ; all sort ofassignment with <-
(include "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/apply-square-brackets.rkt") ; all sort of indexing with []
; first stage overloading
(define-overload-existing-operator +)
(define-overload-existing-operator *)
(define-overload-procedure uniform)
; to take in account the new overloaded operators scheme-infix.rkt must be included
; after the overloading first stage definition of operators
(include "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/scheme-infix.rkt") ; add operator precedence to infix notation
; second stage overloading
(overload-existing-operator + vector-append (vector? vector?))
(overload-existing-operator * multiply-flomat-vector (flomat? vector?))
;; return a number in ]-1,1[
;; the dummy parameter is needed by a flomat procedure
(define (uniform-dummy dummy) {(random) * (if {(random 2) = 0} ; we randomly choose the sign of the random number
1
-1)})
; return a random number between [inf, sup]
(define (uniform-interval inf sup)
{gap <+ {sup - inf}}
{inf + gap * (random)}) ;; operator precedence ,* over +,is used in this expression
(overload-procedure uniform uniform-dummy (number?))
(overload-procedure uniform uniform-interval (number? number?))
; sigmoïde
(define (σ z̃)
{1 / {1 + (exp (- z̃))}})
; some derivatives
i can not find a way in Racket to "share" a module definition, for example share the infixe precedence operator list:
;; a list of lists of operators. lists are evaluated in order, so this also
;; determines operator precedence
;; added bitwise operator with the associated precedences and modulo too
(define infix-operators-lst
;;'()
(list
(list expt **)
(list * / %)
(list + -)
(list << >>)
(list & ∣ )
; now this is interesting: because scheme is dynamically typed, we aren't
; limited to any one type of function
(list < > = <> ≠ <= >=)
;;(list 'dummy) ;; can keep the good order in case of non left-right assocciative operators.(odd? reverse them)
)
)
but note that overload.scm MUST be a module/package , i faced the case of infinite recursion due to have overloaded a procedure used in the included definitions of overload.scm (examle : overload 'length' but 'length' was used in overload procedure causing endless search in the overloaded method)
i admit this seems ugly to be forced to include some files in main file instead of requiring them but the result is good and it keep hygiene too and all is R*RS compliant, here is a few examples of what can be done:
(for ([i (in-range {n - 2})])
;; create an array with 1 in front for the bias coefficient
{z_1 <- #(1) + z[i]} ; + operator has been overloaded to append scheme vectors
{z̃[i + 1] <- M[i] * z_1} ; z̃ = matrix * vector , return a vector
{z[i + 1] <- vector-map(activation_function_hidden_layer z̃[i + 1])}
) ; end for
; modify coefficients layer
(define (modification_des_poids M_i_o η z_input z_output z̃_output ᐁ_i_o მzⳆმz̃) ; derivative of activation function of the layer
; the length of output and input layer with coeff. used for bias update
{(len_layer_output len_layer_input_plus1forBias) <+ (dim M_i_o)} ; use values and define-values to create bindings
{len_layer_input <+ {len_layer_input_plus1forBias - 1}}
(for ([j (in-range len_layer_output)]) ; line
(for ([i (in-range len_layer_input)]) ; column , parcours les colonnes de la ligne sauf le bias
{M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- η) * z_input[i] * მzⳆმz̃(z_output[j] z̃_output[j]) * ᐁ_i_o[j]}})
; and update the bias
{M_i_o[j 0] <- M_i_o[j 0] - {(- η) * 1.0 * მzⳆმz̃(z_output[j] z̃_output[j]) * ᐁ_i_o[j]}}))
moreover , the ,index operator as in Python and C++ can be overloaded dynamically, it is the procedure bracketapply in SRFI 105 curly infix and this variable MUST be known from top-level , the reader transform the syntax from curly infix to prefix,making bracketapply appear, so things can be in module but must be shared.
the data structure used in 'bracketapply' is overloaded,example:
> (overload-square-brackets matrix-vect-ref
matrix-vect-set! (matrix-vect? number? number?))
> (overload-square-brackets matrix-vect-line-ref
(lambda (x) '()) (matrix-vect? number?))
> (define Mv (matrix-vect #(#(1 2 3) #(4 5 6))))
> $ovrld-square-brackets-lst$
'(((#<procedure:matrix-vect?> #<procedure:number?>) (#<procedure:matrix-vect-line-ref> . #<procedure>))
((#<procedure:matrix-vect?> #<procedure:number?> #<procedure:number?>) (#<procedure:matrix-vect-ref> . #<procedure:matrix-vect-set!>)))
> {Mv[1]}
'#(4 5 6)
> {Mv[1][0]}
4
> {Mv[1 0]}
4
in the previous example this allow two possibility of indexing a 2 dimension object: array[i1 i2] (like Python NumPy ) and array[i1][i2] (like Python), it then become:
{M_i_o[j][i + 1] <- M_i_o[j] [i + 1] - {(- η) * z_input[i] * მzⳆმz̃(z_output[j] z̃_output[j]) * ᐁ_i_o[j]}})
i can not find a solution in Racket, the Guile port of code allow that.