Queue3 Chapter 19 in Programming in Scala 2nd edition Question

7 views
Skip to first unread message

Anthony Doan

unread,
Sep 2, 2011, 12:25:22 AM9/2/11
to scala-user
http://stackoverflow.com/questions/7278772/queue3-chapter-19-in-programming-in-scala-2nd-edition-question/7279109#7279109

I have one answer but I'm not sure if the answer doing a correct
implementation since it's using tuple.

Anyway, I'm a bit stuck on the Queue3 code and I was wondering if
anyone can help me.

Thank you for your time.

Anthony Doan

unread,
Sep 2, 2011, 12:47:54 AM9/2/11
to scala-user
I'm sorry for being lazy. After reviewing the answer, I believe I
understand the original code from the book and what the SO answer is
trying to do. The tail method return a new queue, popping the first
element that was inserted in the queue, copy the trailing list over to
the head while emptying the leading list. But I believe the head
doesn't behave the same way as the tail so it's a bit weird. But
overall, I understand the code now.

Thanks!

On Sep 1, 9:25 pm, Anthony Doan <mythicalprogram...@gmail.com> wrote:
> http://stackoverflow.com/questions/7278772/queue3-chapter-19-in-progr...

Anthony Doan

unread,
Sep 2, 2011, 12:49:34 AM9/2/11
to scala-user
>>the head while emptying the leading list.

Should be, "while emptying the trailing list."
Reply all
Reply to author
Forward
0 new messages