On 1/2/2018 1:24 PM, Sanjeeb Sinkhada wrote:


        (define reduce-pair(λ(x)(cond

              ((list? x)(append (first(first x))

                               (last(second x)))))))

thank you so much for the reply I got this but still not working

You're getting there.  You have the 1st value and almost have the 2nd value.

The last element of the list is (last x), and the 2nd value of the pair is (second x).  In which order do you want to perform those operations?

Then you need to think about creating the result.  Append works with 2 (or more) lists ... but you have *values* which may not be lists. So you can't use append, but you can use "list" to make a list, or "cons" to make a pair.

And finally, you need to think about what to do if the argument list is empty or isn't composed of pairs.

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to