juan.carreon
2021-3-31 15:34:37

@juan.carreon has joined the channel


joshibharathiramana
2021-3-31 22:03:45

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


kellysmith12.21
2021-3-31 22:06:34

DrRacket can open the file that defines an imported binding.


soegaard2
2021-3-31 22:07:53

@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)”.


soegaard2
2021-3-31 22:08:20

This will get you to the file “for.rkt”. And looking around, you will see


soegaard2
2021-3-31 22:08:41

(provide (rename *in-naturals in-naturals))


soegaard2
2021-3-31 22:09:12

So the name used inside “for.rkt” is *in-naturals. Further down, you will see the actual definition.


soegaard2
2021-3-31 22:10:23

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.


soegaard2
2021-3-31 22:11:47

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.


joshibharathiramana
2021-3-31 22:14:27

Thanks for all the information!