This page provides links to essays on a variety of topics. Essays are not exercises, they don’t present a task to challenge you, but instead provide extended discussion and complete source code. Though essays are often based on exercises, they are larger, providing more space to delve more deeply into the topic at hand. New essays are added from time to time, so be sure to check back often.
Programming with Prime Numbers: Prime numbers are those integers greater than one that are divisible only by themselves and one; an integer greater than one that is not prime is composite. In this essay we examine three problems related to prime numbers: enumerating the prime numbers, determining if a given number is prime or composite, and factoring a composite number into its prime factors. Source code: C, Haskell, Java, Python, Scheme. Comments HERE.
Text File Databases: Much of the work done by computers involved reading in a file and either transforming it to some output format, perhaps changing it along the way, or summarizing it in some fashion. This essay presents a library of readers, writers, combinators and processors that provide a useful approach to such tasks. The library is written in Scheme, and relies on passing functions as parameters to other functions, so it is easily portable to other “functional” languages but difficult or impossible to port to strictly “imperative” languages. Source code: LIBRARY, TESTING. Comments HERE.
SRFI-41 Streams: Streams, sometimes called lazy lists, are a sequential data structure containing elements computed only on demand. A stream is either null or is a pair with a stream in its cdr. Since elements of a stream are computed only when accessed, streams can be infinite. Once computed, the value of a stream element is cached in case it is needed again. R5RS source code HERE. R6RS source code: streams.ss, primitive.ss, derived.ss. Testing code: R5RS, R6RS. Samples from the text HERE. Original SRFI-41 Streams web page HERE with HTML version of text HERE. Local discussion HERE.