Hi S Brown,
On Apr 24, 4:11 pm, S Brown <ontheh...@gmail.com
> add-at-end needs to take a list, and return a new list, with the first
> element of the list appended to the end of the new list. (IE - list
> going in is 10 5 1, list coming out should be 10 5 1 10).
That is basically the same function description that I wrote for add-
> My initial solution was to require add-at-end to receive two arguments, an item
> and a list, and have the specified item added to the end of the
> specified list. So, in practice it ended up being used like this:
> (add-at-end (first a-poly) a-poly)
This is a case where you might be writing a "wish list" as you go
along. You know add-at-end takes a single argument, a polygon, so
basically you might "wish" you had another function that took a
polygon, and something
you want to append to the end of it.
> This works, but I think I'm missing something here. I have tried going
> through the design process, but I'm getting stuck because I haven't
> been able to figure out another way of "retaining" that first value so
> that it can be appended to the end. The only other solution I have
> been able to come up with is something such as:
> (define (add-at-end a-poly)
> (add-at-end2 (first a-poly) a-poly))
> where add-at-end2 is the same definition as the original add-at-end.
It is not exactly the same, because you have an additional argument:
the thing that you want to append to the end. This makes perfect
sense. I called the 2nd function "add-at-end-helper".
> So, is there a better, or rather a more correct way of solving this
> exercise, or is this solution acceptable?
It is acceptable.