Email or username:

Password:

Forgot your password?
Top-level
Grigory Shepelev

@wingo @rml @cwebber
@monkey1

Imagine that you have a module already written by someone that does the job you want to, but there is only one variable (example `(define pi 3.14)` ) that you want just override but otherwise would like everything to work as previously. Wouldn't like to copy-paste a one of code

6 comments
Grigory Shepelev

@rml @wingo @cwebber @monkey1

it won't update setted variable's value in all procedures of `(X)` that uses `x`. `(define (square r pi) (* r r pi))` <-- here pi will stay 3.14 when `square` will be called from `(Y)`

Grigory Shepelev

@rml @wingo @cwebber @monkey1 probably the answer given was toatally correct. set! and stuff will work in repl, but won't when launched in the testing env that I just set up.

blake shaw 🇵🇸

@shegeley @wingo @cwebber @monkey1 so you just need to create an alias? In that case (define my-alias the-original) works fine except when dealing with syntax. In that case, you can do

(define-syntax my-alias
(identifier-syntax the-original))

Might have left something out of that bcs im writing from my phone, currently on the move, so lmk if that didn't work and ill take a look.

Janneke

@shegeley @wingo @rml @cwebber @monkey1
Yeah, use guile-2.2 and module-define!, or create a new module and import everything else, e.g.., do something like

(define-module (math square+)
#:export (square))

(define pi 3.1415)
(define square (@@ (math square) square))
...

Go Up