[racket] scheme programming

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Sat May 21 10:54:37 EDT 2011

This looks shockingly like a homework problem that a teacher might
have assigned. If you'd send us that teacher's email address, we can
send the answer directly there.

But seriously, people here are very careful not to do assignments for
people. If you get stuck, they're more than willing to offer hints and
help, but you have to provide a lot more up-front work to show that
you've really attempted the problem before you're going to get much
help.

On Sat, May 21, 2011 at 4:57 AM,  <ttrew11 at mynet.com> wrote:
>
> 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 :))
>
> ________________________________
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.