Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Racket Source and / or Cookbook Examples

Tags:

racket

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.

like image 494
Scott Klarenbach Avatar asked Jan 22 '12 19:01

Scott Klarenbach


2 Answers

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.

like image 125
ccoakley Avatar answered Nov 12 '22 23:11

ccoakley


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

like image 43
nadeem Avatar answered Nov 13 '22 00:11

nadeem