On 7 November 2016 at 15:13, Waldek Hebisch <hebi...@math.uni.wroc.pl> wrote: > Bill Page wrote: >> >> The following simple patch >> >> https://github.com/billpage/fricas/commit/dad89022088a2a9c410344d10b1cda06773a61f9.patch >> > ... > That works. However: > > (4) -> f2(void())$Union(f1 : Void, f2 : Void) > > The function f2 is not implemented in Union(f1: Void,f2: Void) . > > (4) -> f2(void()) > There are no library operations named f2 > Use HyperDoc Browse or issue > )what op f2 > to learn if there is any operation containing " f2 " in its name. > > Cannot find a definition or applicable library operation named f2 > with argument type(s) > Void > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. >
Yes I noticed that. It seems that one cannot package-call functions from built-in domains from the interpreter. Package calling does work in the compiler though. For example: -- )abbrev domain TESTU TestU TestU(): with F1:()->Integer == add U1:=f2(3) $ Union(f1:Integer,f2:Integer) F1() == if U1 case f1 then U1.f1 else U1.f2 -- This also happens already with some other existing functions. For example: (1) -> X:=Record(f1:Integer) (1) Record(f1: Integer) Type: Type (2) -> x:X := [-1] (2) [f1 = - 1] Type: Record(f1: Integer) (3) -> copy(x)$X The function copy is not implemented in Record(f1: Integer) . However 'construct' does work even when (apparently) package called. I noticed there is quite a lot of hacking involved in handling 'construct' so I didn't try to analyze that. But I tried to to find out why this fails for 'copy' (and the functions I added) but I got lost somewhere between bottomUp and the database code. (3) -> )set break break (3) -> copy(x)$X The function copy is not implemented in Record(f1: Integer) . debugger invoked on a SIMPLE-CONDITION in thread #<THREAD "main thread" RUNNING {1003BC6C53}>: break Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from BREAK. (|handleLispBreakLoop| |break|) 0] backtrace Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1003BC6C53}> 0: (|handleLispBreakLoop| |break|) 1: (|bottomUp| (#(|Dollar| NIL NIL NIL NIL) X (#(|copy| NIL NIL NIL NIL) #(|x| #1=(|Record| (|:| |f1| #)) (#1# WRAPPED -1) (#1#) NIL)))) 2: (|interpret1| ((|$elt| X |copy|) |x|) NIL (|Application| (|Fromdom| ((|id| (|posn| #1=# . 0)) . |copy|) ((|id| (|posn| #1# . 8)) . X)) ((|id| (|posn| #1# . 5)) . |x|))) 3: (|interpret| ((|$elt| X |copy|) |x|) (|Application| (|Fromdom| ((|id| (|posn| #1=# . 0)) . |copy|) ((|id| (|posn| #1# . 8)) . X)) ((|id| (|posn| #1# . 5)) . |x|))) ... Can you suggest how to continue debug this? Oddly in this case I can write: (3) -> copy(x) (3) [f1 = - 1] and even this (with the corresponding patch for Record) (4) -> f1(x) (4) - 1 Type: Integer But as you observed in the case of Union (5) -> Y:=Union(f1:Integer) (5) Union(f1: Integer) Type: Type (6) -> f1(-1) There are no library operations named f1 Use HyperDoc Browse or issue )what op f1 to learn if there is any operation containing " f1 " in its name. Cannot find a definition or applicable library operation named f1 with argument type(s) Integer Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. Yet the following is OK: (7) -> f1(-1)@Y (7) - 1 Type: Union(f1: Integer,...) I am a little perplexed. > so more is needed to have consistent support for such feature. > Define consistent. What should we expect to work and what not? -- 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 fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.