View Single Post
Old 01-17-2021, 09:18 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Thumbs up

In the next version of calibre (5.10 probably) add() and multiply() accept a variable number of arguments. Thus, once released your solution can be written as
Code:
program:
    floor(add(field('#story'), field('#characters'), field('#writing'), field('#ending')))
To head off questions: I changed add() and multiply() because the operations are commutative, giving the same answer regardless of order of evaluation, while subtract and divide are not. I don't want to worry about guaranteeing the order of evaluation within the function.

Last edited by chaley; 01-17-2021 at 06:00 PM. Reason: Correct mistaken function name
chaley is offline   Reply With Quote