View Single Post
  #4  
Old September 8th 17, 06:09 PM posted to gnu.emacs.help,rec.bicycles.tech
David Scheidt
external usenet poster
 
Posts: 1,346
Default 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
Ads
 

Home - Home - Home - Home - Home