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
(define (product term a next b) | |
(define (iter a result) | |
(if (= a b) | |
result | |
(iter (next a) (* result (term a))))) | |
(iter a 1)) | |
(define (inc x) (+ x 1)) | |
(define (identity x) x) |
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
(define (filtered-acc filter combiner null-value term a next b) | |
(define (iter a result) | |
(if (> a b) | |
result | |
(if (filter a) | |
(iter (next a) (combiner (term a) result)) | |
(iter (next a) result)))) | |
(iter a null-value)) | |
(define (prime? n) |
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
(define tolerance 0.00001) | |
(define (close-enough? v1 v2) | |
(< (abs (- v1 v2)) tolerance)) | |
(define (fixed-point f first-guess) | |
(define (try guess) | |
(let ((next (f guess))) | |
(if (close-enough? guess next) | |
next |
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
(define (cont-frac n d k) | |
(define (loop i k) | |
(if (= k i) | |
(/ (n i) (d i)) | |
(/ (n i) (+ (d i) (loop (+ i 1) k))))) | |
(loop 1 k)) | |
; 1.37 | |
(define golden-ratio 1.61803398875) |
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
#!/usr/bin/env python3 | |
from PySide6.QtWidgets import ( | |
QApplication, | |
QMessageBox, | |
QWidget, | |
QLabel, | |
QPushButton, | |
QVBoxLayout, | |
QPlainTextEdit |
OlderNewer