help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trekking, compute sum of weight of items, Edmund Hillary and Tenzing Nor


From: Emanuel Berg
Subject: trekking, compute sum of weight of items, Edmund Hillary and Tenzing Norgay
Date: Wed, 25 Mar 2020 02:08:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

<incal> I have now compiled a list of 18 items, and wrote
        some Elisp to sum the weight, it is already at
        7.4 kg. I think 10 kg is some sort of practical,
        physical, and/or psychological maximum
        
<incal> <https://dataswamp.org/~incal/TENT>

<incal> PS. when Edmund Hillary made the 8335-8500 meter
        climb on his way to the top of Mt. Everest, together
        with Tenzing Norgay in 1953, they each carried
        23-28 kg. it was -27C and the inclination 30-45
        degrees


I yank the file here ... Elisp last! The problem with
`digits-sum' is that you can't use digits anywhere else,
that's why I put the sum converted to Roman Numerals,
otherwise, the next time you do the count, the sum will be
included as well! (Another way to do this, is to include
a unit, grams or g in this case, without a whitespace - some
people like to do that anyway (exclude the whitespace), so
why not? e.g. 8000mAh and 7383g.) anyway:


comb                            ?                      see "even more"
comic book                    580
drybag                        305
flashlight (3AAA)              73
flashlight (USB)               55
knife                          90
piece of cloth (big)          100
piece of cloth (small)         60
powerbank 8000mAh             245
science book                  411
skin lotion                     ?                      see "even more"
sleeping bag                 1215
sleeping pad                  880
spoon/fork                      ?                      see "even more"
sticky tape                    90
tent                         2515
Trangia                       619
water bottle                  115
even more                      30
            ---------------------
            MMMMMMM CCC L XXX III


(defun digits-sum ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (let ((sum 0))
      (while (forward-word)
        (let ((number (number-at-point)))
          (when number
            (cl-incf sum number) )))
      (message "%s" sum) )))
(defalias 'd #'digits-sum)


----------------------------------------------------------------------
                          this file: https://dataswamp.org/~incal/TENT


-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]