Scott Klarenbach
Scott Klarenbach

Reputation: 38751

Racket Source and / or Cookbook Examples

How much of Racket is written in Racket? For example, is the argmax function implemented in Racket or in C? What about take and drop? I couldn't find it in the source on github.

The reason I ask is that as a Scheme / Racket newbie it would be very useful to try and grok the source of as much elegant Racket code as I could, to get a handle on functional / recursive best practices. Of course, if everything is mostly implemented in C then this isn't the right direction for me.

Alternatively, is there a "cookbook" or "examples" page somewhere online showing how to recreate many of the built-ins in Racket, similar to "my-map" and "my-length"?

Thanks.

Upvotes: 10

Views: 3078

Answers (2)

ccoakley
ccoakley

Reputation: 3255

You can download the racket source yourself from Github. There is enough racket code there to be worthwhile, but I prefer looking at the modules for such "cookbook" examples.

PLaneT is a good resource for other people's code as well.

Upvotes: 9

nadeem
nadeem

Reputation: 721

A whole lot of the Racket libraries are written in the language itself, but it is overwhelming to try to wade through the entire source to find and study the functions you're interested in. If you work through the text How to Design Programs ( http://htdp.org and http://www.ccs.neu.edu/home/matthias/HtDP2e/index.html ), written by the authors of Racket, you will in the process learn and understand how to write the functions you have asked about (implementation of the functions take, drop, map, length, and similar are directly addressed about one-third to one-half of the way through the textbook).

Upvotes: 5

Related Questions