Is the following OK?

(325) -> 4 or 3

   Argument number 1 to "or" must be a Boolean.

(325) -> 4 or true

   Argument number 1 to "or" must be a Boolean.

(325) -> true or 3

   (325)  true

(326) -> zero? 3 or 3

   Argument number 2 to "or" must be a Boolean.

(326) -> zero? 0 or 3

   (326)  true

(327) -> true or "foo"

   (327)  true

Well, it is clear that a shortcut happens here, but I wonder whether we want the language to allow "or" to take non-boolean argument.

This also is a problem in SPAD

)abbrev package FOO Foo
Foo: with
  foo: Integer -> Integer
 == add
  foo(x: Integer): Integer ==
    zero? x or
      return -13
    return x

The following compiles and works as well.

)abbrev package FOO Foo
Foo: with
  foo: Integer -> Integer
 == add
  foo(x: Integer): Integer ==
    zero? x or (x := x+1)
    return x

But what exactly is the type of

  zero? x or (x := x+1)

?

Should I put this into the github issues?

Ralf

--
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/abf1343a-458b-9990-4bd6-0344824bc468%40hemmecke.org.

Reply via email to