• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

A little OCaml help

Newcap

Junior Member
I am trying to do some programming with OCaml, but I have a little trouble implementing this function:

negate : bignum -> bignum

I tried multiple things, but I have not been successful in terms of implementing the function. What do I do?
 
Never mind, I have it done, but I keep getting a syntax error on one of my lines. It goes like this.
let GcompPositive (b1 : bignum) (b2 : bignum) =
let b1list = explode (toString b1) in
let b1leng = List.length b1list in
let b2list = explode (toString b2) in
let b2leng = List.length b2list in
match ((b1leng > b2leng), (b2leng > b1leng)) with
| (true, false) -> true (*we return true since we need to check if b1 is greater than b2*)
| (false, true) -> false
| (_,_) -> if (equal b1 b2) then false else Gcompare_char_by_char b1list b2list (*case when both have the same length*) ;;
Can anyone tell me what I am doing wrong here?
 
Last edited:
Back
Top