RE: Where is the syntax error

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Thanks, 
 
Now Im stuck at this problem : 
 
let rec power a b = if b = 1 then a * 1 else a * power ( b - 1) ;;
Error: This expression has type int -> int       but an expression was expected of type int
 To: [email protected]
From: [email protected]
Date: Fri, 27 Feb 2015 11:27:47 +0000
Subject: Re: "ocaml_beginners"::[] Where is the syntax error














 

 



  


    
      
      
      Hi,

> Actually, its semantics implies "at_least_one_nonzero"... but that is



> another problem.



You're right, "not_both_zero" is what I meant.  And tangentially,

using negatives in function names is often a recipe for confusion.

I would rather name the function positively and negate its result

where appropriate:



let both_zero a b = a = 0 && b = 0



Cheers,

Dario Teixeira
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.