#!/usr/bin/guile !# ;arguments: integer ;displays a list of numbers in the golden-ratio above and below the input number (import (sph) (sph math) (sph number)) (define* (golden-ratios start-number #:optional (count 10)) (let loop ( (counter count) (increasing (list (* start-number golden-ratio))) (decreasing (list (/ start-number golden-ratio)))) (if (> counter 0) (loop (- counter 1) (pair (* (first increasing) golden-ratio) increasing) (pair (/ (first decreasing) golden-ratio) decreasing)) (pair increasing (reverse decreasing))))) (define (display-number-list a) (each (l (e) (display (round-to-decimal-places e 3)) (display " ") (display-line e)) a)) (define (golden-ratios-cli arguments) (if (null? arguments) (display-line "missing 1 integer argument") (let (numbers (golden-ratios (string->number (first (tail (program-arguments)))))) (display-number-list (first numbers)) (newline) (display-number-list (tail numbers))))) (golden-ratios-cli (tail (program-arguments)))