|
From: | David Scheidt |
Subject: | Re: program to compute gears, with table |
Date: | Fri, 8 Sep 2017 17:09:42 +0000 (UTC) |
User-agent: | tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (NetBSD/7.1 (i386)) |
In rec.bicycles.tech Emanuel Berg <moasen@zoho.com> 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
[Prev in Thread] | Current Thread | [Next in Thread] |