unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* program to compute gears, with table
@ 2017-09-08  5:33 Emanuel Berg
  2017-09-08  8:46 ` Graham
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08  5:33 UTC (permalink / raw)
  To: help-gnu-emacs

Hey guys, does this look right to you?

;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
;;
;;                          =>
;;
;; 622 wheel
;;
;; chainring   sprocket   gear
;;
;;    34          25      2657.5360544880004
;;    34          23      2888.626146182609
;;    34          21      3163.7333982000005
;;    34          19      3496.7579664315795
;;    50          25      3908.1412566000004
;;    34          17      3908.1412566000004
;;    50          23      4247.97962673913
;;    34          15      4429.226757480001
;;    50          21      4652.549115000001
;;    34          13      5110.64625863077
;;    50          19      5142.291127105264
;;    34          12      5536.5334468500005
;;    50          17      5747.266553823531
;;    50          15      6513.568761
;;    50          13      7515.656262692309
;;    50          12      8141.960951250001

(require 'cl-lib)

(defun compute-gear (chainring sprocket wheel)
  (let*((pi     3.14159265)
        (radius (/ wheel 2.0))
        (circum (* 2 radius pi))
        (gear   (* (/ chainring sprocket 1.0) circum)))
    (list chainring sprocket gear)))

(defun gear (chainrings sprockets wheel)
  (let*((gears
         (cl-loop for c in chainrings
                  append (cl-loop for s in sprockets
                                  collect (compute-gear c s wheel) )
                  )))
        (cl-sort gears #'<= :key #'cl-caddr)))

(defun print-gears (chainrings sprockets wheel)
  (let ((out-buffer (get-buffer-create "*Gears*")))
    (with-current-buffer out-buffer
      (erase-buffer)
      (insert (format "%s wheel\n\n" wheel))
      (insert "chainring   sprocket   gear\n\n")
      (let ((gears (gear chainrings sprockets wheel)))
        (cl-loop for g in gears
                 do (let ((c (   car   g))
                          (s (   cadr  g))
                          (d (cl-caddr g)))
                      (insert (format "   %s          %s      %s\n" c s d)) ))))
    (pop-to-buffer out-buffer) ))

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08  5:33 program to compute gears, with table Emanuel Berg
@ 2017-09-08  8:46 ` Graham
  2017-09-08 15:50   ` Frank Krygowski
  2017-09-08 17:44   ` Emanuel Berg
  2017-09-08 11:09 ` Skip Montanaro
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 29+ messages in thread
From: Graham @ 2017-09-08  8:46 UTC (permalink / raw)
  To: help-gnu-emacs


"Emanuel Berg" <moasen@zoho.com> wrote in message news:86bmmlu54a.fsf@zoho.com...
> Hey guys, does this look right to you?
>
> ;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
> ;;
> ;;                          =>
> ;;
> ;; 622 wheel
> ;;
> ;; chainring   sprocket   gear
> ;;
> ;;    34          25      2657.5360544880004
> ;;    34          23      2888.626146182609
> ;;    34          21      3163.7333982000005
> ;;    34          19      3496.7579664315795
> ;;    50          25      3908.1412566000004
> ;;    34          17      3908.1412566000004
> ;;    50          23      4247.97962673913
> ;;    34          15      4429.226757480001
> ;;    50          21      4652.549115000001
> ;;    34          13      5110.64625863077
> ;;    50          19      5142.291127105264
> ;;    34          12      5536.5334468500005
> ;;    50          17      5747.266553823531
> ;;    50          15      6513.568761
> ;;    50          13      7515.656262692309
> ;;    50          12      8141.960951250001
>
> (require 'cl-lib)
>
> (defun compute-gear (chainring sprocket wheel)
>  (let*((pi     3.14159265)
>        (radius (/ wheel 2.0))
>        (circum (* 2 radius pi))
>        (gear   (* (/ chainring sprocket 1.0) circum)))
>    (list chainring sprocket gear)))
>
> (defun gear (chainrings sprockets wheel)
>  (let*((gears
>         (cl-loop for c in chainrings
>                  append (cl-loop for s in sprockets
>                                  collect (compute-gear c s wheel) )
>                  )))
>        (cl-sort gears #'<= :key #'cl-caddr)))
>
> (defun print-gears (chainrings sprockets wheel)
>  (let ((out-buffer (get-buffer-create "*Gears*")))
>    (with-current-buffer out-buffer
>      (erase-buffer)
>      (insert (format "%s wheel\n\n" wheel))
>      (insert "chainring   sprocket   gear\n\n")
>      (let ((gears (gear chainrings sprockets wheel)))
>        (cl-loop for g in gears
>                 do (let ((c (   car   g))
>                          (s (   cadr  g))
>                          (d (cl-caddr g)))
>                      (insert (format "   %s          %s      %s\n" c s d)) ))))
>    (pop-to-buffer out-buffer) ))
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573

Not sure about your code as I do not speak that language but a quick check gives:

622*3.142*50/25=3908.648mm

So if your definition of gear is roll out in mm then it looks close. Do not forget to include the tyre. See:

https://www.cateye.com/data/resources/Tire_size_chart_ENG.pdf

for approximate circumferences. Taking a 23mm tyre the above example would be:
2096*50/25=4192mm

Graham.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08  5:33 program to compute gears, with table Emanuel Berg
  2017-09-08  8:46 ` Graham
@ 2017-09-08 11:09 ` Skip Montanaro
  2017-09-08 11:27   ` tomas
  2017-09-08 17:09 ` David Scheidt
       [not found] ` <mailman.158.1504868984.14750.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 29+ messages in thread
From: Skip Montanaro @ 2017-09-08 11:09 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: Help GNU Emacs

Something's fishy. Is the result mm of forward travel per crank revolution?
I'm used to seeing gear inches. Your 50x12 should be about 110 gear inches.
If your output is in millimeters, I get about 320 gear inches, so either
I've mistaken your intended units, or there's a mistake in there somewhere.

A couple nits which won't change anything:

* Why the 1.0 divisor when computing gear?

* You can skip the radius and use wheel (diameter) directly in computing
the circumference.

* It never occurred to me to do this in Lisp. I always just use an online
calculator, like:

http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH

Skip

P.S. My latest acquisition (and oldest bike):
https://www.flickr.com/photos/49705339@N00/albums/72157686279443084


On Fri, Sep 8, 2017 at 12:33 AM, Emanuel Berg <moasen@zoho.com> wrote:

> Hey guys, does this look right to you?
>
> ;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
> ;;
> ;;                          =>
> ;;
> ;; 622 wheel
> ;;
> ;; chainring   sprocket   gear
> ;;
> ;;    34          25      2657.5360544880004
> ;;    34          23      2888.626146182609
> ;;    34          21      3163.7333982000005
> ;;    34          19      3496.7579664315795
> ;;    50          25      3908.1412566000004
> ;;    34          17      3908.1412566000004
> ;;    50          23      4247.97962673913
> ;;    34          15      4429.226757480001
> ;;    50          21      4652.549115000001
> ;;    34          13      5110.64625863077
> ;;    50          19      5142.291127105264
> ;;    34          12      5536.5334468500005
> ;;    50          17      5747.266553823531
> ;;    50          15      6513.568761
> ;;    50          13      7515.656262692309
> ;;    50          12      8141.960951250001
>
> (require 'cl-lib)
>
> (defun compute-gear (chainring sprocket wheel)
>   (let*((pi     3.14159265)
>         (radius (/ wheel 2.0))
>         (circum (* 2 radius pi))
>         (gear   (* (/ chainring sprocket 1.0) circum)))
>     (list chainring sprocket gear)))
>
> (defun gear (chainrings sprockets wheel)
>   (let*((gears
>          (cl-loop for c in chainrings
>                   append (cl-loop for s in sprockets
>                                   collect (compute-gear c s wheel) )
>                   )))
>         (cl-sort gears #'<= :key #'cl-caddr)))
>
> (defun print-gears (chainrings sprockets wheel)
>   (let ((out-buffer (get-buffer-create "*Gears*")))
>     (with-current-buffer out-buffer
>       (erase-buffer)
>       (insert (format "%s wheel\n\n" wheel))
>       (insert "chainring   sprocket   gear\n\n")
>       (let ((gears (gear chainrings sprockets wheel)))
>         (cl-loop for g in gears
>                  do (let ((c (   car   g))
>                           (s (   cadr  g))
>                           (d (cl-caddr g)))
>                       (insert (format "   %s          %s      %s\n" c s
> d)) ))))
>     (pop-to-buffer out-buffer) ))
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
>


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 11:09 ` Skip Montanaro
@ 2017-09-08 11:27   ` tomas
  2017-09-08 12:12     ` Skip Montanaro
  0 siblings, 1 reply; 29+ messages in thread
From: tomas @ 2017-09-08 11:27 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Sep 08, 2017 at 06:09:30AM -0500, Skip Montanaro wrote:

[...]

> * Why the 1.0 divisor when computing gear?

because...

  (/ 2 3)     => 0
  (/ 2 3 1.0) => 0.6666666666666666

(division defaults to integer division when all args are int)

As to the rest... I'll defer to Emmanuel :-)

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEUEARECAAYFAlmyfrYACgkQBcgs9XrR2kZ7VwCfb/Q8fxCgdzAZoTDvv0x1oYOf
gHYAl2aPVP/v2vsz9f/DovXuOfWvYCg=
=UcUu
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 11:27   ` tomas
@ 2017-09-08 12:12     ` Skip Montanaro
  0 siblings, 0 replies; 29+ messages in thread
From: Skip Montanaro @ 2017-09-08 12:12 UTC (permalink / raw)
  Cc: Help GNU Emacs

> because...
>
>   (/ 2 3)     => 0
>   (/ 2 3 1.0) => 0.6666666666666666
>
> (division defaults to integer division when all args are int)

Ah, right. Been awhile since I did anything with ELisp (or any other
Lisp). I've gotten used to Python's // operator when I need integer
division.

S



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08  8:46 ` Graham
@ 2017-09-08 15:50   ` Frank Krygowski
  2017-09-08 21:56     ` Emanuel Berg
  2017-09-08 17:44   ` Emanuel Berg
  1 sibling, 1 reply; 29+ messages in thread
From: Frank Krygowski @ 2017-09-08 15:50 UTC (permalink / raw)
  To: help-gnu-emacs

On 9/8/2017 4:46 AM, Graham wrote:
> 
> "Emanuel Berg" <moasen@zoho.com> wrote in message news:86bmmlu54a.fsf@zoho.com...
>> Hey guys, does this look right to you?
>>
>> ;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
>> ;;
>> ;;                          =>
>> ;;
>> ;; 622 wheel
>> ;;
>> ;; chainring   sprocket   gear
>> ;;
>> ;;    34          25      2657.5360544880004
>> ;;    34          23      2888.626146182609
>> ;;    34          21      3163.7333982000005
>> ;;    34          19      3496.7579664315795
>> ;;    50          25      3908.1412566000004
>> ;;    34          17      3908.1412566000004
>> ;;    50          23      4247.97962673913
>> ;;    34          15      4429.226757480001
>> ;;    50          21      4652.549115000001
>> ;;    34          13      5110.64625863077
>> ;;    50          19      5142.291127105264
>> ;;    34          12      5536.5334468500005
>> ;;    50          17      5747.266553823531
>> ;;    50          15      6513.568761
>> ;;    50          13      7515.656262692309
>> ;;    50          12      8141.960951250001
>>
>> (require 'cl-lib)
>>
>> (defun compute-gear (chainring sprocket wheel)
>>   (let*((pi     3.14159265)
>>         (radius (/ wheel 2.0))
>>         (circum (* 2 radius pi))
>>         (gear   (* (/ chainring sprocket 1.0) circum)))
>>     (list chainring sprocket gear)))
>>
>> (defun gear (chainrings sprockets wheel)
>>   (let*((gears
>>          (cl-loop for c in chainrings
>>                   append (cl-loop for s in sprockets
>>                                   collect (compute-gear c s wheel) )
>>                   )))
>>         (cl-sort gears #'<= :key #'cl-caddr)))
>>
>> (defun print-gears (chainrings sprockets wheel)
>>   (let ((out-buffer (get-buffer-create "*Gears*")))
>>     (with-current-buffer out-buffer
>>       (erase-buffer)
>>       (insert (format "%s wheel\n\n" wheel))
>>       (insert "chainring   sprocket   gear\n\n")
>>       (let ((gears (gear chainrings sprockets wheel)))
>>         (cl-loop for g in gears
>>                  do (let ((c (   car   g))
>>                           (s (   cadr  g))
>>                           (d (cl-caddr g)))
>>                       (insert (format "   %s          %s      %s\n" c s d)) ))))
>>     (pop-to-buffer out-buffer) ))
>>
>> -- 
>> underground experts united
>> http://user.it.uu.se/~embe8573
> 
> Not sure about your code as I do not speak that language but a quick check gives:
> 
> 622*3.142*50/25=3908.648mm
> 
> So if your definition of gear is roll out in mm then it looks close. Do not forget to include the tyre. See:
> 
> https://www.cateye.com/data/resources/Tire_size_chart_ENG.pdf
> 
> for approximate circumferences. Taking a 23mm tyre the above example would be:
> 2096*50/25=4192mm
> 
> Graham.

Right, don't forget to include the tire.  622 is bead seat diameter, but 
you want (effective) outside diameter instead.

I first did such a thing in the 1970s, using Fortran. But I formatted it 
as a compact table in rows and columns.  You could have one row for each 
chainring, one column for each rear cog. A matrix, 2x8.

Another useful trick is to plot the gear development on a logarithmic 
scale, so the change from one gear to the next is scaled as the 
percentage change. Plotting using a separate row or a separate symbol 
for each chainring makes clear which gear is "next" in your gear 
progression.

These days, it's probably easiest to do all the above using a 
spreadsheet, such as LibreOffice Calc. Or Micros**t Excel.

BTW, back when there were only five rear cogs and a person wanted a wide 
range with uniform or other logical spacing, plotting gear development 
(or "gear inches," in "inch" countries) was a useful tool for the art of 
bike design. These days, with up to 11 cogs in back, the entire exercise 
isn't as valuable as it once was.

-- 
- Frank Krygowski


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08  5:33 program to compute gears, with table Emanuel Berg
  2017-09-08  8:46 ` Graham
  2017-09-08 11:09 ` Skip Montanaro
@ 2017-09-08 17:09 ` David Scheidt
  2017-09-08 23:45   ` Emanuel Berg
       [not found] ` <mailman.158.1504868984.14750.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 29+ messages in thread
From: David Scheidt @ 2017-09-08 17:09 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08  8:46 ` Graham
  2017-09-08 15:50   ` Frank Krygowski
@ 2017-09-08 17:44   ` Emanuel Berg
  1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

Graham wrote:

> So if your definition of gear is roll out in
> mm then it looks close. Do not forget to
> include the tyre.

Right, perhaps I should change "gear" into
"roll out" if that's the agreed-upon term.
Perhaps I should even make it print the
formulae first thing.

And I'll include the tyre. Excellent :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
       [not found] ` <mailman.158.1504868984.14750.help-gnu-emacs@gnu.org>
@ 2017-09-08 17:52   ` Emanuel Berg
  2017-09-08 19:56     ` Joerg
  0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 17:52 UTC (permalink / raw)
  To: help-gnu-emacs

Skip Montanaro wrote:

> * Why the 1.0 divisor when computing gear?

As explained, otherwise it'll be integer
division. But I think that qualifies as a hack
(not an ugly hack tho) so there is no shame in
spotting it an "error" :)

> * You can skip the radius and use wheel
> (diameter) directly in computing
> the circumference.

Right!

> * It never occurred to me to do this in Lisp.
> I always just use an online calculator, like:
>
> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH

Let's agree there is no need to do it in Lisp.
Only a desire :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 17:52   ` Emanuel Berg
@ 2017-09-08 19:56     ` Joerg
  2017-09-08 19:59       ` David Scheidt
                         ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Joerg @ 2017-09-08 19:56 UTC (permalink / raw)
  To: help-gnu-emacs

On 2017-09-08 10:52, Emanuel Berg wrote:
> Skip Montanaro wrote:
>
>> * Why the 1.0 divisor when computing gear?
>
> As explained, otherwise it'll be integer
> division. But I think that qualifies as a hack
> (not an ugly hack tho) so there is no shame in
> spotting it an "error" :)
>
>> * You can skip the radius and use wheel
>> (diameter) directly in computing
>> the circumference.
>
> Right!
>
>> * It never occurred to me to do this in Lisp.
>> I always just use an online calculator, like:
>>
>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
>
> Let's agree there is no need to do it in Lisp.
> Only a desire :)
>

Why make things complicated? I do such stuff with spreadsheets. That's 
what they were invented for. Part of every office software including 
free ones.

-- 
Regards, Joerg

http://www.analogconsultants.com/


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:56     ` Joerg
@ 2017-09-08 19:59       ` David Scheidt
  2017-09-08 23:55         ` Emanuel Berg
                           ` (2 more replies)
  2017-09-08 23:51       ` Emanuel Berg
                         ` (2 subsequent siblings)
  3 siblings, 3 replies; 29+ messages in thread
From: David Scheidt @ 2017-09-08 19:59 UTC (permalink / raw)
  To: help-gnu-emacs

In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
:On 2017-09-08 10:52, Emanuel Berg wrote:
:> Skip Montanaro wrote:
:>
:>> * Why the 1.0 divisor when computing gear?
:>
:> As explained, otherwise it'll be integer
:> division. But I think that qualifies as a hack
:> (not an ugly hack tho) so there is no shame in
:> spotting it an "error" :)
:>
:>> * You can skip the radius and use wheel
:>> (diameter) directly in computing
:>> the circumference.
:>
:> Right!
:>
:>> * It never occurred to me to do this in Lisp.
:>> I always just use an online calculator, like:
:>>
:>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
:>
:> Let's agree there is no need to do it in Lisp.
:> Only a desire :)
:>

:Why make things complicated? I do such stuff with spreadsheets. That's 
:what they were invented for. Part of every office software including 
:free ones.

I rewrote his code in common lisp in less time than it takes excel to
start.  


-- 
sig 106


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 15:50   ` Frank Krygowski
@ 2017-09-08 21:56     ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 21:56 UTC (permalink / raw)
  To: help-gnu-emacs

Frank Krygowski wrote:

> I first did such a thing in the 1970s, using
> Fortran.

Cool! Fortran (Formula Translation, 1957)
sounds like the perfect idea. Perhaps the
formating (output report) should be left to
COBOL tho :) (Common business-oriented
language, 1959).

Today I think the hipsters at the universities
would use Haskell (1990).

> But I formatted it as a compact table in rows
> and columns. You could have one row for each
> chainring, one column for each rear cog.
> A matrix, 2x8.

The idea with having it 8x3 was that the third
column would be the "roll out" and that would
be sorted vertically.

But perhaps I'll add a feature to flip
it later.

> Another useful trick is to plot the gear
> development on a logarithmic scale, so the
> change from one gear to the next is scaled as
> the percentage change. Plotting using
> a separate row or a separate symbol for each
> chainring makes clear which gear is "next" in
> your gear progression.

Yes, I thought about doing that. Perhaps with
ASCII art or using gnuplot which I did some
cool plots with. Here is one:

    http://user.it.uu.se/~embe8573/figures/gnuplot/science-inverted.png

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 17:09 ` David Scheidt
@ 2017-09-08 23:45   ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 23:45 UTC (permalink / raw)
  To: help-gnu-emacs

David Scheidt wrote:

> The style is awful. In straight
> common lisp [...]

Ha! I've heard about the bicycle style police
but I always thought that refered to shaved
legs and keeping the helmet straps to the
inside of the sunglasses scalps! Or wait...
should it be the other way around?

Well, styles make fights, and "pushing" is
never part of my game plan. But it does look
neater with `dolist' and `push' and it might be
more efficient as well as I don't know the
intricacies of append and collect. Not that it
will ever matter in this case, of course.

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:56     ` Joerg
  2017-09-08 19:59       ` David Scheidt
@ 2017-09-08 23:51       ` Emanuel Berg
  2017-09-09 21:08       ` Tomas Nordin
  2017-09-14 12:24       ` Stefan Monnier
  3 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 23:51 UTC (permalink / raw)
  To: help-gnu-emacs

Joerg wrote:

> Why make things complicated?

It isn't - it's fun :)

> I do such stuff with spreadsheets.

When done, feeding a CLI tool with data from
the shell is faster and more pleasant (cooler)
than using a spreadsheet. It can then also be
combined with other such tools, tho I admit
that probably won't happen in this case (?).

A spreadsheet is of course a fine way to do it
as well.

> That's what they were invented for.

Programming languages were also invented for
this kind of... computing :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:59       ` David Scheidt
@ 2017-09-08 23:55         ` Emanuel Berg
  2017-09-09 19:17         ` Joerg
  2017-09-11  5:02         ` Tosspot
  2 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-08 23:55 UTC (permalink / raw)
  To: help-gnu-emacs

David Scheidt wrote:

> I rewrote his code in common lisp in less
> time than it takes excel to start.

It really doesn't get any faster than these
lovely small shell tools :)


    you gotta give me more and more
    cuz you're the one that I adore
                      (Zodiac 1996)


-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:59       ` David Scheidt
  2017-09-08 23:55         ` Emanuel Berg
@ 2017-09-09 19:17         ` Joerg
  2017-09-09 19:46           ` Emanuel Berg
  2017-09-10  2:06           ` David Scheidt
  2017-09-11  5:02         ` Tosspot
  2 siblings, 2 replies; 29+ messages in thread
From: Joerg @ 2017-09-09 19:17 UTC (permalink / raw)
  To: help-gnu-emacs

On 2017-09-08 12:59, David Scheidt wrote:
> In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
> :On 2017-09-08 10:52, Emanuel Berg wrote:
> :> Skip Montanaro wrote:
> :>
> :>> * Why the 1.0 divisor when computing gear?
> :>
> :> As explained, otherwise it'll be integer
> :> division. But I think that qualifies as a hack
> :> (not an ugly hack tho) so there is no shame in
> :> spotting it an "error" :)
> :>
> :>> * You can skip the radius and use wheel
> :>> (diameter) directly in computing
> :>> the circumference.
> :>
> :> Right!
> :>
> :>> * It never occurred to me to do this in Lisp.
> :>> I always just use an online calculator, like:
> :>>
> :>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
> :>
> :> Let's agree there is no need to do it in Lisp.
> :> Only a desire :)
> :>
>
> :Why make things complicated? I do such stuff with spreadsheets. That's
> :what they were invented for. Part of every office software including
> :free ones.
>
> I rewrote his code in common lisp in less time than it takes excel to
> start.
>

Wow, you must be able to type at hundreds of letter a second. Here, it 
takes less than 2sec for Excel to start. Mostly only a split second to 
open the file because I usually have it running nearly all the time.

-- 
Regards, Joerg

http://www.analogconsultants.com/


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-09 19:17         ` Joerg
@ 2017-09-09 19:46           ` Emanuel Berg
  2017-09-10  2:06           ` David Scheidt
  1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-09 19:46 UTC (permalink / raw)
  To: help-gnu-emacs

Joerg wrote:

> Wow, you must be able to type at hundreds of
> letter a second. Here, it takes less than
> 2sec for Excel to start. Mostly only a split
> second to open the file because I usually
> have it running nearly all the time.

But it is faster to feed data into a shell
tool, hit RET and have the result outputted.

And yes, programmers type very quickly indeed.

On a general note, if you care about time (the
perception thereof) you should throw the
computer into a rock wall and be done with it.

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:56     ` Joerg
  2017-09-08 19:59       ` David Scheidt
  2017-09-08 23:51       ` Emanuel Berg
@ 2017-09-09 21:08       ` Tomas Nordin
  2017-09-14 12:24       ` Stefan Monnier
  3 siblings, 0 replies; 29+ messages in thread
From: Tomas Nordin @ 2017-09-09 21:08 UTC (permalink / raw)
  To: help-gnu-emacs


> Why make things complicated? I do such stuff with spreadsheets. That's 
> what they were invented for. Part of every office software including 
> free ones.

As pointed out already, maybe because it's fun. Maybe because you're
curious if you can do such thing in lisp. Maybe you realize that if you
do it you will learn more lisp as you go. Maybe you would like to write
it with a tool that is perfectly suited for public discussion and review
on a certain mailing list to get some useful feedback. Maybe you want to
start out playing with a language you love for a later implementation of
a cooler on-line calculator. And so on...



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-09 19:17         ` Joerg
  2017-09-09 19:46           ` Emanuel Berg
@ 2017-09-10  2:06           ` David Scheidt
  2017-09-10 14:59             ` Joerg
  2017-09-23  5:42             ` DougC
  1 sibling, 2 replies; 29+ messages in thread
From: David Scheidt @ 2017-09-10  2:06 UTC (permalink / raw)
  To: help-gnu-emacs

In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
:On 2017-09-08 12:59, David Scheidt wrote:
:> In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
:> :On 2017-09-08 10:52, Emanuel Berg wrote:
:> :> Skip Montanaro wrote:
:> :>
:> :>> * Why the 1.0 divisor when computing gear?
:> :>
:> :> As explained, otherwise it'll be integer
:> :> division. But I think that qualifies as a hack
:> :> (not an ugly hack tho) so there is no shame in
:> :> spotting it an "error" :)
:> :>
:> :>> * You can skip the radius and use wheel
:> :>> (diameter) directly in computing
:> :>> the circumference.
:> :>
:> :> Right!
:> :>
:> :>> * It never occurred to me to do this in Lisp.
:> :>> I always just use an online calculator, like:
:> :>>
:> :>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
:> :>
:> :> Let's agree there is no need to do it in Lisp.
:> :> Only a desire :)
:> :>
:>
:> :Why make things complicated? I do such stuff with spreadsheets. That's
:> :what they were invented for. Part of every office software including
:> :free ones.
:>
:> I rewrote his code in common lisp in less time than it takes excel to
:> start.
:>

:Wow, you must be able to type at hundreds of letter a second. Here, it 
:takes less than 2sec for Excel to start. Mostly only a split second to 
:open the file because I usually have it running nearly all the time.

On my mac at work, from the time I double click the excel icon to the
time it is ready to do work is over a minute.  It's a modern machine,
running an old version of excel.  The windows machine I have, but
never use, which is more powerful, and running a current version,
takes even longer.  It does have a spinny disk, and not an ssd.
(that's not counting the time to takes to boot up, since it's off.)

-- 
sig 57


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-10  2:06           ` David Scheidt
@ 2017-09-10 14:59             ` Joerg
  2017-09-23  5:42             ` DougC
  1 sibling, 0 replies; 29+ messages in thread
From: Joerg @ 2017-09-10 14:59 UTC (permalink / raw)
  To: help-gnu-emacs

On 2017-09-09 19:06, David Scheidt wrote:
> In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
> :On 2017-09-08 12:59, David Scheidt wrote:
> :> In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
> :> :On 2017-09-08 10:52, Emanuel Berg wrote:
> :> :> Skip Montanaro wrote:
> :> :>
> :> :>> * Why the 1.0 divisor when computing gear?
> :> :>
> :> :> As explained, otherwise it'll be integer
> :> :> division. But I think that qualifies as a hack
> :> :> (not an ugly hack tho) so there is no shame in
> :> :> spotting it an "error" :)
> :> :>
> :> :>> * You can skip the radius and use wheel
> :> :>> (diameter) directly in computing
> :> :>> the circumference.
> :> :>
> :> :> Right!
> :> :>
> :> :>> * It never occurred to me to do this in Lisp.
> :> :>> I always just use an online calculator, like:
> :> :>>
> :> :>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
> :> :>
> :> :> Let's agree there is no need to do it in Lisp.
> :> :> Only a desire :)
> :> :>
> :>
> :> :Why make things complicated? I do such stuff with spreadsheets. That's
> :> :what they were invented for. Part of every office software including
> :> :free ones.
> :>
> :> I rewrote his code in common lisp in less time than it takes excel to
> :> start.
> :>
>
> :Wow, you must be able to type at hundreds of letter a second. Here, it
> :takes less than 2sec for Excel to start. Mostly only a split second to
> :open the file because I usually have it running nearly all the time.
>
> On my mac at work, from the time I double click the excel icon to the
> time it is ready to do work is over a minute.  It's a modern machine,
> running an old version of excel.


I suggest you use a PC instead, and a contemporary one. If it was more 
than a couple of seconds I'd be concerned about something not being 
right with the computer.


>                              ... The windows machine I have, but
> never use, which is more powerful, and running a current version,
> takes even longer.  It does have a spinny disk, and not an ssd.
> (that's not counting the time to takes to boot up, since it's off.)
>

Looks like your computers need some serious clean-up. I just tried it on 
mine (Dell XPS8700, no SSD, regular HD). It takes such a small fraction 
of one second that it is impossible to gauge the milliseconds from click 
to Excel being open. I would need a camera and count the frames.

-- 
Regards, Joerg

http://www.analogconsultants.com/


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:59       ` David Scheidt
  2017-09-08 23:55         ` Emanuel Berg
  2017-09-09 19:17         ` Joerg
@ 2017-09-11  5:02         ` Tosspot
  2017-09-11  5:19           ` Emanuel Berg
  2 siblings, 1 reply; 29+ messages in thread
From: Tosspot @ 2017-09-11  5:02 UTC (permalink / raw)
  To: help-gnu-emacs

On 08/09/17 21:59, David Scheidt wrote:
> In rec.bicycles.tech Joerg <news@analogconsultants.com> wrote:
> :On 2017-09-08 10:52, Emanuel Berg wrote:
> :> Skip Montanaro wrote:
> :>
> :>> * Why the 1.0 divisor when computing gear?
> :>
> :> As explained, otherwise it'll be integer
> :> division. But I think that qualifies as a hack
> :> (not an ugly hack tho) so there is no shame in
> :> spotting it an "error" :)
> :>
> :>> * You can skip the radius and use wheel
> :>> (diameter) directly in computing
> :>> the circumference.
> :>
> :> Right!
> :>
> :>> * It never occurred to me to do this in Lisp.
> :>> I always just use an online calculator, like:
> :>>
> :>> http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
> :>
> :> Let's agree there is no need to do it in Lisp.
> :> Only a desire :)
> :>
>
> :Why make things complicated? I do such stuff with spreadsheets. That's
> :what they were invented for. Part of every office software including
> :free ones.
>
> I rewrote his code in common lisp in less time than it takes excel to
> start.

Dinosaur.  SML is the way to go.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-11  5:02         ` Tosspot
@ 2017-09-11  5:19           ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-11  5:19 UTC (permalink / raw)
  To: help-gnu-emacs

Tosspot wrote:

>> Part of every office software including free
>> ones. I rewrote his code in common lisp in
>> less time than it takes excel to start.
>
> Dinosaur. SML is the way to go.

More like you are the dinosaur! Sure, Excel is
from 1987 and SML (Standard Meta Language) is
from 1990.

But SML is a modern implementation of ML from
way back in 1973! ML is sometimes called
"Lisp with types". But Lisp also have types,
only in a different way.

SML and other modern dialects of ML are today
common at universities and popular with
CS people in general (compiler writers,
language-for-the-sake-of-language guys etc.),
but perhaps CS people with a more engineering
inclination than the purists on Haskell.

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-08 19:56     ` Joerg
                         ` (2 preceding siblings ...)
  2017-09-09 21:08       ` Tomas Nordin
@ 2017-09-14 12:24       ` Stefan Monnier
  2017-09-14 19:33         ` Tomas Nordin
  3 siblings, 1 reply; 29+ messages in thread
From: Stefan Monnier @ 2017-09-14 12:24 UTC (permalink / raw)
  To: help-gnu-emacs

> Why make things complicated? I do such stuff with spreadsheets. That's what
> they were invented for. Part of every office software including free ones.

This is an Emacs newsgroup.  Emacs includes a Free (not just "free")
spreadsheet, of course.  Try `C-x C-f gears.ses RET`.


        Stefan




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-14 12:24       ` Stefan Monnier
@ 2017-09-14 19:33         ` Tomas Nordin
  2017-09-14 20:51           ` Emanuel Berg
  2017-09-14 23:49           ` Nick Helm
  0 siblings, 2 replies; 29+ messages in thread
From: Tomas Nordin @ 2017-09-14 19:33 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Why make things complicated? I do such stuff with spreadsheets. That's what
>> they were invented for. Part of every office software including free ones.
>
> This is an Emacs newsgroup.  Emacs includes a Free (not just "free")
> spreadsheet, of course.  Try `C-x C-f gears.ses RET`.

grumf, was that necessary, now I will get stuck on this the coming weeks
I bet. :) I had no idea



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-14 19:33         ` Tomas Nordin
@ 2017-09-14 20:51           ` Emanuel Berg
  2017-09-14 23:49           ` Nick Helm
  1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-14 20:51 UTC (permalink / raw)
  To: help-gnu-emacs

Tomas Nordin wrote:

> grumf, was that necessary, now I will get
> stuck on this the coming weeks I bet. :)
> I had no idea

Everything one does with a computer, one can do
with Emacs. If one can't, do tell whatever lost
art it may involve, since the EETF (the Elisp
Engineering Task Force) are always on the wheel
to fill such blasphemous gaps.

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-14 19:33         ` Tomas Nordin
  2017-09-14 20:51           ` Emanuel Berg
@ 2017-09-14 23:49           ` Nick Helm
  1 sibling, 0 replies; 29+ messages in thread
From: Nick Helm @ 2017-09-14 23:49 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: help-gnu-emacs

Tomas Nordin <tomasn@posteo.net> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> This is an Emacs newsgroup.  Emacs includes a Free (not just "free")
>> spreadsheet, of course.  Try `C-x C-f gears.ses RET`.
>
> grumf, was that necessary, now I will get stuck on this the coming weeks
> I bet. :) I had no idea

I only discovered SES a few days ago as well. I had one of those "OMG,
is there anything Emacs cannot do..." moments. 



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-10  2:06           ` David Scheidt
  2017-09-10 14:59             ` Joerg
@ 2017-09-23  5:42             ` DougC
  2017-09-23  6:41               ` Emanuel Berg
  2017-09-24  1:05               ` Joy Beeson
  1 sibling, 2 replies; 29+ messages in thread
From: DougC @ 2017-09-23  5:42 UTC (permalink / raw)
  To: help-gnu-emacs

On 9/9/2017 9:06 PM, David Scheidt wrote:
,,,
> 
> On my mac at work, from the time I double click the excel icon to the
> time it is ready to do work is over a minute.  It's a modern machine,
> running an old version of excel.  The windows machine I have, but
> never use, which is more powerful, and running a current version,
> takes even longer.  It does have a spinny disk, and not an ssd.
> (that's not counting the time to takes to boot up, since it's off.)
> 

Your Mac/PC/Excel experience seems slow.
I don't use Office at work and use LibreOffice at home now, so I don't 
really know how bad the rental version of MS Office is these days.

I have not written nor used a CLI program in many years. I'd rather do 
it in a GUI (Visual Basic) just for the copy & paste ability that comes 
along for free. PCs are so big and fast now that there's little point in 
worrying about saving a few kilobytes--or even, a few hundreds of 
kilobytes. And arguing that a CLI is somehow "better" than a GUI is like 
arguing that a well and an outhouse are somehow "better" than indoor 
plumbing.

Also I have written programs in the past and not included any help 
files, and then forgotten how to use them. With the VB programs, I put 
in a few help buttons + message boxes that explain how to use the thing, 
so the help can't ever get separated from the program it goes with...


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-23  5:42             ` DougC
@ 2017-09-23  6:41               ` Emanuel Berg
  2017-09-24  1:05               ` Joy Beeson
  1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2017-09-23  6:41 UTC (permalink / raw)
  To: help-gnu-emacs

DougC wrote:

> I have not written nor used a CLI program in
> many years. I'd rather do it in a GUI (Visual
> Basic) just for the copy & paste ability that
> comes along for free.

You can copy and paste, or "kill and yank" as
it is called in the Emacs world, writing CLI
programs as well. But actually it is a bad
habit. The same code shouldn't appear twice.
Instead, it should be "factored out" as it is
called, i.e. put into a neat little function of
its own, and then be invoked, the same
function, from anywhere where it is needed.

> PCs are so big and fast now that there's
> little point in worrying about saving a few
> kilobytes--or even, a few hundreds
> of kilobytes.

CLI programming is not because the programs are
smaller on the disk. Which they are, of course.
It is about other things - speed, creativity,
and the simple fact that some people don't like
clicking on icons with a mouse and pointer, or
searching in endless menus for what the want to
do. They like typing and text and combining
tools to do whatever. This way, one can just
use the computer at a whole other level.

Also, the GUIs are not esthetically appealing
to these people - when you understand what goes
on behind it, just looking at it can be an
unpleasant thing. Text on the other hand is the
truth, there is nothing manipulative to it.
The real deal.

> And arguing that a CLI is somehow "better"
> than a GUI is like arguing that a well and an
> outhouse are somehow "better" than
> indoor plumbing.

CLIs, or text interfaces in general, are
better, faster, more reliable in almost every
case, the exception being applications that are
graphical in nature, e.g. GIS, scientific
visualization programs, and such.

However, not all applications which to some
extent are graphical needs a GUI - examples
here are LaTeX and gnuplot, where very
good-looking documents, charts, and diagrams
can be produced straight from a text buffer.

> Also I have written programs in the past and
> not included any help files, and then
> forgotten how to use them. With the VB
> programs, I put in a few help buttons +
> message boxes that explain how to use the
> thing, so the help can't ever get separated
> from the program it goes with...

No comments :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: program to compute gears, with table
  2017-09-23  5:42             ` DougC
  2017-09-23  6:41               ` Emanuel Berg
@ 2017-09-24  1:05               ` Joy Beeson
  1 sibling, 0 replies; 29+ messages in thread
From: Joy Beeson @ 2017-09-24  1:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 23 Sep 2017 00:42:38 -0500, DougC <dcimper@norcom2000.com>
wrote:

> And arguing that a CLI is somehow "better" than a GUI is like 
> arguing that a well and an outhouse are somehow "better" than indoor 
> plumbing.

Private wells are still around, and a properly-constructed long-drop
dunny is vastly superior to a portapotty.

-- 
Joy Beeson
joy beeson at comcast dot net
http://wlweather.net/PAGEJOY/



^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2017-09-24  1:05 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08  5:33 program to compute gears, with table Emanuel Berg
2017-09-08  8:46 ` Graham
2017-09-08 15:50   ` Frank Krygowski
2017-09-08 21:56     ` Emanuel Berg
2017-09-08 17:44   ` Emanuel Berg
2017-09-08 11:09 ` Skip Montanaro
2017-09-08 11:27   ` tomas
2017-09-08 12:12     ` Skip Montanaro
2017-09-08 17:09 ` David Scheidt
2017-09-08 23:45   ` Emanuel Berg
     [not found] ` <mailman.158.1504868984.14750.help-gnu-emacs@gnu.org>
2017-09-08 17:52   ` Emanuel Berg
2017-09-08 19:56     ` Joerg
2017-09-08 19:59       ` David Scheidt
2017-09-08 23:55         ` Emanuel Berg
2017-09-09 19:17         ` Joerg
2017-09-09 19:46           ` Emanuel Berg
2017-09-10  2:06           ` David Scheidt
2017-09-10 14:59             ` Joerg
2017-09-23  5:42             ` DougC
2017-09-23  6:41               ` Emanuel Berg
2017-09-24  1:05               ` Joy Beeson
2017-09-11  5:02         ` Tosspot
2017-09-11  5:19           ` Emanuel Berg
2017-09-08 23:51       ` Emanuel Berg
2017-09-09 21:08       ` Tomas Nordin
2017-09-14 12:24       ` Stefan Monnier
2017-09-14 19:33         ` Tomas Nordin
2017-09-14 20:51           ` Emanuel Berg
2017-09-14 23:49           ` Nick Helm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).