03-26-2012 01:25 PM
@Ben wrote:
Did you try it with a 1.2 Candle power candle?
I would recommend a Chandelier for massively parallel processing. 😄
03-26-2012 03:49 PM
Ben wrote:
Inplace operations used in the 14th Century?
I realize memory used to be a scarce resource but then again... "There is nothing new under the sun." Eclesiastes
I wanted to wait for the comedy to run its course before pointing out that there is a big difference between creating an algorithm and implementing one.
And yes, buffer copies were quite expensive in his day.
03-26-2012 07:27 PM
Darin.K wrote:I wanted to wait for the comedy to run its course before pointing out that there is a big difference between creating an algorithm and implementing one.And yes, buffer copies were quite expensive in his day.
03-26-2012 08:08 PM
The unitialized SR in the code was my own abomination so the code only works once. 🙂
03-27-2012 05:14 AM - edited 03-27-2012 05:19 AM
@Darin.K wrote:
The reference is Vol. 4 of The Art of Computer Programming by Donald Knuth who also gave us LaTeX. The given example of lexicographic permutation generation is actually strings of digits so this was an easy connection. The other places I have used it were a bit more clever.The unitialized SR in the code was my own abomination so the code only works once. 🙂
I tried your solution yesterday, fixed the USR and promptly stopped trying to understand it.
Seeing this algorithm in a classic text comforts me after being unable to generate the permutations of the number (hence, my solution that generates all numbers and checks them for matching digits). Here's my next coffee-break reading topic.
You writing "lexicographic permutation generation is actually strings of digits" makes me think I should try to solve this challenge in Emacs LISP. 😛 First, where did I put my box of insiginficant, stupid parentheses...
03-27-2012 06:02 AM
@jcarmody wrote:
[...] try to solve this challenge in Emacs LISP. [...]
(defun permutations (bag)
"Return a list of all the permutations of the input."
(if (null bag)
'(())
(mapcan #'(lambda (e)
(mapcar #'(lambda (p) (cons e p))
(permutations
(remove e bag :count 1))))
bag)))
found here. Wow! It's time to develop a LabVIEW LISP node (a la LabPython)...