First off, if this was an intentional dinner post, well played. :>
If you don't want to use built-in functions, I would look at using a hash to track what you've already seen and then cons things together depending on if they're in the hash. For the second, maybe recur through the list using a hash to track the most recent index of each item, then pop back up through the recursion consing things together based on whether you're at the specified index. That's my first thought, anyway. On Mon, Jul 20, 2020, 12:04 PM JJ C <jamiebchu...@gmail.com> wrote: > In Beginning Student with List Abbreviations > > I am struggling to come up with functions to remove duplicates from a list > while maintaining the order of the list. > > one function to remove duplicates from the left, > > i.e. 1 2 1 3 2 4 5 -> 1 2 3 4 5 > > and one from the right. > > i.e. 1 2 1 3 2 4 5 -> 1 3 2 4 5 > > What are the functions for removing duplicates from each left and right > side? If you need to, use helper functions and append, cond, cons, equal?, > etc but not using reverse or any built-in functions. > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/6049507b-094e-43c9-9dda-28237fcb57d8n%40googlegroups.com > <https://groups.google.com/d/msgid/racket-users/6049507b-094e-43c9-9dda-28237fcb57d8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAE8gKoe_9sPOesQHm6H-C1WPiGW5oNnd4LFxB-urSqSW9SRkmA%40mail.gmail.com.