Here's what I have
; Ex 1.30
(define (sum term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (+ result (term a)))))
(iter a 0))
; Ex 1.31
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
>>6 >>3 emphasized that it might be impossible to write it in Factor. Everyone knows how to do it in Haskell, he was expecting someone to prove him wrong about the Factor part.
I think.
Name:
Anonymous2008-02-10 9:58
>>1
What is all that load of inefficientn junk, what the fuck dude?
Did you seriously had to count all that ))))) to write a sum function?
long sum(int iArray[]) {
int iSize = strlen(iArray);
int iCount;
long lSum;
>>9
I can't believe the amount of failure I'm seeing in your post.
- You don't understand Scheme. Your program doesn't do anything like the OP's one.
- You don't understand Hungarian notation. No, it's not about prefixing types to variable names. Seriously.
- You don't understand C. That has already been pointed out.
- You don't understand text editors. We don't need to count parentheses.
Still, you're trying to be all cocky at someone obviously better than you. Good job!
I can't believe THE BLOODY AMOUNT of failure I'm seeing in your POST.
- You DON'T understand Scheme. Your program doesn't do CRACKER anything like the BLOODY KNOCK UP OP's one.
JOHN - YOU don't understand Hungarian notation. NO, it's CHOAD not ASSWIPE about prefixing TYPES to variable names. Seriously.
- You don't understand C. FRENCH TICKLER That has ALREADY been pointed out.
- You don't understand text editors. We don't need to count PARENTHESES.
Still, YOU'RE trying to be ALL RUMP-SHAKER cocky at someone obviously better than you. Good job!
Name:
Anonymous2008-02-10 17:21
I COCK can't believe the amount of failure I'm BLOODY HELL seeing in YOUR post.
- You don't QUEEF UNDERSTAND Scheme. Your program doesn't do THREEWAY WOMAN anything like TAR BABY THE SODDING OP's GET BENT one.
- You don't understand Hungarian TEA ROOM notation. RIM JOB No, IT'S not about prefixing GLORY HOLE types to BEAR variable HUNG names. Seriously.
- You don't understand C. That DYKE has already been BEAVER pointed OUT.
- You don't understand BEAVER text editors. We don't need BALLS TO count parentheses.
Name:
Anonymous2008-02-10 19:32
That's not general enough:
(define (curry f . curried)
(lambda args
(apply f (append curried args))))
(define (accumulate acc-function neutral end-test term from next end)
(define (iter from result)
(if (end-test from end)
result
(iter (next from) (acc-function result (term from)))))
(iter from neutral))
>>19
That is not general enough either.
With OPs code you can return the sum of all odd numbers 1..100 like this
(define (inc x) (+ x 1))
(define (id x) (x))