Hacker News new | ask | show | jobs
by gus_massa 548 days ago
The Racket distribution has many languages, in particular a few "Student Languages" that are simplified versions of the main language and are degigned to use with the book "How to Design Programs" [1].

They have some artificial restictions to avoid common errors of beginers, and give better hints in case of common errors. They are (almost) a subset, so you can just change the language declaration at the top and get the full power.

  #lang beginer ; <-- I'm not sure which is the magic keyword [2]
  (define (f x y) (+ x y))
  (display (f 2 3)) ;==> 5
  (display f) ;==> error: it's probably an error of a beginer

  #lang racket
  (define (f x y) (+ x y))
  (display (f 2 3)) ;==> 5
  (display f) ;==> #<procedure:f> 

[1] https://docs.racket-lang.org/drracket/htdp-langs.html

[2] There is some magic in the editor to hide the declaration in the students languages and I don't use them, so I'm not sure how to summon them in the text version.