Bug? with List(Point K)

11 views
Skip to first unread message

Ralf Hemmecke

unread,
Aug 28, 2019, 4:49:17 PM8/28/19
to fricas-devel
According to

http://fricas.github.io/api/Point.html

Point K exports OrderedSet if K does.

So we have:

(293) -> List Point Fraction Integer has finiteAggregate

(293) true

(294) -> Point Fraction Integer has OrderedSet

(294) true

But then, why does the attached program not compile?

You can even use

K ==> Fraction Integer

and it still does not compile.
Am I doing something wrong?

Ralf




(295) -> )co ../src/foo.spad
Compiling FriCAS source code from file
/home/hemmecke/backup/git/qeta/tmp/../src/foo.spad using old
system compiler.
FOO abbreviates package Foo
------------------------------------------------------------------------
initializing NRLIB FOO for Foo
compiling into NRLIB FOO
****** Domain: F already in scope
compiling exported foo : List Point F -> List Point F
****** comp fails at level 1 with expression: ******
error in function foo

((|sort| |pts|))
****** level 1 ******
$x:= (sort pts)
$m:= (List (Point F))
$f:=
((((|pts| # #) (|#| #) (< #) (<= #) ...)))

>> Apparent user error:
not known that (List (Point F)) has (AND (has (List (Point F))
(finiteAggregate)) (has (Point F) (OrderedSet)))
foo.spad

Waldek Hebisch

unread,
Aug 28, 2019, 7:29:00 PM8/28/19
to fricas...@googlegroups.com
Ralf Hemmecke wrote:
>
>
> According to
>
> http://fricas.github.io/api/Point.html
>
> Point K exports OrderedSet if K does.
>
> So we have:
>
> (293) -> List Point Fraction Integer has finiteAggregate
>
> (293) true
>
> (294) -> Point Fraction Integer has OrderedSet
>
> (294) true
>
> But then, why does the attached program not compile?

Compiler is not smart enough to see this at compile time.
When you make operation conditional, then it will compile,
like below:

)abbrev package FOO Foo
Foo(F: Join(OrderedSet, Field)): Exports == Implementation where
K ==> F
Exports ==> with
foo: List Point K -> List Point K
Implementation ==> add
if Point(K) has OrderedSet then
foo(pts: List Point K): List Point K == sort(pts)

--
Waldek Hebisch

Ralf Hemmecke

unread,
Aug 29, 2019, 2:13:43 AM8/29/19
to fricas-devel
Thank you, Waldek,

I seem to have found a nicer solution for me.
If I replace "sort(pts)" by "sort(_<, pts)" it also compiles without
your additional "if".

Ralf
Reply all
Reply to author
Forward
0 new messages