On Wednesday, April 26, 2017 at 9:53:34 AM UTC-6, Ralf Hemmecke wrote:
>
> 1) If I'm not wrong then local function definitions don't work in the 
> interpreter. 
>
> 2) For this particular example, you don't need a local function. Or do 
> you see the parameter l used somewhere in leng_aux? 
>
> 3) Writing generic code is not usually done with Any. Rather you should 
> consider writing a .spad file and then compile it and later use it. 
>
> See http://axiom-wiki.newsynthesis.org/SandBoxListLength 
>
> So with the MyListPackage code inside a file foo.spad, 
>
> ----------- 
> )abbrev category MYLIST MyListPackage 
> MyListPackage(T: Type): with 
>     length2: List T -> Integer 
>   == add 
>     len(count: Integer, l: List T): Integer == 
>         empty? l => count 
>         len(count + 1, rest l) 
>
>     length2(l: List T): Integer == len(0, l) 
> ------------- 
>
> you would call 
>
> )compile foo.spad 
>
> and then use 
>
> length2 [1,2,3] 
>
> length2 ["a", "b", "c", "d"] 
>
> No need for Any here. 
>
> Ralf 
>

Thanks, that works.
Why does the compilation say "old system compiler" ?  : 

-> )compile list.spad
   Compiling FriCAS source code from file /home/doug/fricas/list.spad 
      using old system compiler.

 
 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to