I would like to create a library with my own factorial, in order to call it when I need it without writing again or copying again the code.
How should I save it, and how do I have to import it where I will need it (compiler lines such import / provide)?
Save as factorial.rkt.
Add (provide factorial)
(provide factorial)
Use (require factorial)
(require factorial)
(But I notice that there’s no language specified. Are you using the Teaching languages?)
The (require factorial) would only work if it's main.rkt in a factorial collection. If it's not part of a collection, (require "factorial.rkt") works in the same directory. More at https://docs.racket-lang.org/guide/module-paths.html (Guide).
main.rkt
factorial
(require "factorial.rkt")
I would like to start putting the file providing the factorial in the same folder where the program that requires has its place.
Here is the result
Both files saved as indicated. Error persists.
(require “factorial.rkt”)