user998476
user998476

Reputation: 177

Scheme Processing a function n times

I'm trying to use the "beside" function in scheme (DrRacket). I'm wondering how I can use recursion to put multiple objects in a row. (define (row n img). The row would be n images long with each image beside each other, stacked horizontally. Thank you for your time.

Upvotes: 1

Views: 336

Answers (1)

Ryan Culpepper
Ryan Culpepper

Reputation: 10653

Sounds like a case for Recursion on the Natural Numbers! (I assume you're using How to Design Programs. If not, consider reading it, because it teaches you a process for solving problems like this.)

Write down some examples. Start with the very simplest example you can think of. The really really very simplest example that you might not even think of ordinarily.

Write down the template for recursion on a natural number argument. Adapt the template to your function (function name, extra argument).

Then think about how to fill in the blanks.

Upvotes: 2

Related Questions