This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

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

2 posts · 3545 views

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!

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

You're actually quite close, except in this step near line 72
(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.