program to compute gears, with table
In rec.bicycles.tech Emanuel Berg wrote:
:Hey guys, does this look right to you?
As noted, you need to consider the diameter of the wheel including its tire.
The style is awful. In straight common lisp:
(defun compute-gear (chainring sprocket wheel)
(list chainring sprocket (* (/ chainring sprocket) (* 3.14 wheel))))
(defun gear (chainring sprocket w)
(let ((g))
(dolist (c chainring)
(dolist (s sprocket)
(push (compute-gear c s w) g)))
(sort g #' :key #'third)))
(defun print-gears (chainring sprocket wheel)
(format nil "~:{ ~d ~d ~f ~%~}" (gear chainring sprocket wheel)))
--
sig 46
|