## What is differential execution?

REVISED. This is my Nth attempt to explain it. Suppose you have a simple deterministic procedure that executes repeatedly, always following the same sequence of statement executions or procedure calls. The procedure calls themselves write anything they want sequentially to a FIFO, and they read the same number of bytes from the other end of … Read more

## String Compare “Logic”

“1” is equal to “1”. “0” comes before “2” (so “1040” < “12000”). “4” comes after “0” (so “1040” > “10000”).

## Is there a known implementation of an indexed linked list?

I don’t believe it will be possible to get O(1) for both insertion and lookup. The minute you add an array (or even fancy, splittable vectors), the insertion becomes O(n). There are ways to mitigate the damage depending on the expected behavior of your list. If there will be a lot more lookups than insertions/deletions, … Read more

## Why are leading zeroes used to represent octal numbers?

All modern languages import this convention from C, which imported it from B, which imported it from BCPL. Except BCPL used #1234 for octal and #x1234 for hexadecimal. B has departed from this convention because # was an unary operator in B (integer to floating point conversion), so #1234 could not be used, and # … Read more

## Finding closest match in collection of numbers [closed]

11 bytes in J: C=:0{]/:|@- Examples: >> a =: 1 3 8 10 13 >> 4 C a 3 >> 11 C a 10 >> 12 C a 13 my breakdown for the layman: 0{ First element of ] the right argument /: sorted by | absolute value @ of – subtraction

IMO, the primary benefit is consistency in the naming of methods / functions which logically perform very similar tasks, and differ slightly in by accepting different parameters. This allows the same method name to be reused across multiple implementations. e.g. The overloads: (Good) function Person[] FindPersons(string nameOfPerson) { … } function Person[] FindPersons(date dateOfBirth) { … Read more

## Why would a language NOT use Short-circuit evaluation?

Reasons NOT to use short-circuit evaluation: Because it will behave differently and produce different results if your functions, property Gets or operator methods have side-effects. And this may conflict with: A) Language Standards, B) previous versions of your language, or C) the default assumptions of your languages typical users. These are the reasons that VB … Read more

## XOR of three values

For exactly three terms, you can use this expression: (a ^ b ^ c) && !(a && b && c) The first part is true iff one or three of the terms are true. The second part of the expression ensures that not all three are true. Note that the above expression does NOT generalize … Read more

## Should I use !IsGood or IsGood == false?

I follow the same syntax as you, it’s less verbose. People (more beginner) prefer to use == true just to be sure that it’s what they want. They are used to use operator in their conditional… they found it more readable. But once you got more advanced, you found it irritating because it’s too verbose.

## Code Golf: Conway’s Game of Life

Mathematica – 179 163 154 151 chars a = {2, 2, 2}; s = Export[“out.txt”, CellularAutomaton[{224, {2, {a, {2, 1, 2}, a}}, {1,1}}, (ReadList[#1, Byte, RecordLists → 2>1] – 46)/ 42, #2]〚#2〛 /. {0 → “.”, 1 → “X”}, “Table”] & Spaces added for readability Invoke with s[“c:\life.txt”, 100] Animation: You can also get a … Read more