[racket] scheme programming
Hi, I am freshman on this group. I think many of you can help me on programming scheme :)) because I am beginner but I can understand when I see how coded a question. and this helps me be good at scheme.
> For example wanna make sth like that;
>
> (
)
>
> ( )
> Database:
>
> (define flights
> ‘((f237 istanbul frankfurt 5)
> (f220 newyork frankfurt 10)
> (f225 newyork paris 15)
> (f110 berlin moscow 6)
> (f050 istanbul moscow 3)
> (f105 frankfurt istanbul 5)
> (f023 istanbul tehran 4)
> (f338 tehran paris 7)
> (f461 frankfurt paris 2)
> (f173 frankfurt newyork 10)
> (f290 paris newyork 15)
> (f190 moscow paris 5)
> (f320 paris tehran 7)
> (f240 newyork moscow 18)))
>
> (define passengers
> ‘((jake istanbul frankfurt)
> (mike newyork istanbul)
> (pier istanbul berlin)
> (hans frankfurt moscow)
> (john newyork istanbul)))
> I want to implement the
function find-flight which takes source and
> destination as input (2
parameters) and returns flight number as a
> list with one element or nothing if no such flight exists.
>
> > (find-flight 'istanbul 'frankfurt)
> (list 'f237)
> > (find-flight 'tehran 'istanbul)
> empty
>
> For example, I wanna implement the function shortest-travel which
> takes passenger as input and
returns a list of flight numbers which
> is the travel alternative with the smallest total flight
> time. Again, you do not need to consider travel alternatives with
> more than one transit
>
> > (shortest-travel 'jake)
> (list ‘f237)
> > (shortest-travel 'john)
> (list ‘f220 ‘f105)
> > (shortes-travel 'pier)
> (list 'f220 'f461)
>
> If you help me, you will make a great favour to me :))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110521/dd9557a6/attachment.html>