From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: trekking, compute sum of weight of items, Edmund Hillary and Tenzing Norgay
Date: Wed, 25 Mar 2020 02:08:20 +0100 [thread overview]
Message-ID: <87ftdx2qd7.fsf@ebih.ebihd> (raw)
<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 other threads:[~2020-03-25 1:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ftdx2qd7.fsf@ebih.ebihd \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).