@juan.carreon has joined the channel
How can I find the definition of something I come across while going through http://docs.racket-lang.org\|docs.racket-lang.org? Specifically, I want to see how in-naturals
is defined
DrRacket can open the file that defines an imported binding.
@joshibharathiramana In DrRacket, write a small program.
#lang racket
(in-naturals 3)
Click “Check Syntax”. Then right click on the identifier in-naturals
and choose the menu item “Jump to defintion (in other file)”.
This will get you to the file “for.rkt”. And looking around, you will see
(provide (rename *in-naturals in-naturals))
So the name used inside “for.rkt” is *in-naturals
. Further down, you will see the actual definition.
An alternative strategy: Find the docs for in-naturals
and notice that the popup says “racket/base” when you how the in-naturals
identifier. This means that you can find the definition in the racket/racket
Github repository.
Searching for in-naturals
will leads to 113! matches - but notice that the documentation is in for.scrbl, so there is a great chance that the right code file is the for.rkt one.
Thanks for all the information!