Is Scheme faster than C?

What I had been learning in my Programming Language course, however, was that I really could manage my own control flow if I wanted. Furthermore, I could start with a simpler, more naive program and basically DERIVE the sophisticated one through a series of correctness-preserving program transformations. Rest of the…

begin in ES6

In order to write a begin lookalike in ES6, we can take advantage of the fact that in JavaScript arguments are evaluated from left to right. This leads to: const begin = (...args) => args[args.length - 1]; We can therefore replicate SICP's make-withdraw procedure as: const makeWithdraw = bal =>…

let in ES6

A possible way of expressing Scheme let expressions, such as (let ((x 3) (y 5)) (+ x y)) is to use ES6 default parameters: ((x = 3, y = 5) => x + y)() It is possible to go one step further by defining an auxiliary let_ function as: const let_ = f => f(…

Yet Another Scheme Tutorial

The goal of this tutorial is to provide enough knowledge and ability on Scheme programming language to read SICP, which is one of the best text book on computer science. The book uses Scheme to explain subjects.…

Pairs

let cons = (a, b) => (pick) => pick == 1 ? a : pick == 2 ? b : "error"; let car = (x) => x(1); let cdr = (x) => x(2); What if we could build pairs out of nothing at all?…