Category: Programming Tasks
-
Averager as a Constraint System
Simulation of an Averager as a Constraint System This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (adder a1 a2 sum)…
-
Celsius Fahrenheit Converter as a Constraint System
Celsius Fahrenheit Converter as a Constraint System: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (adder a1 a2 sum) (define (process-new-value)…
-
Half Adder Simulation
Half adder simulation and probing of delays: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (front-ptr queue) (car queue)) (define (rear-ptr…
-
Or Gate Simulation
Or Gate as a combination of inverter and and gates. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (inverter input output)…
-
Cycle Detection by Floyd’s Tortoise and Hare Algorithm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters ;; From scheme wiki (define (contains-cycle? lst) (define (safe-cdr l) (if (pair? l)…
-
Monte Carlo Simulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define random-init 7) ;**not in book** (define rand (let ((x random-init)) (lambda ()…
-
Memoizing a Function
The code below memoizes a function. As an example, fibonacci is memoized. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (fib…
-
Church Numerals
Implementation of Church numerals, of calculus and the addition procedure. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define zero (lambda…
-
Smoothing a Signal
A procedure smooth that takes as input a procedure that computes f and returns a procedure that computes the smoothed f. Also implemented is a procedure that computes the n-fold smoothed function. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open…
-
Continued Fraction Tail Recursive
An infinite continued fraction is an expression of the form The infinite continued fraction expansion with the Ni and the Di all equal to 1 produces 1/, where is the golden ratio. One way to approximate an infinite continued fraction is to truncate the expansion after a given number of terms. Such a truncation —…