Is there something that allows to recompile just specific parts of the code without re-compiling everything?
Here is a proof-of-concept.
Put the following in a file "defun.rkt".
Whenever you expect you will need to redefine a function, use defun instead of define.
Then in the repl, you can use defun to redefine the function.
Other functions referring to the function will pick up the new definition.
defun.rkt
#lang racket
(provide defun)
(define globals (make-hasheq))
(define-syntax ref
(syntax-rules ()
[(_ref id)
(hash-ref globals 'id)]))
(define-syntax defun
(syntax-rules ()
[(_defun (id arg ...) body0 body ...)
(begin
(define (id arg ...)
((ref id) arg ...))
(hash-set! globals 'id (λ (arg ...) body0 body ...)))]
[(_defun (id arg ... . rest-args) body0 body ...)
(begin
(define (id arg ... . rest-args)
(apply (ref id) (list* arg ... rest-args)))
(hash-set! globals 'id (λ (arg ... . rest-args) body0 body ...)))]))
An Example:
example.rkt
#lang racket
(provide fact foo)
(define (fact n)
42)
(define (foo n)
(fact n))
Running this gives us a repl.
> (fact 5)
42
> (foo 5)
42
> (defun (fact n) (if (= n 0) n (* n (fact (- n 1)))))
> (fact 5)
120
> (foo 5)
120
> (defun (fact n) 7)
(foo 5)
7
This proof of concept just uses a global "namespace" for all functions defined with defun.
The same technique can be used if one needs "packages" in Common Lisp sense.