On Thu, Jul 5, 2018 at 12:20 PM, Riccardo GUIDA
<riccardo.gu...@gmail.com> wrote:
> Hi
>
> I do not understand how the syntax
>
> rule sin(x) == x      -- see (1) below
>
> is accommodated to fit in the signature
> (EXPR(INT), EXPR(INT)) -> RULE(INT,INT,EXPR(INT))
> see fricas message below
>
> In other words: in (1) I do not see a call to a function "rule" of two
> parameters, rule(f,g): what's happening? Is this an interpreter (command
> line) language construct that has nothing to do with standard function call
> of type  rule(f,g)?
>
> Can one rewrite (1) as an equivalent function call rule(f,g) for some f,g?

The syntax in (1) is a little bit of interpreter "magic".  It is just
sugar for (2)

(1) -> rule sin(x) == x

   (1)  sin(x) == x
                       Type: RewriteRule(Integer,Integer,Expression(Integer))
(2) -> _rule(sin('x),'x)

   (2)  sin(x) == x
                       Type: RewriteRule(Integer,Integer,Expression(Integer))

The escape symbel _ is necessary in order to defeat the magic.

See also some other possibly useful functions in the RewriteRule,
Ruleset and Pattern domains. Eg,

(3) -> )sh RewriteRule
 RewriteRule(Base: SetCategory,R:
Join(Ring,PatternMatchable(Base),Comparable,ConvertibleTo(Pattern(Base))),F:
Join(FunctionSpace(R),PatternMatchable(Base),ConvertibleTo(Pattern(Base))))
is a domain constructor
 Abbreviation for RewriteRule is RULE
 This constructor is exposed in this frame.
------------------------------- Operations --------------------------------

 ?=? : (%, %) -> Boolean               coerce : Equation(F) -> %
 coerce : % -> OutputForm              ?.? : (%, F) -> F
 hash : % -> SingleInteger             latex : % -> String
 lhs : % -> F                          pattern : % -> Pattern(Base)
 retract : % -> Equation(F)            rhs : % -> F
 rule : (F, F, List(Symbol)) -> %      rule : (F, F) -> %
 ?~=? : (%, %) -> Boolean
 elt : (%, F, PositiveInteger) -> F
 hashUpdate! : (HashState, %) -> HashState
 quotedOperators : % -> List(Symbol)
 retractIfCan : % -> Union(Equation(F),"failed")
 suchThat : (%, List(Symbol), (List(F) -> Boolean)) -> %

-- 
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.

Reply via email to