Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Invalid_argument("equal: abstract value")?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tom Hawkins <tom@l...>
Subject: Re: [Caml-list] Invalid_argument("equal: abstract value")?
On Wednesday 31 December 2003 03:55 pm, Tom Hawkins wrote:
> I haven't seen this error before.  Can someone provide an
> explanation?
>
> I've traced the problem down to a structural comparison (=) between
> two large data structures.  I know functional comparisons are a
> no-no, but what is an "abstract value"?
>
> The problem occurred when I added big integers (Big_int.big_int) to
> the data structures under comparison.  Suspecting big ints can't be
> structurally compared, I tried the following, but the compiler
> printed "false" as I would normally expect:
>
>   let a = Big_int.zero_big_int = Big_int.unit_big_int in
>   if a then print_string "true\n" else print_string "false\n";

Further suspecting Big_int.zero_big_int and Big_int.unit_big_int are 
special cases, I tried:

  Big_int.big_int_of_string "123" = Big_int.big_int_of_string "456"

Sure enough, 'Invalid_argument("equal: abstract value")'.  So what's 
the reasoning?  (It's no big deal.  I've already built a structural 
comparison function for my problem as a work-around.)

-Tom   

-- 
Tom Hawkins
Launchbird Design Systems, Inc.
952-200-3790
http://www.launchbird.com/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners