Hi CT,

First, you have to ensure that your FCF is non-generic. For example:

   proc f(x: z.type) ...

or (pardon the inconsistency in domain size):

   type T = [1..1]int;
   proc f(x:T) ...

Second, our compiler currently does not handle func(some array type) when it is 
an argument type or part thereof. So, leave f's type out altogether:

   proc run(f, x:[?Dx] int) ...

With these changes your example works for me.

Vass


On 08/09/16 10:22, ct clmsn wrote:
> is there support for using arrays in first class functions? i've recently
> been trying to code up something that would handle this case and haven't
> been particularly successful.
>
> proc run(f:func([]int), x:[?Dx] int) {
>    f(x);
> }
>
> proc main() {
>   var z = [1,2,3,4,5,6,7,8,9];
>   proc f(x:[?Dx] int) {
>      return x;
>   }
>
>    run(f, z); // compile error
> }
>
> thanks in advance.
>
> ct
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. http://sdm.link/zohodev2dev
>
>
>
> _______________________________________________
> Chapel-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-users
>

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to