If you haven’t had the chance, you really should pick up a copy of Common Lisp: A gentle introduction to symbolic computation by David Touretzky, in there you will find a series of “templates” for recursion. Consider these like tools in you toolbox.

The following is a presentation of these “recursion templates” in Scheme code with generous examples. Not as clumsy or imprecise as a for loop, they are elegant weapons, from a more civilized era.

Double-Test Tail Recursion

This template is a simple search recursion across a list.

(define (has-odd? lst)
		((null? lst) #f)
		((odd? (car lst)) #t)
			(has-odd? (cdr lst)))))

As you see, we have a Double-Test at the beginning of the cond, the first tests null, and the second tests for the needle that we are searching for in the haystack that we’ve been passed.

In Touretzsky’s version, the first clause returned nil, I’ve elected to return #f which I think is more correct, as an empty list obviously does not have any odds in it. I prefer a uniformity in return types, even though in this example ‘() is certainly not true, therefore it is functionally equivalent.

Search a list for a value

(define (in-list? needle haystack)
      ((null? haystack) #f)
      ((equal? (car haystack) needle)
          (in-list? needle (cdr haystack)))))
(in-list? "Hello" '("Hello" "World")) ; #t
(in-list? "Hello" '("Goobye" "World")) ; #f

Single Test Augmenting Recursion, or Incrementing Recursion

This is a way to recursively accumulate or increment some value, such as counting.

(define (count-items lst)
        ((null? lst) 0)
            (+ 1 (count-items (cdr lst))))))

List Consing Recursion

Here we build a list of values as we go along, notice that we are decrementing, so the numbers are in reverse order.

(define (count-down n)
	  ((zero? n)
		(cons n (count-down (- n 1))))))

An alternative to this would be:

(define (count-up n)
  (let loop ((i 1))
      ((> i n) '())
        (cons i (loop (+ i 1)))))))

Simultaneous Multivariate Recursion

Here we define a function that accepts an ordinal, like 1st, 2nd, 3rd (without the ordinal suffix), and
return that element.

In Touretzky’s book, he reimplements nth, which starts at zero, our function however does not accept 0.

(define (snatch i lst)
    ((<= i 1)
      (car lst))
      (snatch (- i 1) (cdr lst)))))

Conditional Consing

Here we have two paths, one (number?) which conses the car of lst with the result of a recursive call to nums, or, which simply returns whatever would be returned via the continuation. Notice how the numbers come out in order!

(define (nums lst)
	((null? lst) '())
	((number? (car lst))
	   (car lst)
	   (nums (cdr lst))))
	  (nums (cdr lst)))))

Multiple Recursion

Here we combine the results from two independent recursions, each call has the possibility of generating 2 more recursions and on and on.

(define (fib n)
	((equal? n 0) 1)
	((equal? n 1) 1)
	  (+ (fib (- n 1))
		 (fib (- n 2))))))

Car/Cdr Recursion

(define (find-number lst)
	((number? lst) lst)
	((atom? lst) #f)
	  (or (find-number (car lst))
		  (find-number (cdr lst))))))

Page is a work in progress

Whenever the stock market, or commodity prices move, analysts and interested parties feel compelled to “explain” why it has moved one way or another via what could be called “Overton Rationalizations”. The Overton Window is a window of acceptable discourse, and the Overton Rationalizations are the window of acceptable causation.

For instance, if the price of oil goes up, there is probably some tin-foil hat nutter who thinks it went up because the reptilian space dominion wants to bankrupt individual consumers, driving them into homelessness so that these intergalactic masters of the financial universe can harvest livers in ghetto back alleys. That’s probably not the case (who am I to know really), but one thing we can say, is that it is not within the “Overton Rationalization” window. That is, the reptilian oil price causation theory is an extreme or fringe “cause” to explain a mundane (appearing) effect (the price went up).

Cause and Effect, in order to be considered thus, must be consistent. At least statistically consistent. The market, due to certain amounts of noise and a dependence of investor sentiment, is at least in the short term semi-stochastic, so some allowances have to be made for small errors in causation.

Within the Causationsphere of Oil Prices, we have something like this:

Apparently, a terror attack in Libya, endangering oil production further, has a negative effect on the price?

You’d think a direct terror attack, plus the devolving situation in Libya would at least merit an uptick or two?

Ahh, but here comes Reuters, to the rescue:

Ahh, I see, the rumor that the US might possibly kinda lift some sanctions of Rusal, which exports Aluminion leads to a fall in Oil Price because: “reasons”?

That makes so much sense…

No, actually, it really does not.

Here’s another fantastic point to consider:

The most disruptive thing to happen in the Middle East in nearly 100 years causes the price of oil to Fall?

Within days of ISIS declaring the new Caliphate, and seizing a whole shitload of territory. The price of oil went into free fall. Because of a magical “Oil Glut” that hadn’t been noticed until then.


The Price of Oil is not determined by the market

Oil is far too important a commodity to allow it to be determined by the market. It is also not a matter of it being singly controlled by the US, Russia, OPEC. It has to be more complex than that. It doesn’t mean it is “rigged” as in it is always up or down based on the whims of a bunch of cigar sucking oil execs, but it does mean that it is strongly influenced not by geopolitical events, but geopolitical strategy.

What the various actors are trying to accomplish has more influence on oil, than any single event.

If you remember, before the collapse of Oil Prices in 2014, the Russian Government built their entire national budget around the $80+ per barrel Oil price. In 2018, all of the sudden, they think that $80 a barrel cannot be justified. Yeah, sing me another one comrade.

What you are witnessing is masterful Kayfabe. Right now, Western Sentiment (The Face), is squarely against Russia (The Heel). Russia gets to play the reverse psychology game, by running in (even ahead of Trump) to champion a lower oil price. This is classic Sun Tzu behavior. Don’t look like you want something you want.

For a few years I’ve had an account with Wells Fargo $WFC, and I’ve been relatively happy with their service. Today I lamented that I already had a fully diversified portfolio with no cash, otherwise I would have bought their stock just to show support for them standing up to gun-grabber activists. It’s rare to see a bank do that.

$WFC just got added to my watchlist, and I’ll definitely continue giving them my business.

Here is a quick trick to multiply a teen (11-19) by 20. Add 10 to the teen, and then multiply by 10. So if you have 14 times 20, that’s 240. Then multiply the ones part of the teen by 10 and add that, so in this case 4 times 10 is 40 + 240 is 280.

Let’s try a hard one: 17 times 20? That’s 270 + 70 = 340. That’s especially easy because 70 + 70 is 140. How about 18 times 20? Well, that’s 280 + 80. 80 + 80 is 160, add in our 200 and you get 360.

You give it a shot.