On Thu, 2006-10-05 at 21:16 +1000, Jonathan Kelly wrote:
> Hi,
>
> in the following code, the procedure s behaves differently on the second
> and subsequent iterations than the first ..
I get this:
List(1)->List(1)->Loop
List(1)->List(2)->List(1)->Loop
List(1)->List(3)->List(2)->List(1)->Loop
20
List(1)->List(20)->List(3)->List(2)->List(1)->Loop
51
List(1)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
98
List(1)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
10
List(1)->List(10)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
61
List(1)->List(61)->List(61)->Loop
17
List(1)->List(17)->List(17)->Loop
Well .. that's kind of weird: 20,98,10 get added after the head
element .. but when you repeat the operation recursively
it does something different.
Well I fixed it:
List(1)->List(1)->Loop
List(1)->List(2)->List(1)->Loop
List(1)->List(3)->List(2)->List(1)->Loop
20
List(1)->List(20)->List(3)->List(2)->List(1)->Loop
51
List(1)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
98
List(1)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
10
List(1)->List(10)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
61
List(1)->List(61)->List(10)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
17
List(1)->List(17)->List(61)->List(10)->List(98)->List(51)->List(20)->List(3)->List(2)->List(1)->Loop
The bug is here:
fun new_DLL_List[T] (n:T):&DLL_List[T] = ..
^^^
It isn't a function. Should be:
gen new_DLL_List[T] (n:T):&DLL_List[T] = ..
It's a generator. It makes unique objects.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language