Fibonacci factorial
Name:
Anonymous
2009-05-29 11:25
Can anyone code one for me?
Please help, I need it for tomorrow.
Thanks.
Name:
Anonymous
2009-05-29 11:30
Forget it, it's NP complete
Name:
Anonymous
2009-05-29 11:45
Do you mean
fibfact :: [Integer]
fibfact = map fact fibs
or
fibfact :: Integer -> Integer
fibfact = product . fibs
?
Name:
Anonymous
2009-05-29 11:57
(define (fibonacci-factorial n)
(cond ((= n 0) 0)
((= n 1) 1)
(else
(+ (factorial (fibonacci (- n 1)))
(factorial (fibonacci (- n 2)))
))))
Am I doing it right?
Name:
Anonymous
2009-05-29 11:59
s/(fibonacci/(fibonacci-factorial/g
Name:
Anonymous
2009-05-29 13:39
>>5
Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE fibonacci/ at >>5 line 1.
Name:
Anonymous
2009-05-29 13:59
>>6 fine Mr. Pedant
s/\(fibonacci/\(fibonacci-factorial/g
Name:
Anonymous
2009-05-29 16:17
>>5,7
Now you have a function named
fibonacci-factorial-factorial in which the unknown variable
fibbonacci-factorial is used.
Name:
Anonymous
2009-05-29 16:19
>>4
s/\(fibonacci \(-/\(fibonacci-factorial \(-/g
Name:
Anonymous
2009-05-29 16:22
>>9
s/i /i-factorial /g
OMG OPTIMIZED
Name:
Anonymous
2009-05-29 16:23
>>7,9
Escaping the parentheses in the replace clause considered
incorrect.
Name:
Anonymous
2009-05-29 17:07
>>11
Considered by what specifications?
Name:
Anonymous
2009-05-29 17:58
>>12
Any specifications, asshole. There's no damn reason to capture the string that you're replacing.
Name:
Anonymous
2009-05-30 3:24
>>13
I do it all the time. Never know when you'll need them.
Name:
Anonymous
2009-05-30 3:42
>>13
3/10. You could add that double (or otherwise redundant) escaping means
unescaping.
Name:
Anonymous
2010-11-26 13:13