A friend asks:
[Functonal Programming in Python] is an interesting way to see things. I find it fascinating, but what do you think is the main benefit? For example, lambdas are cool syntactically, but I don't see a huge reason for them other than sugar. Python seems to treat function objects basically like function pointers in C, and lambdas are like safe, single expression C macros that you loop through lists. Does functional programming offer more than syntax? Even if it's merely syntax to help one think in a different paradigm that's valid, but I'm struggling to see the value here in the beginning, whereas with C++ the benefits of OOP was easily apparent.
In addition to passing first class functions and having APIs with callbacks, etc., one of the main benefits to functional programming revolves around state. All old state is never updated or copied or klobbered in-place, but is kept around as is. All data structures in purely functional languages are 100% immutable. This eliminates large classes of bugs (but makes coding certain kinds of complex state updates a little more awkward, honestly) and makes testing easier and more mathematical. This also allows 'time-travel' or 'undo' or rewind at the granular level.
These special vector collections and hash maps (dictionary / object), based on work by the late Phil Bagwell, allow basically O(1) lookups and appends with no copying. (There is more overhead/book-keeping than normal low-level C-style data structures but the Big-O performance is still shockingly amazing and scalable.)
This fits with the expression-based approach that most FP languages encourage because you can usually write code that describes declaratively how to compute something, instead of the steps and order to compute it. And those functions can be tested independently since there is little or no 'implicit runtime state' to have to supply at testing time.
Imagine looking at a code base and seeing each function in isolation and knowing (Haskell, at least!) that each piece of code completely and explicitly tells you what inputs it takes, and what output it computes, and that each function has zero side effects (and hence no other effect on any other code ever, just taking CPU time and allocating some memory and returning a result). This also means that if you can prove (formally or informally) that a set of functions are correct for all of their individual inputs, and a combining function is correct, then the combination of those functions is guaranteed to be correct. In normal programming, this is not the case because of implicit, hidden global (or localized) runtime state. When refactoring a chunk of imperative (non-FP) code, what you often end up doing is making the inputs explicit, etc. so that the block of code can be cut out and isolated and used anywhere else. In FP this is already done, every where!
FP is not a panacea but purely functional (stateless) coding style (in C#/C++ = static classes with only static methods and no static mutable state) is awesome because it makes all dependencies explicit instead of hiding state in a 'this' object, which is just a slightly more abstract version of the global state anti-pattern—now your global state is just hidden behind myriad objects! Purely functional code can be used anywhere 'as-is' and expected to work in all circumstances, with no semantic (incorrectness) penalties for reordering calls to functions, etc. You can write large amounts of code in OOP languages in a purely FP coding style and get 90% of the benefit of FP, (but you will still wonder about that last 10%). For example, objects with no mutable state, just set their fields once in the constructor, and provide methods that compute things but do not mutate internal state, etc.
(John Dehlin interviews Jon Ogden about a framework for living and Jon Ogden immediately (five minutes into second podcast, #786) starts blowing my mind with sentence after sentence of concentrated Oh-My-Ogd-ness. Here are some scattered notes for my own reference.)
Quoting no less than ancient philosophy, Immanuel Kant, Bertrand Russell, Albert Einstein (a follower of Spinoza's moral and humanistic argument), the framework centers on the transcendentals (each worth pursuing for their own sake):
Fluffy, warm, fuzzy words? Actual, no; it's a framework for what to focus on and how to spend one's time, to ensure the basic aspects of a happy life.
I am immediately reminded of one of the greatest pieces of prog metal, the song “Learning to Live” by Dream Theater, from the album Images & Words, with lyrics written by Mr. John Myung, a deeply believing Christian, and the world's hardest working bass player, wherein Myung writes from the perspective of an individual who contracted AIDS in the 90s:
I need to live life
Like some people never will
So find me kindness
Find me beauty
Find me truth
When temptation brings me to my knees
And I lay here drained of strength
Show me kindness
Show me beauty
Show me truth
I won't give up
Till I've no more to give
Ogden mentions that Stephen Covey, in The Seven Habits of Highly Effective People, talks about four types of exercise: intellectual, spiritual, social, and physical.
Ogden says that physical exercise is not his focus in the book and that is fine. (As a side note I would argue that the LDS Church could do more to promote proactive physical health as a spiritual requirement for a life that can give more than it takes, and focus less on the thou shalt nots of the Word of Wisdom and more on putting all that constant nagging to better use, instead urging the saints to switch off their TVs and get up off their couches and move their dang bodies, so they can “run, and not be weary; and ... walk, and not faint” (Isaiah 40:31) in the here and now, instead of waiting for the resurrection, and stop overeating so they can have “health to th[e] navel, and marrow to th[e] bones” (Proverbs 3:8, also D&C 89:18–20). I'd like to see exercise treated as a commandment, to destroy the attitude that says “I don't smoke or drink so I get perfect health for free.” Which attitude then devours the lives of various family members, or leaves others maimed. I have strong feelings about physical health and especially exercise as it relates to mental health.)
Putting this all together, we get:
And that order is pretty important. It reminds us of Mazlow's Hierarch of Needs, if not exactly, with 1 on the bottom and 4 on top, like a pyramid, with Strength making the foundation and Truth being the capstone.
Ogden and Dehlin do not address this but I will just say: pick two or three (or six) days a week and a sustainable exercise plan, and always show up, no excuses. (My plan is swimming or hoops on Tuesday and Thursday, and pushups six days a week. Yours may vary but should be something that you can ease into and can keep going indefinitely. Don't hurt yourself.)
If you are ill (e.g. virus) or otherwise have to go through the motions (but only on occasion), so be it: make a substitution. Keep the habit going like your life depends on it; it does. If you have to adapt (vacation, emergency, etc.) then plan or adapt, or substitute, but do not let the habit fall flat. Rain or shine, you will be there.
You can be tougher than the other folks even if you are a scrawny and pasty weakling like me: I am there swimming in the cold November rain and they are nowhere to be seen. I am as tough as the tough guys who could bench press twice my body weight. (They may be at a gym or running on a treadmill when it rains, so that is great too.) And I acknowledge that I could fall off the bandwagon at any time so I am willing to admit that I am weak and just a hair's width away from losing the habit. This is the attitude that leads to Strength or Endurance.
Regarding diet, see how to eat well on $1 per person per meal. I am lucky to have a spouse who more than makes this easy, but I do cook sometimes and I am in charge of dishes, and I help with shopping and meal planning.
The attitude that avoids overeating is the idea that being hungry is fine. You should be hungry between meals. That means you are burning calories. If your energy levels are low when you are not constantly stuffing your face then you need to exercise regularly. If you train your body to inertness it will become expert at it. If you train your body to use a moderate to low amount of high quality calories, it will become efficient at it.
Back to jotting down notes from Ogden:
If you cultivate that attitude and hold on to it, you are more liking to be amenable to correction, which allows you (over time) to get more and more toward the truth. (“You admit that you are stupid, etc.”) The opposite attitude, digging in one’s heals, will ensure that Truth stays far away from you. If you believe you already have the Truth, you will forever bask in ignorance.
The idea that there is some higher form of Spirituality or Connection to something higher than oneself, Meaning, Purpose, or connection to the Ineffable; or Transcendence.
Living our life with this attitude leads us to do certain things like getting off Netflix all the time, getting into face-to-face communication, or camping, or singing in a group, etc. etc. Even if we disagree about belief, we can try things that are more likely to uplift us or bring us deeper joy and perspective, i.e. Beauty.
I am going to see people who are suffering and I am going to alleviate their suffering. We may need a weekly reminder not just to know these things intellectually, but to embody them in our lived experience. (I, Jared, could do much more in this vein.)
More Ogden notes:
There is more than one Virtue. “Truth is all that matters.” That is not True! That is not the only value. There is a lot of utility in Beauty and Goodness (arguably more utility than Truth for it's own sake?). There is a risk to focusing on one Virtue to the exclusion of the Others.
Ogden discusses What Next, with the idea of getting toward a 21st Century Myth. Tremendous power in myth-making. Not trivial; foundational. Harari: Story-telling is the reason humans are different from all the other animals. Money, religion, technology, societal structure. Ken Wilbur: “Transcend and Include” both sides of the aisle. Myth of Trans-humanism, evolving and becoming more perfect (the three virtues), not a divine being necessarily, but a more perfect being.
My wife and I go hiking sometimes on Sunday morning, and we do litter pickup. That gives us Beauty and Strength and some Kindness. We also make bird count checklists and practice learning (Truth) how to identify birds. That is better than just Beauty and sometimes Truth on a Sunday morning (and arguably better than more sitting, being counter to Strength).
Again I have much room for improvement.
My wife and I developed a twist on the Road Trip game “License Plates” and we play it with a bag of letter tiles (one hundred wooden tiles with letter frequencies similar to Scrabble that we customized to play Anagrams).
Reach into bag and pick three letters in succession and set them out in a fixed ordering—order matters.
Start a timer for two minutes. You can change this to your liking but we recommend not tweaking it just because one player is struggling, unless you have a younger player who needs a handicap.
Two to Ten+ Players (limited only by how many people can sit at a table or see the letters) then sit quietly, with pen and paper, and write down words they think of, hidden from other players, scored according to the Scoring Rules, until the timer ends.
You can play as many or as few rounds per game as you like. You can write down as many words as you like, but unlike Boggle, you are not rewarded for the quantity of words, but for quality.
A preselected list of words should be agreed on and neither player can say, “That does not count as a word” at any point simply because the other player is familiar with a bogus-sounding word that they don‘t know offhand.
Two points are awarded each round, one for Longest Word, and one for Shortest Word. There are rules for breaking ties:
The word with the most letters wins.
For two words of the same length:
For ties (the same word) neither player gets a point.
The word with the fewest letters wins (four or more).
For two words of the same length:
For ties (the same word) neither player gets a point.
* means Project Gutenberg only had one translation available and that this is not an endorsement for the specific translation.
(only items not on the above list, and not completed SEbooks)
(This list is suspiciously similar to the English-language subset of novels from the list at The World's Greatest Books)
Public domain items from their top 200 novels, as determined by their UK audience (not in the order of the original):
(obviously there are many duplicates, but there are entire sections of Non-fiction, Drama, Poetry, Lives & Letters, Travel & Adventure, Religion, Economics, Philosophy, Science, etc.)
Thomas Jefferson (+)
Grossmith, Diary of a Nobody (+)
Lucy Mack Smith
Aesop's Fables (+), Translated by George Fyler Townsend, 35,477 words total, 310 little 1-1.05 paragraph Fables
Sir Richard Francis Burton
Beckford, William Thomas
(+) Six Characters in Search of an Author - Luigi Pirandello - 1921 - Italian - 19,800 words, in Three Plays (PG)
Pr. Gut. H. P. Lovecraft (+) :
Sir Arthur Conan Doyle. He died in 1930, which is 87 years ago. So everything he published in his lifetime should be PD?
Sir Arthur Conan Doyle, non-Sherlock Holmes (Markdown cannot parse unindent correctly.)
Margery Williams Bianco
H. G. Wells - PG has tons of stuff by HGW
Ambrose Bierce. All his works published in his lifetime are in the public domain sine he died or disappeared in 1914.
Edward Lear, Nonsense Books, which includes the Owl and the Pussycat, with their runcible spoon.
Gayley et al (<= 1922)
R. L. Stevenson
1001 Nights (Arabian Nights):
The same, the tales proper: (1.6 mill. w.)
Supplemental: (1 mill. w.)
Aucassin and Nicolete:
Beatrix Potter. She died in 1943, + 70 years = 2013
Austen bonus items not on WGB list:
Aphra Behn -
Chamisso, Adelbert Von
There are a number of works in that weird fuzzy legal area on my Google Spreadsheet listing all 100 novels from the Guardian List. Works that are PD in Canada but not the US, or works that I could not find on Project Gutenberg (or Hathi Trust as full text search) are marked "When PD?"