Set!: cannot mutate module-required identifier

i have a module that contains a single variable:

(module infix-operators racket

	(provide infix-operators-lst)

	(include "exponential.scm")
	(include "modulo.scm")
	(include "bitwise.rkt")
	(include "not-equal.scm")
	
	
		;; note: difference between bitwise and logic operator


	;; 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 & ∣ )

	   (list < > = <> ≠ <= >=)
	  
	   )

	  )

	) ;; end module

in the main i 'require' the above module and i need to modify this variable but i got an error:

set!: cannot mutate module-required identifier in: infix-operators-lst

how can i do?

ok the solution is here:

https://docs.racket-lang.org/guide/module-set.html

(module infix-operators racket

	(provide infix-operators-lst
		 set-infix-operators-lst!)

	(include "exponential.scm")
	(include "modulo.scm")
	(include "bitwise.rkt")
	(include "not-equal.scm")
	

	(define infix-operators-lst
	 
	  (list
	   
	   (list expt **)
	   (list * / %)
	   (list + -)
	   
	   (list << >>)

	   (list & ∣ )

	   (list < > = <> ≠ <= >=)
	   
	 
	   )

	  )


	(define (set-infix-operators-lst! lst)
	  (set! infix-operators-lst lst))

	) ;; end module

1 Like