Five Dollar Programming Words
codinghorror.com
codinghorror.com
One who knows many things superficially; a pretender to science; a smatterer
Uh?? According to this definition this wouldn't be idempotent:
(defun add-one (x)
(+ x 1))
CL-USER> (values (add-one 5)
(add-one (add-one 5))
(= (add-one 5) (add-one (add-one 5))))
6
7
nil
edit: What the... Wikipedia seems to be agreeing with him. It seems I mixed up idempotence and referential transparency, I thought they were equivalent concepts. I'm confused...abs(-1) = abs(abs(-1) since both equal 1
(setf h (hash-new))
(hash-insert h 'foo '(1 2 3 4))
(hash-delete h 'foo)
;;; some time later
(hash-delete h 'foo)
A non-idempotent implementation might complain that 'foo doesn't exist in the table.'Idempotence' is the property that you can run something 1 or 100 times, and there is no difference in post-conditions. "x=1" is an idempotent operation. Idempotent operations can have side-effects.
'Referential transparency' means you can replace an expression with the value it returns, and it makes no difference in post-conditions. The expression "x=1", while idempotent, is not referentially transparent; the expression (in most languages) will return a value of 1, but you cannot replace "x=1" with "1" in your code and expect the same post-conditions. Referentially-transparent expressions cannot have side-effects.
(= (remove-el set 1) (remove-el (remove-el set 1) 1))
With network protocols, state machines, and mutable data, idempotence helps ensure consistent state without the fixed-point-ness.Is it? If he had said "this writing style is bad because Jeff uses it", perhaps.
Also his high page rank makes his articles extremely easy to find.
I'm not uber pissed or anything, I understand that he has a new kid and a new business to tend to and therefore his writing time has surely diminished. The word best used to describe my feelings towards his posts as of late is probably "disappointed". I'd rather see fewer, but higher quality posts.