Problems with list of list of list of list...

Discussion of Scheme and Racket
Post Reply
Leonidas
Posts: 6
Joined: Sun Jun 29, 2008 7:58 am

Problems with list of list of list of list...

Post by Leonidas » Tue Dec 02, 2008 7:56 am

Hi,

I have tried to create a system to determine the Hamilton cycles in a graph, Paste 371394. Unfortunately, when I set the starting point to "Berlin" I the proper route that visits all cities, but it is not returned as a list of lists (containing the cities), but rather as a list of lists of lists of list... you get the idea. I'm using PLT and tried to find my error via the debugger but so far, I have failed to find my problem.

Thanks in advance!

aaronla
Posts: 7
Joined: Fri Jan 02, 2009 3:42 am
Contact:

Re: Problems with list of list of list of list...

Post by aaronla » Wed Apr 29, 2009 11:27 pm

You're actually quite close, except in this step near line 72

Code: Select all

(map 
    (lambda (r) (find-routes r flight-plan)) 
    found-routes)
Bear with me: A route is a list of strings. found-routes is a list of routes.. call this type (list route). the lambda will be invoked with r of type 'route', and find-routes returns a (list route), so this lambda is of type "route -> (list route)", making the map return a (list (list route)), when you want a (list route) that is the concatenated list of all the find-route results.

Post Reply