Jonathan Kelly wrote:
> Hi,
>
> are directly recursive structures not supported, or am I doing something 
> silly?
>
> //------------
>
> struct DLL_Node[T] {
>     next : &DDL_Node[T];
>     node : &T;
> };
> //------------
>
> $ flx t2/fibheap.flx
> CLIENT ERROR
> [lookup_name_in_env]: Name 'DDL_Node' not found in environment (depth 2)
> In t2/fibheap.flx: line 4, cols 13 to 24
> 3: struct DLL_Node[T] {
> 4:     next : &DDL_Node[T];
>                ************
> 5:     node : &T;
>
> -------------------------------------------------------------------------
> 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
>
>   
   
OK, so I thought perhaps mutual recursion, just to make my head hurt ...

//------------
#import <flx.flxh>;

struct DLL_List[T] {
    node : DLL_Node[T];
}

struct DLL_Node[T] {
    next : &DLL_List[T];
    prev : &DLL_List[T];
    this : T;
}

fun new_DLL_List[T] (n:T):&DLL_List[T] =
{
    var x : DLL_List[T];
    return &x;
}

fun new_DLL_Node[T] (n:T):&DLL_Node[T] = {
    var x : DLL_Node[T];
    x.this = n;
    return &x;
}

var lst1 : DLL_List[int];

var lst2 = new_DLL_List[int] (11);
//------------

but this gives the following error.

$ flx t2/fibheap.flx
SYSTEM FAILURE
[C func body, vars] Can't find index 4128

-------------------------------------------------------------------------
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

Reply via email to