Discussion:
[fricas-devel] interpreter (command line): weird syntax allowed for function of function
Riccardo GUIDA
2018-07-06 15:23:25 UTC
Permalink
Hi,

T,T2,T3 below are meant to implement the same map that takes a function x+->f(x) and returns a function x+->x+f(x), both functions of signature Integer->Integer.

I understand the syntax of the assignments to T, T2 below, but I would have been happier to get back a "syntax error" after the definition of T3 (6).

Any clue of how "thinks" the interpreter when dealing with (6)? It looks like if it interpreted 'f(x)' for 'f'... Some (undocumented) interpreter language feature ?

Thanks for any clue
riccardo



(1) -> T: (Integer -> Integer) -> (Integer ->Integer)
Type: Void
(2) -> T2: (Integer -> Integer) -> (Integer ->Integer)
Type: Void
(3) -> T3: (Integer -> Integer) -> (Integer ->Integer)
Type: Void
(4) -> T(f) == (x+->f(x)+x)
Type: Void
(5) -> (T2(f))(x) == x+f(x)
Type: Void
(6) -> T3(f(x))==x+f(x)
Type: Void
(7) -> (T(x+->x^3))(3)
Compiling function T with type (Integer -> Integer) -> (Integer ->
Integer)

(7) 30
Type: PositiveInteger
(8) -> (T2(x+->x^3))(3)
Compiling function T2 with type (Integer -> Integer) -> (Integer ->
Integer)

(8) 30
Type: PositiveInteger
(9) -> (T3(x+->x^3))(3)
Compiling function T3 with type (Integer -> Integer) -> (Integer ->
Integer)

(9) 30
Type: PositiveInteger
(10) -> )display properties T T2 T3
Properties of T :
Declared type or mode: ((Integer -> Integer) -> (Integer -> Integer))
This is an interpreter function.
This depends on the following function or rule: x
Definition: T f == x +-> f(x) + x
Compiled function type: (Integer -> Integer) -> (Integer -> Integer)
Properties of T2 :
Declared type or mode: ((Integer -> Integer) -> (Integer -> Integer))
This is an interpreter function.
This depends on the following function or rule: x
Definition: T2 f == x +-> x + f(x)
Compiled function type: (Integer -> Integer) -> (Integer -> Integer)
Properties of T3 :
Declared type or mode: ((Integer -> Integer) -> (Integer -> Integer))
This is an interpreter function.
This depends on the following function or rule: x
Definition: T3 f == x +-> x + f(x)
Compiled function type: (Integer -> Integer) -> (Integer -> Integer)
--
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+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Loading...