I have been as a part of a school assignment been coding a program on racket,which is similar to the tfl route planner. My objective is to create a function which takes the results from the two functions, for example for my first function I decide any random letter such as C for my starting and in my second function which is the same function expect it’s a final destination and I choose F.I want to be able to create function which after I compute both functions it updates the results into the new function,at this point when I run the new function it will print something like this “Your journey from C to F”
so I can begin the second phase which is to set a distance of 5 mins between each letter, and calculate he fastest route for example, from a to b is 5 min and a to c is 10 min.using set-intersection to find the quickest route I have been searching this on google and stack overflow, but they don't help. here is my code so far.
(define line1 (set "a" "b" "c" "d" "e")) (define line2 (set "f" "g" "c" "h" "i")) (define line3 (set "k" "i" "l" "m" "e")) (printf "enter your current posistion") (define exsists1 (λ (a) (cond ((empty? a) (error " you need to enter a starting location")) ((not (or (set-member? line1 a) (set-member? line2 a) (set-member? line3 a))) (error "enter a location which exisits")) (else "enter your final destintation")))) (define exsists2 (λ (b) (cond ((empty? b) (error " you need to enter a finishing location")) ((not (or (set-member? line1 b) (set-member? line2 b) (set-member? line3 b))) (error "enter a location which exisits")) (else "plan your journey"))))