Re: [fricas-devel] There are questions one should not ask...
Clearly "typeOf" can only handle 1 argument, following patch should fix this bug, but I wonder if there are better ways of error handling than "error". diff --git a/src/interp/i-spec2.boot b/src/interp/i-spec2.boot index b82cae83..15249526 100644 --- a/src/interp/i-spec2.boot +++ b/src/interp/i-spec2.boot @@ -1057,7 +1057,7 @@ --% Handler for typeOf uptypeOf form == - form isnt [op, arg] => NIL + form isnt [op, arg] => error "typeOf: 1 argument required" if VECP arg then transferPropsToNode(getUnname arg,arg) if m := isType(arg) then m := Also the unrelated "typeOf" in fortran.spad can be deleted: diff --git a/src/algebra/fortran.spad b/src/algebra/fortran.spad index f055b260..e9e04235 100644 --- a/src/algebra/fortran.spad +++ b/src/algebra/fortran.spad @@ -1228,8 +1228,6 @@ SimpleFortranProgram(R, FS) : Exports == Implementation where nameOf(u : %) : Symbol == u . name -typeOf(u:%):Union(FST,"void") == u . type - bodyOf(u : %) : FS == u . body argumentsOf(u : %) : List Symbol == variables(bodyOf u)$FS On Tue, Jun 26, 2018 at 10:35 PM, Riccardo GUIDA wrote: > (18) -> typeOf(()) > INFO: Control stack guard page unprotected > Control stack guard page temporarily disabled: proceed with caution > >> System error: >Control stack exhausted (no more space for function call frames). > This is probably due to heavily nested or infinitely recursive function > calls, or a tail call that SBCL cannot or has not optimized away. > > PROCEED WITH CAUTION. > > (18) -> typeOf () > INFO: Control stack guard page reprotected > INFO: Control stack guard page unprotected > Control stack guard page temporarily disabled: proceed with caution > >> System error: >Control stack exhausted (no more space for function call frames). > This is probably due to heavily nested or infinitely recursive function > calls, or a tail call that SBCL cannot or has not optimized away. > > PROCEED WITH CAUTION. > > (18) -> > > -- > 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. -- 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.
Re: [fricas-devel] first and last are "BOTH a variable and a literal"
On Wed, Jul 11, 2018 at 4:14 PM, Raymond Rogers wrote: > On 07/11/2018 03:15 PM, Bill Page wrote: > ... > If I replace 'first' with a different name e.g. 'first2' and 'last' > with 'last2' then there are no such errors. So far as I know > 'first' and 'last' are not reserved words in spad. > It seems like 'first' and 'last' are imported as literals from the List domain where they are used in 'elt' to provide the notation 'x.first' and 'x.last'. These are exactly equivalent to the functions 'first x' and 'last x' also exported by List. > In other contexts "first" and "last" are list operators, getting > the first and last item; or in some cases a pointer. They work > as operators in fricas. Yes of course. These are operators that are exported by the List domain constructor. The List domain constructor also exports another other called 'elt' which can also be denoted by just a '.'. 'x.last' is exactly equivalent to 'elt(x,last)'. > I would avoid trying to use them as literals FriCAS already uses them as literals. In my code I did not use them as literals but I did define new functions with the same name. This triggered the error message because I also use variables of type 'List'. > and think they should be reserved and defined. I disagree. > Personally I wouldn't trust "overloading" them either. Why? FriCAS does this extensively. > Basically I think that they come down (up?) from Lisp. > No, that is not the case. -- 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.
Re: [fricas-devel] how to integrate a generic function in FriCAS?
You should use F := operator "F" to let the system know that 'F' is a function that can be applied to variables. On Thu, Jul 12, 2018 at 8:07 AM, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote: > sorry for basic question, but after some search I could find what the > correct syntax is. > Some integrals I need to run in Fricas use a generic function as in f(x) in > the integrand. For example > > integrate(F(x)/(sqrt(x)*sqrt(-x + 1)),x) > > Fricas does not like the above > --- > (1) -> integrate(F(x)/(sqrt(x)*sqrt(-x + 1)),x) >There are no exposed library operations named F but there is one > unexposed operation with that name. Use HyperDoc Browse or issue > )display op F > to learn more about the available operation. > >Cannot find a definition or applicable library operation named F > with argument type(s) > Variable(x) > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. > --- > > What do I need to do to make it work? > using FriCAS 1.3.4 > > Thanks, > --Nasser > > -- > 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. -- 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.
[fricas-devel] how to integrate a generic function in FriCAS?
sorry for basic question, but after some search I could find what the correct syntax is. Some integrals I need to run in Fricas use a generic function as in f(x) in the integrand. For example integrate(F(x)/(sqrt(x)*sqrt(-x + 1)),x) Fricas does not like the above --- (1) -> integrate(F(x)/(sqrt(x)*sqrt(-x + 1)),x) There are no exposed library operations named F but there is one unexposed operation with that name. Use HyperDoc Browse or issue )display op F to learn more about the available operation. Cannot find a definition or applicable library operation named F with argument type(s) Variable(x) Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. --- What do I need to do to make it work? using FriCAS 1.3.4 Thanks, --Nasser -- 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.
Re: [fricas-devel] first and last are "BOTH a variable and a literal"
On 07/11/2018 03:15 PM, Bill Page wrote: If I use the names 'first' and 'last' in a spad file I get a message: Semantic Errors: [1] last is BOTH a variable and a literal [2] first is BOTH a variable and a literal ... What does this mean? In spite of the "semantic error" the code compiles and runs as expected. If I replace 'first' with a different name e.g. 'first2' and 'last' with 'last2' then there are no such errors. So far as I know 'first' and 'last' are not reserved words in spad. In other contexts "first" and "last" are list operators, getting the first and last item; or in some cases a pointer. They work as operators in fricas. I would avoid trying to use them as literals and think they should be/reserved/ and /defined/. Personally I wouldn't trust "overloading" them either. Basically I think that they come down (up?) from Lisp. Ray -- 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.
[fricas-devel] first and last are "BOTH a variable and a literal"
If I use the names 'first' and 'last' in a spad file I get a message: Semantic Errors: [1] last is BOTH a variable and a literal [2] first is BOTH a variable and a literal ... What does this mean? In spite of the "semantic error" the code compiles and runs as expected. If I replace 'first' with a different name e.g. 'first2' and 'last' with 'last2' then there are no such errors. So far as I know 'first' and 'last' are not reserved words in spad. -- 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.
Re: Re: [fricas-devel] [BUG]: draw option unit == [a,b] ignored
[Grabmeier]> you must make sure that in the control panel you have "units on" and you [Grabmeier]> possibly have to scale the size of the window in order to have space for [Grabmeier]> tick labelling. Aha, thanks Johannes!!! Units was off: the following works (2) -> vp := draw(sin(11*x),x = 0..2*%pi,title == "Large and unit", unit==[0.2,0.2]) Compiling function %D with type DoubleFloat -> DoubleFloat Graph data being transmitted to the viewport manager... FriCAS2D data being transmitted to the viewport manager... (2) TwoDimensionalViewport: "Large and unit" Type: TwoDimensionalViewport (3) -> units(vp,1,"on") Type: Void So this is not a bug, just a missing feature: I would have expected that setting unit==... in draw would automatically trigger units(...,"on"). Cheers, riccardo -- 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.
Re: [fricas-devel] Intepreter: type declaration ignored in == AND: BOOT::|sayFunctionDeps| is undefined.
On Wed, Jul 11, 2018 at 9:53 AM, Riccardo GUIDA wrote: > > Hi, thanks for the feedback. > Actually, thank you for the feedback. > > [Bill]> Although this terminology is used in a few places, > > "... a few places"? Well, I would say "almost everywhere": > Jenks Sutor vol 0, hyperdoc, fricasUG, mathaction ... > OK, point taken. > > A mystery is that according to the interpreter messages there are > "interpreter functions" and "interpreter rules", so one might wonder if >there are different, undocumented syntaxes and semantics: > ... Yes, probably. The FriCAS interpreter and the SPAD compiler, not to mention the Aldor compiler, where all written by different people at different times during the original Axiom research project at IBM. There is a tendency to approach the interpreter as if it were just a read-eval-print loop for the compiler but as you have seen this is not the case. Rather, what happened is that these rather different systems where "interfaced" in what the developers hoped was a more-or-less seamless way. > > ... I'm starting to believe that the only way for a user to grasp how > the interpreter works in many cases is to (learn boot & lisp and) > read the source files ... quite time consuming task ... sigh ... > I think it is almost universally agreed among the FriCAS developers and many users that the interpreter has many flaws and was written in a manner that does not encourage incremental improvements. There has been a long expressed desire to re-write the interpreter in SPAD (or maybe Aldor) but there has also been a persistent lack of resources in the open source project. > > > I'm also disturbed by the fact that a (fool) user can happily > hide a library operation like +. I would have preferred to be > obliged to write something like > > IAmNotInsaneAndIReallyWantToRedefine(_+) > > before being able to redefine. > Agreed. In fact the library operation is not hidden as such (1) -> (1+1)==3 Type: Void (2) -> (1+1)$Integer (2) 2 Type: Integer But the interpreter rule does take precedence over any library function of the same name. I think it might be better if it was necessary for the user to explicitly state a preference. > > [ric]> (2) -> y:Integer == 1 > > [Oldk1331]> This is a strange way to input in FriCAS, > it actually defined a rule for ':' > This should be considered a bug in the interpreter. > Well, I had the (unwise) idea of approaching FriCAS by > first reading the whole AldorUG, so my test was Aldor-inspired [1] > I presume that you expected y:Integer == 1 and y:Integer y == 1 to produce the same results. But the rule is that things on the left hand side of == are not evaluated - not even the apparent declaration : !! Probably this should not be the case for :. Instead it should at least evaluate declarations on the left and return the symbol before evaluating the rule. To some extent Aldor was intended to fix what was wrong with the SPAD compiler, but you should consider it even farther from the interpreter than SPAD. -- 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.
[fricas-devel] [BUG]: draw option unit == [a,b] ignored
Hi, IIC the user guide the draw option unit==[0.2,0.2] should add ticks to the axes x and y, but I cannot see anything. Try eg: draw(sin(11*x),x = 0..2*%pi,toScale == true,title == "Drawn to scale") draw(sin(11*x),x = 0..2*%pi,toScale == true,title == "Drawn to scale and unit", unit==[0.2,0.2]) draw(sin(11*x),x = 0..2*%pi,toScale == true,title == "Drawn to scale and unit", unit==[0.5,0.5]) draw(sin(11*x),x = 0..2*%pi,title == "Large and unit", unit==[0.2,0.2]) draw(sin(11*x),x = 0..2*%pi,title == "Large and unit", unit==[0.5,0.5]) Am I missing something important? ric -- 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.
Re: [fricas-devel] Intepreter: type declaration ignored in == AND: BOOT::|sayFunctionDeps| is undefined.
Hi, thanks for the feedback. [Bill]> Although this terminology is used in a few places, "... a few places"? Well, I would say "almost everywhere": Jenks Sutor vol 0, hyperdoc, fricasUG, mathaction ... [Bill]>I do not think it [Bill]> is correct to call == delayed assignment. Rather it only represents [Bill]> kind of function definition via matching (which granted, does involve [Bill]> some form of delayed assignment). More specifically in the interpreter [Bill]> == defines a "rule". In the case of ==, : is an operator like any [Bill]> other. E.g. I see your point of view. This sheds more light also on T3(f(x)) == ... in [1] A mystery is that according to the interpreter messages there are "interpreter functions" and "interpreter rules", so one might wonder if there are different, undocumented syntaxes and semantics: (1) -> z == 1 Type: Void (2) -> x + y == 5 -x + 10 *y Type: Void (3) -> )display properties + z Properties of + : This is an interpreter function. Definition: + (x, y) == 5 - x + 10 y Properties of z : This is an interpreter rule. ... I'm starting to believe that the only way for a user to grasp how the interpreter works in many cases is to (learn boot & lisp and) read the source files ... quite time consuming task ... sigh ... I'm also disturbed by the fact that a (fool) user can happily hide a library operation like +. I would have preferred to be obliged to write something like IAmNotInsaneAndIReallyWantToRedefine(_+) before being able to redefine. [ric]> (2) -> y:Integer == 1 [Oldk1331]> This is a strange way to input in FriCAS, it actually defined a rule for ':' Well, I had the (unwise) idea of approaching FriCAS by first reading the whole AldorUG, so my test was Aldor-inspired [1] regards riccardo [1] https://www.mail-archive.com/fricas-devel@googlegroups.com/msg12354.html [2] http://www.aldor.org/docs/HTML/chap5.html#3 -- 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.
[fricas-devel] [PATCH] fix highlighting and enable it by default
The escape code for bold font is wrong, this was fixed in openaxiom a long time ago. diff --git a/src/interp/macros.lisp b/src/interp/macros.lisp index 5ef5ef6e..c8c55cfb 100644 --- a/src/interp/macros.lisp +++ b/src/interp/macros.lisp @@ -60,7 +60,7 @@ (def-boot-val |$quadSymbol| $boxString "displays an APL quad") (def-boot-val $escapeString (string (code-char 27)) "string for single escape character") -(def-boot-val |$boldString| (concatenate 'string $escapeString "[12m") +(def-boot-val |$boldString| (concatenate 'string $escapeString "[1m") "switch into bold font") (def-boot-val |$normalString| (concatenate 'string $escapeString "[0;10m") "switch back into normal font") diff --git a/src/interp/setvart.boot b/src/interp/setvart.boot index 281ff95a..74584522 100644 --- a/src/interp/setvart.boot +++ b/src/interp/setvart.boot @@ -331,7 +331,7 @@ LITERALS $highlightAllowed (on off) - off) + on) (instant "present instantiation summary" development -- 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.