Thanks. Both of these worked

(5) -> if typeOf(n)::OutputForm=Integer then output("yes")
   yes
                                                                   Type: 
Void
(6) -> if typeOf(n)::OutputForm=Integer() then output("yes")
   yes

What is the difference between Integer() and just Integer? I do not 
understand why Integer() even worked. What the empty () doing there?

--Nasser
On Wednesday, August 31, 2022 at 1:37:28 AM UTC-5 [email protected] wrote:

> Le mer. 31 août 2022 à 08:26, Grégory Vanuxem <[email protected]> a 
> écrit :
>
>> Hello,
>>
>> I suspect typeOf is an interpreter function that does not mix well with 
>> library things.
>>
>> As a workaround may I suggest to coerce its output to OutputForm like 
>> this :
>> typeOf(n)::OutputForm = Integer => output("type is integer")
>>
>
> or eventually using Integer() instead of Integer above.
>  
>
>>
>> __
>> Greg
>>
>>
>> Le mer. 31 août 2022 à 07:14, 'Nasser M. Abbasi' via FriCAS - computer 
>> algebra system <[email protected]> a écrit :
>>
>>> I am learning Fricas with the hope I can write Fricas script for CAS 
>>> integration tests directly.
>>>
>>> I am having hard time figuring how to check the type of variable. I 
>>> looked at Fricas book but it shows no examples.
>>>
>>> (11) -> n:Integer   
>>>                                                                    Type: 
>>> Void
>>> (12) -> n:=10
>>>    (12)  10
>>>                                                                 Type: 
>>> Integer
>>> (13) -> typeOf(n)
>>>    (13)  Integer
>>>
>>> Now I want to check, using if then else, that "n" has type "Integer". 
>>> How to this? For example, this gives error
>>>
>>>      if typeOf(n)=Integer then output("type is integer")
>>>
>>> I tried few other permutations of the above, but they all give errors.
>>>
>>> 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 [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/fricas-devel/8a0019d9-e2d0-44c9-a899-682e4361e6a4n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/fricas-devel/8a0019d9-e2d0-44c9-a899-682e4361e6a4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/b05b87d8-9199-4bda-85db-9537524841c3n%40googlegroups.com.

Reply via email to