Skip to content
Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Exercising Ranges (part 7)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) Calculus operations It’s relatively simple to do differentiation and integration of power series, since they’re just regular polynomial-style. No trigonometric identities, logarithms or other tricky integrals here. Just the plain rule for positive powers of x. For differentiation,…

Exercising Ranges (part 6)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) Multiplying power series Now we come to something that took considerable thought: how to multiply ranges. Doug McIlroy’s Haskell version of range multiplication is succinct, lazily evaluated and recursive. (f:ft) * gs@(g:gt) = f*g : ft*gs + series(f)*gt…

Exercising Ranges (part 5)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) Generalising iota To pretty-print a reversible polynomial, we need to provide for reversibility of iota. So what is iota? It makes a range by repeatedly incrementing a value. What if instead of increment, we use an arbitrary function?…

Exercising Ranges (part 4)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) On reversibility It occurs to me that I’ve been touting reversibility as a good thing, both implicitly and explicitly (for polynomials), and the reason for that is not just that I might want to print polynomials in natural…

Exercising Ranges (part 3)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) So, I was going to implement monoidal_zip, and to do that, I would clone zip_with.hpp. So I did that. Eric’s a great library author, and the ranges code is pretty easy to read. For the most part I…

Exercising Ranges (part 2)

elbeno, 1 July, 20151 July, 2015

(Start at the beginning of the series if you want more context.) First steps with power series A power series (or polynomial, to give it a more familiar term in the case where it’s finite) is represented simply as a sequence of coefficients of increasing powers of x. This is…

Exercising Ranges (part 1)

elbeno, 1 July, 20151 July, 2015

The idea For some time since attending C++Now, I have been meaning to get around to playing with Eric Niebler’s range library. Eric presented ranges in a worked example as one of the keynotes at C++Now – a prior version of the talk that he gave at the Northwest C++…

.emacs bankruptcy

elbeno, 13 June, 201513 June, 2015

So, this past week I decided to redo my .emacs file. Previously, I was using the (somewhat common?) literate programming approach with org-mode, but I decided to ditch that, go back to a flat file and embrace John Wiegley’s excellent use-package. My .emacs is at https://github.com/elbeno/dotemacs if you want to…

“The Lambda Trick”

elbeno, 18 May, 201530 June, 2015

I just got back from C++Now, an excellent conference where C++ template metaprogramming experts abound. A phrase I overheard often was “the lambda trick”. It’s a trick for speeding up compiles when templates get deep. Every C++ programmer knows that deep templates can slow down compilation. Most assume that this…

“In-place” might be less in-place than you think

elbeno, 5 May, 2015

The intuitive view of algorithms that work in-place is that (it sounds obvious) they don’t use any extra space. Canonically in C/C++ we think of something like reversing an array, or that interview staple, removing spaces from an ASCII string, which we might write as: int remove_spaces(char *s) { char…

  • Previous
  • 1
  • …
  • 4
  • 5
  • 6
  • …
  • 68
  • Next
©2026 Why is a raven like a writing desk? | WordPress Theme by SuperbThemes