Skip to content

Compiling Expression Modules?  #1024

@rocky

Description

@rocky

In Combinatorica 2.0 there are a few compiled modules, and none of them can get compiled.

Here is an example:

RP = Compile[{{n, _Integer}},
             Module[{p = Range[n],i,x,t},
	            Do [x = Random[Integer,{1,i}];
		        t = p[[i]]; p[[i]] = p[[x]]; p[[x]] = t,
		        {i,n,2,-1}
		    ];
	            p
	     ]
        ]

The error message we get back is:

Compile::comperr: Expression Module[{p = Range[n], i, x, t}, Do[x = Random[Integer, {1, i}] ; t = p[[i]] ; p[[i]] = p[[x]] ; p[[x]] = t, {i, n, 2, -1}] ; p] could not be compiled.

A "could not be compiled" message occurs for all of them, so I suspect this is more about Expression Modules than it is about the construct inside that needs compiling.

By the way, what would be a workaround for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions