Apparently, the Apple Watch has a foldable charger in the UK. If this is it, it’s certainly innovative and begs the question why no one else has put a slimmer design on the market.
Flash Boys – One Year On
Traders Magazine notes that it’s now a year since Michael Lewis published “Flash Boys”.
After all, it’s not every day that a book launches attorney general investigations, inspires an exchange president to meltdown on cable news and spur Americans to buy a book that features an obscure trader from the Royal Bank of Canada to figure out why the price of his trades were increasing the instant he placed his order.
I read Flash Boys soon after it came out and thought it was excellent. Now, Traders Magazine points out that they talked to IEX before Lewis brought out his book.
The Vanity Fair article by Michael Lewis is worth a read.
Filed under Technology
Ten reasons (not) to use a functional programming language
Amusing tongue-in-cheek rant by FSharpForFunAndProfit about why you *should* use a functional programming language.
Filed under F#
Tech Book: 9 Algorithms that Changed the Future, John MacCormick
This excellent book introduces algorithms that are heavily used in daily life, yet are unknown to the general public. The author aims to introduce them without requiring advanced knowledge:
I assumed that the great algorithms would fall into two catagories. The first category would be algorithms with some simple yet clever trick at their core – a trick that could be explained without requiring any technical knowledge. The second category would be algorithms that depended so intimately on advanced computer science … Imagine my surprise and delight when I discovered that all the chosen algorithms fell into the second category!
The book is a fun read and despite knowing some of the details already, it helped to build my appreciation of the algorithms and their applications.
The algorithms covered are:
- Search engine indexing
- PageRank
- Public key cryptography
- Error-correcting codes
- Pattern recognition
- Data compression
- Databases – reliability and consistency
- Digital signatures
There’s also an excellent chapter on unsolvable problems, with a nod to Alan Turing.

Filed under Tech Book
BCS Meetup: 2015 Lovelace Lecture, Steve Furber
I was lucky to get a ticket to see Steve Furber receive the Lovelace Medal for 2015, for services to the advancement of computer science. He gave an inspirational lecture about his work, starting with his contribution to ARM and including his latest project, SpiNNaker.
Filed under Meetup, Technology
How to call methods with byref parameters from F#
When consuming C# libraries in F# projects, out parameters will be interpreted in F# with type byref. For example:
public class Arithmetic
{
public static void sumAndDifference(
int a, int b, out int sum, out int difference)
{
sum = a + b;
difference = a - b;
}
}
Here, sumAndDifference has the following signature when the library is referenced from an F# project:

The literal way to call the method is as follows, declaring reference value up-front and de-referencing them for use after the method call:
let sum : int ref = ref 1
let difference : int ref = ref 2
Arithmetic.sumAndDifference(5, 3, sum, difference )
printfn "Sum = %d, Difference = %d" !sum !difference
But F# also provides a much more concise syntax, allowing the out parameters to appear on the left hand side of an assignment:
let sum, difference = Arithmetic.sumAndDifference(5, 3)
printfn "Sum = %d, Difference = %d" sum difference
This syntax is so much cleaner and avoids any mention of references.
Filed under F#, Programming
How to write optional parameters in F# with default values
Question: What’s the difference between
let f ( a : int option, b : string option ) = ...
and
let f ( ?a : int, ?b : string ) = ...
Answer: in the first example, even if you have no values for a and b, you must call
let ret = f ( None, None )
whereas in the second example, you can simplify matters:
let ret = f ()
But what if you want to supply default values for those optional parameters? Here’s an example of a type definition in which the constructor takes optional parameters and assigns them default values if no value has been supplied. defaultArg is an F# operator, not a locally defined function.
type T( ?a : int, ?b : string ) = let a = defaultArg a 42 let b = defaultArg b "Hello, World"
Whilst this syntax seems rather clunky, it is effective. You can read more about it on MSDN (scroll down to the section “Optional Parameters”).
Filed under Programming
Voyager 40 years into its mission
Fascinating post about Voyager.
Voyager’s spindly limbed, Transit-van-sized machines have been travelling at around 37,000mph for almost 38 years. When they were launched, wooden-framed Morris 1000 Traveller cars had only recently stopped being produced by British Leyland in Oxford. The Voyagers’ on-board computers are early 1970s models that were advanced then but are puny now – an iPhone’s computer is some 200,000 times faster and has about 250,000 times more memory than Voyager’s hardware.
The secret of its durability is down to the engineers involved:
“The robustness is unique,” she says. “If you talk to the older engineers, they’ll say: ‘Well, we were told to make a four-year mission, but we realised if you just used this higher-rated component, it would last twice as long.’ So they did that. They just didn’t tell anybody. The early engineers were very conscious of trying to make this last as long as possible and, quite frankly, being not as forthcoming with information about the types of parts they were using.”
Filed under Technology
Book Review: The Lost Symbol, Dan Brown
I really enjoyed this Robert Langdon thriller from Dan Brown. The mystical/dark arts side of the book harks back to Dennis Wheatley and if that isn’t your genre it’s necessary to suspend dis-belief – but it’s a good book even despite that.
In this latest adventure, Robert Langdon is involved in the world of Free-Masonry. As ever, he’s called on to use his knowledge of the arts and symbology to solve a number of puzzles. In this book, though, I found Langdon a more sympathetic character – half the time, he didn’t have a clue what was going on and this time he was singled out for abuse as much as the other victims.
Filed under Book Review
Video: Herb Sutter Back to the Basics at Cpp Con 2014
Herb Sutter’s Back to the Basics video is hardly an introduction to C++ as the name suggests. Rather, it clarifies his default choices when faced with some basic tasks like parameter passing, in the light of modern C++ techniques.
Don’t pass owning choices down the call stack – use non-owning raw pointers and references when you don’t need ownership transfer down the call stack, e.g. when callee parameter’s lifetime entirely nested within the called method. If the called method doesn’t participate in ownership, it should be agnostic to the lifetime of the object, whether on the stack, the heap, global, shared_ptr or unique_ptr.

Another reason to use auto is performance – it guarantees no implicit conversion because there’s no explicit declared type.

Reviewing parameter passing choices, established rules of thumb still apply, they just got better.

This is especially true for pass-by-value, which experts considered to be the new default choice for a while for moveable types, but is now only recommended for constructors that wish to retain a copy.
There was a bonus slide on returning multiple values using std::tie, which I’ve been doing for a while.

Finally, it seems that there’s a new term for Universal References – “Forwarding References”. I agree that this states the intention of T&& parameters better that Scott Meyer’s original name, although my eBook of Effective Modern C++ still uses the old name.
Filed under C++, Programming, Video
