caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] xor on booleans
@ 2003-02-01 19:10 Christoph Bauer
  2003-02-03 13:31 ` Frederic De Jaeger
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Bauer @ 2003-02-01 19:10 UTC (permalink / raw)
  To: OCaml List

Hi,

a little suggestion for the Pervasives module: the
xor operator on booleans

let (^^) = (<>)

Christoph Bauer

-- 
proc self {} {foreach c [split [info body self] ""] d {14 -7 0 0 4 -67 4 73 11
69 24 -83 -15 6 -4 -84 78 20 11 -78 -1 -1 79 19 -8 4} { binary scan $c c c
if {[catch {append r [format %c [expr $c+$d]]}]} {return $r};}};puts [self]
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-01 19:10 [Caml-list] xor on booleans Christoph Bauer
@ 2003-02-03 13:31 ` Frederic De Jaeger
  2003-02-03 14:02   ` Fabrice Le Fessant
  0 siblings, 1 reply; 11+ messages in thread
From: Frederic De Jaeger @ 2003-02-03 13:31 UTC (permalink / raw)
  To: OCaml List


CB> Hi,
CB> a little suggestion for the Pervasives module: the
CB> xor operator on booleans

CB> let (^^) = (<>)

CB> Christoph Bauer

For type safety, it would be better to have 

let (^^) (x:bool) (y:bool) = x <> y

-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-03 13:31 ` Frederic De Jaeger
@ 2003-02-03 14:02   ` Fabrice Le Fessant
  2003-02-03 15:14     ` Frederic De Jaeger
  2003-02-04 17:20     ` Pierre Weis
  0 siblings, 2 replies; 11+ messages in thread
From: Fabrice Le Fessant @ 2003-02-03 14:02 UTC (permalink / raw)
  To: Frederic De Jaeger; +Cc: OCaml List


>  For type safety, it would be better to have 
>  
>  let (^^) (x:bool) (y:bool) = x <> y

Type safety is not lost, since (^^) is just equivalent to (<>), which
is polymorph. The polymorphic (^^) is better if I want to define my
own boolean type: type bool = True | False, and use (^^) with it.

- Fabrice
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-03 15:14     ` Frederic De Jaeger
@ 2003-02-03 15:08       ` Fabrice Le Fessant
  2003-02-04 17:29       ` Pierre Weis
  1 sibling, 0 replies; 11+ messages in thread
From: Fabrice Le Fessant @ 2003-02-03 15:08 UTC (permalink / raw)
  To: Frederic De Jaeger; +Cc: OCaml List


>  let s = "hello " ^^ "word" in ...
>  
>  That's why I suggested to restrict the allowed type of (^^).

Fortunately, the type-checker will tell you that you have made an
error as soon as you will try to use 's', which is a boolean and not a
string ...

- Fabrice
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-03 14:02   ` Fabrice Le Fessant
@ 2003-02-03 15:14     ` Frederic De Jaeger
  2003-02-03 15:08       ` Fabrice Le Fessant
  2003-02-04 17:29       ` Pierre Weis
  2003-02-04 17:20     ` Pierre Weis
  1 sibling, 2 replies; 11+ messages in thread
From: Frederic De Jaeger @ 2003-02-03 15:14 UTC (permalink / raw)
  To: OCaml List


>> For type safety, it would be better to have 
>> 
>> let (^^) (x:bool) (y:bool) = x <> y

FLF> Type safety is not lost, since (^^) is just equivalent to (<>), which
FLF> is polymorph. The polymorphic (^^) is better if I want to define my
FLF> own boolean type: type bool = True | False, and use (^^) with it.

That's the point, it is polymorph.
Personally, I rarely need to define my own boolean type.  
On the contrary, I like that such code is refused  (I mistakenly  have
typed two '^' instead of one. That  happens)

let s = "hello " ^^ "word" in ...

That's why I suggested to restrict the allowed type of (^^).
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-03 14:02   ` Fabrice Le Fessant
  2003-02-03 15:14     ` Frederic De Jaeger
@ 2003-02-04 17:20     ` Pierre Weis
  2003-02-06 14:39       ` Fabrice Le Fessant
  1 sibling, 1 reply; 11+ messages in thread
From: Pierre Weis @ 2003-02-04 17:20 UTC (permalink / raw)
  To: fabrice; +Cc: Frederic.De.Jaeger, caml-list

> >  For type safety, it would be better to have 
> >  
> >  let (^^) (x:bool) (y:bool) = x <> y

Hem: as announced in a previous message about formats, ( ^^ ) is now
available in the current working version of Objective Caml to mean
concatenation of format strings (a long time desired feature for
format string constants).

So, please, use some other symbol for boolean xor: I would suggest <>
which is convenient and already defined in the language :)

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-03 15:14     ` Frederic De Jaeger
  2003-02-03 15:08       ` Fabrice Le Fessant
@ 2003-02-04 17:29       ` Pierre Weis
  1 sibling, 0 replies; 11+ messages in thread
From: Pierre Weis @ 2003-02-04 17:29 UTC (permalink / raw)
  To: Frederic De Jaeger; +Cc: caml-list

> That's why I suggested to restrict the allowed type of (^^).

Good: you will be glad with the upcoming version of Objective Caml,
that strictly restricts ( ^^ ) to be used with format strings only :)

(I'm joking, please don't flame)

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-04 17:20     ` Pierre Weis
@ 2003-02-06 14:39       ` Fabrice Le Fessant
  2003-02-07 13:00         ` Damien Doligez
  0 siblings, 1 reply; 11+ messages in thread
From: Fabrice Le Fessant @ 2003-02-06 14:39 UTC (permalink / raw)
  To: Pierre Weis; +Cc: fabrice, Frederic.De.Jaeger, caml-list


>  > >  For type safety, it would be better to have 
>  > >  
>  > >  let (^^) (x:bool) (y:bool) = x <> y
>  
>  Hem: as announced in a previous message about formats, ( ^^ ) is now
>  available in the current working version of Objective Caml to mean
>  concatenation of format strings (a long time desired feature for
>  format string constants).
>  
>  So, please, use some other symbol for boolean xor: I would suggest <>
>  which is convenient and already defined in the language :)

By the way, it looks like the 'format' type has changed (4 args
instead of 3). This is a bit problematic, since some softwares must
use the CVS version of ocaml, only when compiled on Mac OS X (because
of the signal bug), but cannot stay compatible with the 3.06 distrib
because of this change in the format type. Will there be a new
official release soon ? It's not that important, the configure script
can detect and correct that, but it would be nice to have a
Jaguar-compatible official distrib of ocaml...

- Fabrice
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] xor on booleans
  2003-02-06 14:39       ` Fabrice Le Fessant
@ 2003-02-07 13:00         ` Damien Doligez
  2003-02-10  8:16           ` [Caml-list] gdb with ocaml byte code on MacOSX David Brown
  0 siblings, 1 reply; 11+ messages in thread
From: Damien Doligez @ 2003-02-07 13:00 UTC (permalink / raw)
  To: caml-list

On Thursday, February 6, 2003, at 03:39 PM, Fabrice Le Fessant wrote:

> By the way, it looks like the 'format' type has changed (4 args
> instead of 3). This is a bit problematic, since some softwares must
> use the CVS version of ocaml, only when compiled on Mac OS X (because
> of the signal bug),

You can install 3.06 on MacOSX, without the signal bug, if you
follow the instructions (and use the patch) given in this page:
< http://caml.inria.fr/caml-macosx-howto/index.html >

-- Damien

-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Caml-list] gdb with ocaml byte code on MacOSX
  2003-02-07 13:00         ` Damien Doligez
@ 2003-02-10  8:16           ` David Brown
  2003-02-10 18:47             ` Damien Doligez
  0 siblings, 1 reply; 11+ messages in thread
From: David Brown @ 2003-02-10  8:16 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list

On Fri, Feb 07, 2003 at 02:00:41PM +0100, Damien Doligez wrote:

> You can install 3.06 on MacOSX, without the signal bug, if you
> follow the instructions (and use the patch) given in this page:
> < http://caml.inria.fr/caml-macosx-howto/index.html >

Has anyone successfully gdb'd the bytecode interpreter under macosx?  I
don't seem to be able to set any breakpoints (I want to debug my C code
it calls).

Thanks,
Dave Brown
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] gdb with ocaml byte code on MacOSX
  2003-02-10  8:16           ` [Caml-list] gdb with ocaml byte code on MacOSX David Brown
@ 2003-02-10 18:47             ` Damien Doligez
  0 siblings, 0 replies; 11+ messages in thread
From: Damien Doligez @ 2003-02-10 18:47 UTC (permalink / raw)
  To: caml-list

On Monday, February 10, 2003, at 09:16 AM, David Brown wrote:

> Has anyone successfully gdb'd the bytecode interpreter under macosx?  I
> don't seem to be able to set any breakpoints (I want to debug my C code
> it calls).

I have no problems doing that, but I've only tried it on the debug
version of ocamlrun.  To build it:

cd .../byterun
make ocamlrund
cp ocamlrund /usr/local/bin/ocamlrun   (wherever you installed ocamlrun)
cp libcamlrund.a /usr/local/lib/ocaml/libcamlrun.a   (idem)
ranlib /usr/local/lib/ocaml/libcamlrun.a

Then you can compile with ocamlc and run your programs under gdb.
Be aware that the debug version is noticeably slower because the
memory manager does a lot of checking on its data structures.

-- Damien

-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-02-10 18:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-01 19:10 [Caml-list] xor on booleans Christoph Bauer
2003-02-03 13:31 ` Frederic De Jaeger
2003-02-03 14:02   ` Fabrice Le Fessant
2003-02-03 15:14     ` Frederic De Jaeger
2003-02-03 15:08       ` Fabrice Le Fessant
2003-02-04 17:29       ` Pierre Weis
2003-02-04 17:20     ` Pierre Weis
2003-02-06 14:39       ` Fabrice Le Fessant
2003-02-07 13:00         ` Damien Doligez
2003-02-10  8:16           ` [Caml-list] gdb with ocaml byte code on MacOSX David Brown
2003-02-10 18:47             ` Damien Doligez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).