Live data from Hacker News

Why MIT switched from Scheme to Python (2009)

wisdomandwonder.com

241–249 of 249 posts

Re: Why MIT switched from Scheme to Python (2009)

#241
post #149

Earlier quoted context omitted.

> There were four 15-unit courses, each about one of these "languages": The description you offer is strange to me. The Lisp family of languages are multi-paradigm (arguably paradigm-independent) and can hardly be called "procedural". The core material of SICP revolves around considering the "means of combination" and "means of abstraction" offered by a programming language — concepts that sound to me like they have…

SICP is fundamentally about the notion that programs are primarily a means of communication between people, being written by people for other people to read, and only secondarily a thing for computers to execute. And it really opened my eyes to the landscape of programming paradigms that exist—indeed, it continues to do so! But your comment is completely off-base. In Circuits and Electronics, as I understand it, the…

> SICP is fundamentally about the notion that programs are primarily a means of communication between people, being written by people for other people to read, and only secondarily a thing for computers to execute.

Kragen, I think you hit the nail on the head with this.

From the 1e Preface:

"Our design of this introductory computer-science subject reflects two major concerns. First, we want to establish the idea that a computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute."

And also,

"Second, we believe that the essential material to be addressed by a subject at this level is not the syntax of particular programming-language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, but rather the techniques used to control the intellectual complexity of large software systems."

6.001 germinated in 1978! There were far fewer languages to choose from then.[0] As elegant, and expressive, and powerful as Scheme is (being an attempt to strip a language down to the essentials), perhaps there just are more legible languages these days. A good exercise would be to go to Rosetta Code[1], pick a program, and compare the aesthetics of the code. What solutions are the cleanest and easiest to understand?

[0]: https://en.wikipedia.org/wiki/Timeline_of_programming_langua...

[1]: https://rosettacode.org/wiki/FizzBuzz#

Re: Why MIT switched from Scheme to Python (2009)

#242
post #149

Earlier quoted context omitted.

SICP is fundamentally about the notion that programs are primarily a means of communication between people, being written by people for other people to read, and only secondarily a thing for computers to execute. And it really opened my eyes to the landscape of programming paradigms that exist—indeed, it continues to do so! But your comment is completely off-base. In Circuits and Electronics, as I understand it, the…

> SICP is fundamentally about the notion that programs are primarily a means of communication between people, being written by people for other people to read, and only secondarily a thing for computers to execute. Kragen, I think you hit the nail on the head with this. From the 1e Preface: "Our design of this introductory computer-science subject reflects two major concerns. First, we want to establish the idea that…

Some notable examples:

(pulled from https://rosettacode.org/)

  --------------------------------
  [[ Scheme ]]
  
  (do ((i 1 (+ i 1)))
      ((> i 100))
      (display
        (cond ((= 0 (modulo i 15)) "FizzBuzz")
              ((= 0 (modulo i 3))  "Fizz")
              ((= 0 (modulo i 5))  "Buzz")
              (else                 i)))
      (newline))
  
  --------------------------------
  [[ Python ]]
  
  for i in range(1, 101):
      if i % 15 == 0:
          print("FizzBuzz")
      elif i % 3 == 0:
          print("Fizz")
      elif i % 5 == 0:
          print("Buzz")
      else:
          print(i)
  
  --------------------------------
  [[ Logo ]]
  
  to fizzbuzz :n
    output cond [ [[equal? 0 modulo :n 15] "FizzBuzz]
                  [[equal? 0 modulo :n  5] "Buzz]
                  [[equal? 0 modulo :n  3] "Fizz]
                  [else :n] ]
  end
  
  repeat 100 [print fizzbuzz #]
  
  --------------------------------
  [[ Racket ]]
  
  (for ([n (in-range 1 101)]) 
    (displayln 
      (match (gcd n 15) 
        [15 "fizzbuzz"] 
        [ 3 "fizz"] 
        [ 5 "buzz"] 
        [ _  n])))
  
  --------------------------------
  [[ Arc ]]
  
  (for n 1 100 
       (prn:check (string (when (multiple n 3) 'Fizz) 
                          (when (multiple n 5) 'Buzz)) 
                  ~empty n)) ; check created string not empty, else return n

  --------------------------------
  [[ Rust ]]
  
  fn main() {
      for i in 1..=100 {
          match (i % 3, i % 5) {
              (0, 0) => println!("fizzbuzz"),
              (0, _) => println!("fizz"),
              (_, 0) => println!("buzz"),
              (_, _) => println!("{}", i),
          }
      }
  }
  
  --------------------------------
  [[ Julia ]]
  
  for i in 1:100
      if i % 15 == 0
          println("FizzBuzz")
      elseif i % 3 == 0
          println("Fizz")
      elseif i % 5 == 0
          println("Buzz")
      else
          println(i)
      end
  end
  
  --------------------------------
  [[ Hy ]]
  
  (for [i (range 1 101)] (print (cond
    [(not (% i 15)) "FizzBuzz"]
    [(not (% i  5)) "Buzz"]
    [(not (% i  3)) "Fizz"]
    [True            i])))

  --------------------------------
  [[ Crystal ]]
  
  1.upto(100) do |v|
    p fizz_buzz(v)
  end

  def fizz_buzz(value)
    word = ""
    word += "fizz" if value % 3 == 0
    word += "buzz" if value % 5 == 0
    word += value.to_s if word.empty?
    word
  end
  
  --------------------------------
  [[ Perl ]]
  
  for my $i (1..100) {
      say $i % 15 == 0 ? "FizzBuzz"
        : $i %  3 == 0 ? "Fizz"
        : $i %  5 == 0 ? "Buzz"
        : $i;
  }
  
  --------------------------------
  [[ Ruby ]]
  
  1.upto(100) do |n|
    print "Fizz" if a = (n % 3).zero?
    print "Buzz" if b = (n % 5).zero?
    print n unless (a || b)
    puts
  end
  
  --------------------------------
  [[ Prolog ]]
  
  fizzbuzz(X) :- X mod 15 =:= 0, !, write('FizzBuzz').
  fizzbuzz(X) :- X mod  3 =:= 0, !, write('Fizz').
  fizzbuzz(X) :- X mod  5 =:= 0, !, write('Buzz').
  fizzbuzz(X) :- write(X).

  dofizzbuzz :-between(1, 100, X), fizzbuzz(X), nl, fail.
  dofizzbuzz.
  
  --------------------------------
  [[ Haskell ]]
  
  fizzbuzz :: Int -> String
  fizzbuzz x
    | f 15 = "FizzBuzz"
    | f  3 = "Fizz"
    | f  5 = "Buzz"
    | otherwise = show x
    where
      f = (0 ==) . rem x
  
  main :: IO ()
  main = mapM_ (putStrLn . fizzbuzz) [1 .. 100]
    
  --------------------------------
  [[ OCaml ]]
  
  let fizzbuzz i =
    match i mod 3, i mod 5 with
      0, 0 -> "FizzBuzz"
    | 0, _ -> "Fizz"
    | _, 0 -> "Buzz"
    | _    -> string_of_int i
   
  let _ =
    for i = 1 to 100 do print_endline (fizzbuzz i) done
    
  --------------------------------
  [[ Nix ]]
  
  let
    fizzbuzz = { x ? 1 }:
      ''
        ${if (mod x 15 == 0) then
          "FizzBuzz"
        else if (mod x 3 == 0) then
          "Fizz"
        else if (mod x 5 == 0) then
          "Buzz"
        else
          (toString x)}
      '' + (if (x  Enum.map(fn i ->
    cond do
      rem(i,3\*5) == 0 -> "FizzBuzz"
      rem(i,3) == 0    -> "Fizz"
      rem(i,5) == 0    -> "Buzz"
      true             ->  i
    end
  end) |> Enum.each(fn i -> IO.puts i end)
  
  --------------------------------
  [[ J ]]
  
  (":[^:(0=#@])Fizz`Buzz;@#~0=3 5&|)"0>:i.100
  
  --------------------------------
  [[ Forth ]]
  
  : .fizzbuzz ( n -- )
    0 pad c!
    dup 3 mod 0= if s" Fizz" pad  place then
    dup 5 mod 0= if s" Buzz" pad +place then
    pad c@ if drop pad count type else . then ;
  
  : zz ( n -- )
    1+ 1 do i .fizzbuzz cr loop ;
  100 zz
  
  --------------------------------
  [[ Go ]]
  
  func main() {
      for i := 1; i 
      println((n % 3, n % 5) match {
        case (0, 0) => "FizzBuzz"
        case (0, _) => "Fizz"
        case (_, 0) => "Buzz"
        case  _     =>  n
      })
    }
  }

Re: Why MIT switched from Scheme to Python (2009)

#244
post #51

Related. Others? Ask HN: How has MIT's switch from Scheme to Python worked out? - https://news.ycombinator.com/item?id=24960481 - Nov 2020 (1 comment) Why MIT uses Python instead of Scheme for its undergraduate CS program (2009) - https://news.ycombinator.com/item?id=18782101 - Dec 2018 (136 comments) Why MIT Switched from Scheme to Python (2009) - https://news.ycombinator.com/item?id=14167453 - April 2017 (97 commen…

[deleted]

Re: Why MIT switched from Scheme to Python (2009)

#245

Earlier quoted context omitted.

Thank goodness! Can you imagine a world where just anybody could leap tall buildings? https://www.paulgraham.com/rootsoflisp.html https://www.paulgraham.com/diff.html https://www.paulgraham.com/icad.html

You have to trust revealed preferences, not stated preferences.

> You have to trust revealed preferences, not stated preferences.

Ah, the Pepsi Challenge! How apropos. Programming language popularity is mostly driven by marketing, after all.

It's a shame that a generation of programmers raised on high fructose corn syrup and aspartame will never know the refreshment of a homemade organic craft soda[S].

After all, if Racket[R] is the language for crafting languages[L], surely it's the SodaStream of soft drinks.

[R]: https://en.wikipedia.org/wiki/Racket_(programming_language)

[L]: https://cacm.acm.org/practice/creating-languages-in-racket/

[S]: https://www.moodymixologist.com/blog/the-ultimate-guide-to-c...

Re: Why MIT switched from Scheme to Python (2009)

#246

Earlier quoted context omitted.

You're absolutely right that "procedural", at least as I understand the word in 2025, is a poor label for 6.001. 6.001 taught 'define' and 'let' but didn't teach 'set!' until week 6 or so. So we learned functions, variables, scopes, recursion, lambdas, strings, numbers, symbols, lists, map, filter, flatten, and more - all without ever modifying a variable. That's very "functional". Once we learned that it was possibl…

Btw, I've just read the first section of Chapter 5 [Computing with Register Machines] for the first time, and think it's the best introduction to assembly that I've seen (and I've seen a few). Calling it 'fake' is dismissive. Also, it isn't written in Scheme, but merely described in the native data format: lists of symbols. The next section builds a virtual machine that is written in Scheme to run the code. One of th…

"Programming Should Eat Itself" by Nada Amin https://www.youtube.com/watch?v=SrKj4hYic5A

The future of AI code generation?

https://neurosymbolic.metareflection.club/

Re: Why MIT switched from Scheme to Python (2009)

#247

Earlier quoted context omitted.

I don't remember who said it, but the Metacircular Evaluator is the real superpower in Lisp/Scheme — even beyond writing macros. It allows you to modify the language itself in ways that are unthinkable in other languages. Whether that is a good thing depends on you.

I would say that it's lesser than macros because macros let you write a "metacircular compiler". You can maintain performance across multiple nestings of compiled languages. Where as if we write a metacirular interpreter in a compiled Lisp, we now have something lesser than the host language: an interpreted dialect. And then, if we write another meticircular interpreter in that dialect, we have something even slower:…

Fascinating!

I've seen references to Dan Friedman's work on this in the '80s. It looks very powerful, but he's said it made his head hurt. I bet there will be fruitful research layering interpreters like this with AI code generation.

Also, Nada Amin and Tiark Rompf had something to say about this:

https://dl.acm.org/doi/10.1145/3158140

"12 CONCLUSIONS

We have shown how to collapse towers of interpreters using a stage-polymorphic multi-level λ-calculus λ↑↓. We have also shown that we can re-create a similar effect using LMS and polytypic programming via type classes. We have discussed several examples including novel reflective programs in Purple / Black. Looking beyond this paper, we believe that collapsing towers, in particular eterogeneous towers, has practical value. Here are some examples:

(1) It is often desirable to run other languages on closed platforms, e.g., in a web browser. For this purpose, Emscripten [Zakai 2011] translates LLVM code to JavaScript. Similarly, Java VMs [Vilk and Berger 2014] and even entire x86 processor emulators [Hemmer 2017] that are able to boot Linux [Bellard 2017] have been written in JavaScript. It would be great if we could run all such artifacts at full speed, e.g., a Python application executed by an x86 runtime, emulated in a JavaScript VM. Naturally, this requires not only collapsing of static calls, but also adapting to a dynamically changing environment."

(2) It can be desirable to execute code under modified semantics. Key use cases here are: (a) instrumentation/tracing for debugging, potentially with time-travel and replay facilities, (b) sand-boxing for security, (c) virtualization of lower-level resources as in environments like Docker, and (d) transactional execution with atomicity, isolation, and potential rollback.

(3) Non-standard interpretations, e.g., program analysis, verification, synthesis. We would like to reuse those artifacts if they are implemented for the base language. For example, a Racket interpreter in miniKanren [Byrd et al. 2017] has been shown to enable logic programming for a large class of Racket programs without translating them to a relational representation. Other examples are the Abstracting Abstract Machines (AAM) framework [Horn and Might 2011], which has recently been extended to abstract definitional interpreters [Darais et al . 2017]. For these indirect approaches to be effective, it is important to remove intermediate interpretive abstractions which would otherwise confuse the analysis.

For these use cases, our approach hints at a solution where we only need to manually lift the meta interpreter of the user level while the rest of the tower acts in a kind of pass-through mode, handing down staging commands to the lowest level, which needs to support stage polymorphism. Last but not least, it is important to note that the present work is based on interpreters derived from variations of the λ-calculus, and thus leaves a gap towards collapsing heterogeneous towers of truly independent languages. This gap is especially prominent in a setting where a language level does not follow the usual functional or imperative paradigm, e.g., if a logic programming language or a probabilistic programming language is part of the tower. Thus, we hope that our work spurs further activity in implementing stage polymorphic virtual machines and collapsing towers of interpreters in the wild."

https://www.codemesh.io/codemesh2017/nada-amin

Nada Amin - Collapsing Towers of Interpreters - Code Mesh 2017

https://www.youtube.com/watch?v=Ywy_eSzCLi8

Tiark Rompf - [POPL'18] Collapsing Towers of Interpreters

https://www.youtube.com/watch?v=QLyBxXqml5Y

Re: Why MIT switched from Scheme to Python (2009)

#248
post #154

This story has been reposted many times, and I think GJS's remarks (as recorded by Andy Wingo) are super-interesting as always, but this is really not a great account of "why MIT switched from Scheme to Python." Source: I worked with GJS (I also know Alexey and have met Andy Wingo), and I took 6.001, my current research still has us referring to SICP on a regular basis, and in 2006 Kaijen Hsiao and I were the TAs for…

A useful reminder that economics plays as much, if not more import in what is taught and how it is taught, as any pedagogical drive. If attendance drops, universities can pivot. Gotta get the bums on seats. 20 years ago Cisco came shopping in Australia for ee grads who could do microcode. The US degree mills had stopped teaching students how to code an edge case for most jobs, and the router and switch vendor had to…

It's interesting that you would name Cisco. They hired Kent Dybvig and acquired Cadence Research Center in 2011 for Chez Scheme[0] — possibly for use in processing IOS configs, testing, and network management. It seems like Chez was the most performant scheme in the day[1] and was proprietary, expensive, and possibly not available to individuals.[2]

There were a number of good free schemes[3], and Chez was open-sourced in 2016, but I wonder how much of Perl, Ruby, and Python's popularity derived from their open licenses.

[0]: https://web.archive.org/web/20241107091603/http://community....

[1]: https://web.archive.org/web/20180917033028/https://ecraven.g...

[2]: http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/scheme/part2/...

[3]: http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/scheme/part2/...

Re: Why MIT switched from Scheme to Python (2009)

#249
post #154

Earlier quoted context omitted.

A useful reminder that economics plays as much, if not more import in what is taught and how it is taught, as any pedagogical drive. If attendance drops, universities can pivot. Gotta get the bums on seats. 20 years ago Cisco came shopping in Australia for ee grads who could do microcode. The US degree mills had stopped teaching students how to code an edge case for most jobs, and the router and switch vendor had to…

It's interesting that you would name Cisco. They hired Kent Dybvig and acquired Cadence Research Center in 2011 for Chez Scheme[0] — possibly for use in processing IOS configs, testing, and network management. It seems like Chez was the most performant scheme in the day[1] and was proprietary, expensive, and possibly not available to individuals.[2] There were a number of good free schemes[3], and Chez was open-sourc…

The Development of Chez Scheme R. Kent Dybvig

https://web.archive.org/web/20061205234158/https://www.cs.in...

The Scheme Programming Language 4e

https://www.scheme.com/tspl4/

Post reply on HN