Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
I've been struggling with this higher order function for scheme for over a day can someone help?
Post Body

Consider the harmonic numbers Hn = 1 1 1 2 1 3 · · · 1/n. Last week you wrote a recursive Scheme function (named harmonic) which, given a number n, computes Hn. Revise your harmonic function, keeping the name (harmonic n), to take advantage of the sum function seen in the textbook.

Of course, your new and improved definition of harmonic should not be recursive itself and should rely on sum to do the hard work.

(define (sum term a next b)

(if (> a b)

0

( (term a) (sum term (next a) next b))))

--------------------------------------------

I just don't understand what term and next are supposed to be doing and I really don't understand what the last line of the code "( (term a) (sum term (next a) next b))))" is saying, would anyone be able to ELI5 what the last line is saying and how to do this? Thank you!!

Author
User Disabled
Account Strength
0%
Disabled 5 months ago
Account Age
4 years
Verified Email
No
Verified Flair
No
Total Karma
530
Link Karma
351
Comment Karma
105
Profile updated: 1 day ago
Posts updated: 6 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago