caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem with Graph module
@ 2002-06-17  1:12 Nicolas FRANCOIS
  2002-06-17 13:23 ` Jun P.FURUSE
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas FRANCOIS @ 2002-06-17  1:12 UTC (permalink / raw)
  To: Caml List

A strange thing, under Linux : this piece of code :

open Graphics;;
open Random;;

type t_fourmi = {mutable dir : int;
		 mutable x : int;
		 mutable y : int};;

let trace_fourmi_deux_etats n =
  let mouvement = [|(0, 5); (-5, 0); (0, -5); (5, 0)|] in
  let init = open_graph " 800x800+50-50" in
  let ma_fourmi = {dir = 0; x = 349; y = 349} in
  let onestep () =
    if (point_color ma_fourmi.x ma_fourmi.y) = white
    then
      begin
	set_color black;
	ma_fourmi.dir <-
	if ma_fourmi.dir + 1 > 3 then 0 else ma_fourmi.dir + 1
      end
    else
      begin
	set_color white;
	ma_fourmi.dir <-
	if ma_fourmi.dir - 1 < 0 then 3 else ma_fourmi.dir - 1
      end;
    fill_rect ma_fourmi.x ma_fourmi.y 5 5;    
    let (dx, dy) = mouvement.(ma_fourmi.dir) in
      ma_fourmi.x <- ma_fourmi.x + dx;
      ma_fourmi.y <- ma_fourmi.y + dy;
  in
    init;
    for i = 0 to n do
      onestep ();
      for j = 1 to 10000 do begin end done
    done;;

trace_fourmi_deux_etats 10000;;


works perfectly in camllight (with a few modifications to adapt the code),
but not in Ocaml. The graphic window opens well, but the test 

if (point_color ma_fourmi.x ma_fourmi.y) = white

is allways false under Ocaml.

Can you see the problem ?????

Thanks.

-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code
-------------------
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] 16+ messages in thread

* (no subject)
  2002-06-17  1:12 [Caml-list] Problem with Graph module Nicolas FRANCOIS
@ 2002-06-17 13:23 ` Jun P.FURUSE
  2002-06-17 17:47   ` [Caml-list] Nicolas FRANCOIS
  0 siblings, 1 reply; 16+ messages in thread
From: Jun P.FURUSE @ 2002-06-17 13:23 UTC (permalink / raw)
  To: nicolas.francois; +Cc: caml-list

Hello,

> if (point_color ma_fourmi.x ma_fourmi.y) = white
> is allways false under Ocaml.

If the following code says "BUG" in your environment, I am afraid that
there is a bug inside the graphics library. In such case, could you
send me the result of the command xdpyinfo in your environment ? 

(* ocamlc -o testgraphics graphics.cma testgraphics.ml *)
open Graphics
let _ = 
    open_graph "";
    if point_color 0 0 = white then 
      prerr_endline "OK"
    else prerr_endline "BUG"
;;

--
Jun
-------------------
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] 16+ messages in thread

* [Caml-list] Re:
  2002-06-17 13:23 ` Jun P.FURUSE
@ 2002-06-17 17:47   ` Nicolas FRANCOIS
  2002-06-18  9:48     ` [Caml-list] Re: Problem with Graph module Jun P.FURUSE
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas FRANCOIS @ 2002-06-17 17:47 UTC (permalink / raw)
  To: Jun P.FURUSE; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Le Mon, 17 Jun 2002 15:23:09 +0200 (CEST) "Jun P.FURUSE"
<Jun.Furuse@inria.fr> a écrit :

> Hello,
> 
> > if (point_color ma_fourmi.x ma_fourmi.y) = white
> > is allways false under Ocaml.
> 
> If the following code says "BUG" in your environment, I am afraid that
> there is a bug inside the graphics library. In such case, could you
> send me the result of the command xdpyinfo in your environment ? 
> 
> (* ocamlc -o testgraphics graphics.cma testgraphics.ml *)
> open Graphics
> let _ = 
>     open_graph "";
>     if point_color 0 0 = white then 
>       prerr_endline "OK"
>     else prerr_endline "BUG"
> ;;

I received the bad answer :-(

You'll find the xdpyinfo output in attachment.

What can I do, boss ? Please !!!!!

\bye

-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code

[-- Attachment #2: xdpyinfo.out --]
[-- Type: application/octet-stream, Size: 9720 bytes --]

name of display:    :0.0
version number:    11.0
vendor string:    The XFree86 Project, Inc
vendor release number:    40100000
XFree86 version: 4.1.0
maximum request size:  4194300 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    7
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 4, bits_per_pixel 8, scanline_pad 32
    depth 8, bits_per_pixel 8, scanline_pad 32
    depth 15, bits_per_pixel 16, scanline_pad 32
    depth 16, bits_per_pixel 16, scanline_pad 32
    depth 24, bits_per_pixel 32, scanline_pad 32
    depth 32, bits_per_pixel 32, scanline_pad 32
keycode range:    minimum 8, maximum 255
focus:  window 0x180000e, revert to Parent
number of extensions:    26
    BIG-REQUESTS
    DOUBLE-BUFFER
    DPMS
    Extended-Visual-Information
    FontCache
    GLX
    LBX
    MIT-SCREEN-SAVER
    MIT-SHM
    MIT-SUNDRY-NONSTANDARD
    RENDER
    SECURITY
    SGI-GLX
    SHAPE
    SYNC
    TOG-CUP
    XC-APPGROUP
    XC-MISC
    XFree86-Bigfont
    XFree86-DRI
    XFree86-Misc
    XFree86-VidModeExtension
    XInputExtension
    XKEYBOARD
    XTEST
    XVideo
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1280x1024 pixels (433x347 millimeters)
  resolution:    75x75 dots per inch
  depths (7):    16, 1, 4, 8, 15, 24, 32
  root window id:    0x4d
  depth of root window:    16 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x20
  default number of colormap cells:    64
  preallocated pixels:    black 0, white 65535
  options:    backing-store NO, save-unders NO
  largest cursor:    64x64
  current input event mask:    0x58007f
    KeyPressMask             KeyReleaseMask           ButtonPressMask          
    ButtonReleaseMask        EnterWindowMask          LeaveWindowMask          
    PointerMotionMask        SubstructureNotifyMask   SubstructureRedirectMask 
    PropertyChangeMask       
  number of visuals:    32
  default visual id:  0x23
  visual:
    visual id:    0x23
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x24
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x25
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x26
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x27
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x28
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x29
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2a
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2b
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2c
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2d
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2e
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x2f
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x30
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x31
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x32
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x33
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x34
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x35
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x36
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x37
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x38
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x39
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3a
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3b
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3c
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3d
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3e
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x3f
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x40
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x41
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x42
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits

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

* [Caml-list] Re: Problem with Graph module
  2002-06-17 17:47   ` [Caml-list] Nicolas FRANCOIS
@ 2002-06-18  9:48     ` Jun P.FURUSE
  2002-06-18 17:01       ` Nicolas FRANCOIS
  0 siblings, 1 reply; 16+ messages in thread
From: Jun P.FURUSE @ 2002-06-18  9:48 UTC (permalink / raw)
  To: nicolas.francois; +Cc: caml-list, ecc, Andreas.Eder

Hello,

I thank people who sent their xdpyinfo result.

> Le Mon, 17 Jun 2002 15:23:09 +0200 (CEST) "Jun P.FURUSE"
> <Jun.Furuse@inria.fr> a écrit :
> 
> > Hello,
> > 
> > > if (point_color ma_fourmi.x ma_fourmi.y) = white
> > > is allways false under Ocaml.
> > 
> > If the following code says "BUG" in your environment, I am afraid that
> > there is a bug inside the graphics library. In such case, could you
> > send me the result of the command xdpyinfo in your environment ? 
> > 
> > (* ocamlc -o testgraphics graphics.cma testgraphics.ml *)
> > open Graphics
> > let _ = 
> >     open_graph "";
> >     if point_color 0 0 = white then 
> >       prerr_endline "OK"
> >     else prerr_endline "BUG"
> > ;;

I verified that this code prints out "BUG" when X display has less
than 24bits color depth. In such environment, the colour mapping from
Graphics to X is not one-to-one. This means that point_color may not
always return the exact colour which you drew on the screen. 
For example, in an X display of 15bpp, the Graphics colour 0xffffff
and 0xf8f8f8 are translated to the same X white colour. 
This is also true for the default white background color of Graphics. 
point_color returns 0xf8f8f8, not 0xffffff, this is why the above
code prints out "BUG".

In Camllight, the translation between Caml colour and X colour
performs communication between programs and the X server. Since it is
highly expensive operation, the colour translation of O'Caml Graphics
is rewritten, so that it would never ask the X server about
colours. It improves the speed of colour query impressively. 
Unfortunately, the both colour translation code do not return always
the same result. The different behavior of the Nicolas' O'Caml and
Camllight programs can be explained by this difference of colour
translation.

I think this does not mean the new colour translation of O'Caml is
buggy. Even in Camllight, the same things can happen, unless the colour
translation is one-to-one. (It happens less, but not never.)

The important things (which should be noted in graphics.mli) are that

  * you may get different colour index from one you draw, 

  * the colour indices predefined in Graphics for the basic colours 
    such as white, blue, red, etc can be just canonical candidate
    indices for them.

You should not compare these colour indices against the colours
got from the screen. For example, in Nicolas' program, instead of
comparing Graphics.white, we should use the colour index obtained
from the screen  at the begining of the program:

      let screen_white = point_color 0 0 
      (* this can be different from Graphics.white *)

Regards,
--
Jun
-------------------
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] 16+ messages in thread

* [Caml-list] Re: Problem with Graph module
  2002-06-18  9:48     ` [Caml-list] Re: Problem with Graph module Jun P.FURUSE
@ 2002-06-18 17:01       ` Nicolas FRANCOIS
  2002-06-18 23:21         ` Nicolas FRANCOIS
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas FRANCOIS @ 2002-06-18 17:01 UTC (permalink / raw)
  To: Jun P.FURUSE; +Cc: Caml List

Le Tue, 18 Jun 2002 11:48:31 +0200 (CEST) "Jun P.FURUSE"
<Jun.Furuse@inria.fr> a écrit :


> I verified that this code prints out "BUG" when X display has less
> than 24bits color depth. In such environment, the colour mapping from
> Graphics to X is not one-to-one. This means that point_color may not
> always return the exact colour which you drew on the screen. 
> For example, in an X display of 15bpp, the Graphics colour 0xffffff
> and 0xf8f8f8 are translated to the same X white colour. 
> This is also true for the default white background color of Graphics. 
> point_color returns 0xf8f8f8, not 0xffffff, this is why the above
> code prints out "BUG".

OK. Now I have this simple problem : I can use Direct Rendering from X
with my Voodoo card in 15 bits, and correct color translation in 24 bits.
is that right ?
 
> In Camllight, the translation between Caml colour and X colour
> performs communication between programs and the X server. Since it is
> highly expensive operation, the colour translation of O'Caml Graphics
> is rewritten, so that it would never ask the X server about
> colours. It improves the speed of colour query impressively. 
> Unfortunately, the both colour translation code do not return always
> the same result. The different behavior of the Nicolas' O'Caml and
> Camllight programs can be explained by this difference of colour
> translation.

Who said computer science is not an exact one ?
 
> I think this does not mean the new colour translation of O'Caml is
> buggy. Even in Camllight, the same things can happen, unless the colour
> translation is one-to-one. (It happens less, but not never.)
> 
> The important things (which should be noted in graphics.mli) are that
> 
>   * you may get different colour index from one you draw, 
> 
>   * the colour indices predefined in Graphics for the basic colours 
>     such as white, blue, red, etc can be just canonical candidate
>     indices for them.
> 
> You should not compare these colour indices against the colours
> got from the screen. For example, in Nicolas' program, instead of
> comparing Graphics.white, we should use the colour index obtained
> from the screen  at the begining of the program:
> 
>       let screen_white = point_color 0 0 
>       (* this can be different from Graphics.white *)

Great. Thanks for the tip. Euh, and what if I have to test several colors
? Oh, yes, here it is :

let screen_from_color c =
  set_color x;
  plot 0 0;
  point_color 0 0;;
 
Right ? I'll try it now.

\bye, and thanks again.

-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code
-------------------
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] 16+ messages in thread

* Re: [Caml-list] Re: Problem with Graph module
  2002-06-18 17:01       ` Nicolas FRANCOIS
@ 2002-06-18 23:21         ` Nicolas FRANCOIS
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas FRANCOIS @ 2002-06-18 23:21 UTC (permalink / raw)
  To: caml-list

Le Tue, 18 Jun 2002 19:01:39 +0200 Nicolas FRANCOIS (AKA El Bofo)
<nicolas.francois@free.fr> a écrit :

> Great. Thanks for the tip. Euh, and what if I have to test several
> colors? Oh, yes, here it is :
> 
> let screen_from_color c =
>   set_color x;
>   plot 0 0;
>   point_color 0 0;;
>  
> Right ? I'll try it now.

A better version (known to work, it ran just a few seconds ago in front of
my eyes ;-) :

let color_from_screen c =
  let o = point_color 0 0 in
    set_color c;
    plot 0 0;
    let s = point_color 0 0 in
      set_color o;
      plot 0 0;
      s;;

Just keep the place exactly in the same state you would like to find it...

Release 1.0 for monday.

Anyway, if you don't know the Langton ant, you should try it. It's
amazing. And the generalizes ones are not bad, too.

\bye

-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code
-------------------
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] 16+ messages in thread

* [Caml-list] RE :
  2021-04-07 11:50 [Caml-list] Fabien / maufred
@ 2021-04-07 12:50 ` Jean-Denis EIDEN
  0 siblings, 0 replies; 16+ messages in thread
From: Jean-Denis EIDEN @ 2021-04-07 12:50 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

unsubscribe



--
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

[-- Attachment #2: Type: text/html, Size: 1976 bytes --]

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

* [Caml-list] Re:
@ 2011-04-07 14:21 nathalielibertine
  0 siblings, 0 replies; 16+ messages in thread
From: nathalielibertine @ 2011-04-07 14:21 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/html, Size: 5315 bytes --]

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

* [Caml-list] Re:
  2004-08-23 20:27 briand
@ 2004-08-24  9:09 ` Damien Doligez
  0 siblings, 0 replies; 16+ messages in thread
From: Damien Doligez @ 2004-08-24  9:09 UTC (permalink / raw)
  To: briand; +Cc: caml-list

On Aug 23, 2004, at 22:27, briand@aracnet.com wrote:

> ~/src/ocaml/math $ ocaml
>         Objective Caml version 3.08.0
>
> # #load "const.cmo";;
> # Const.pi
>   ;;
> - : float = 3.14159265358979312
> #
>
>
> ~/src/ocaml/math $ cd ..
> ~/src/ocaml $ cd pll
> ~/src/ocaml/pll $ ocaml
>         Objective Caml version 3.08.0
>
> # #load "../math/const.cmo";;
> # Const.pi;;
> Unbound value Const.pi
>
> Huh ??

What is the type of Const.pi?  In order to answer this question, you 
have
to know the interface of module Const.  This interface lives in 
const.mli,
which is compiled to const.cmi.  It is automatically looked up in the
current directory, but not in ../math (unless you use option -I).

In other words, a module is composed of two things: its interface and
its implementation.  The interface is all you need to know at compile
time, while the implementation is all you need at execution time.  But
the toplevel does both compilation and execution, so it needs both.
The #load directive only provides the implementation.  You should also
add "../math" to the interface search path with the #directory 
directive:

# #load "../math/const.cmo";;
# #directory "../math";;
# Const.pi;;

-- 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] 16+ messages in thread

* [Caml-list] Re:
       [not found] <200404290855.i3T8sxxM001342@host2.route66.net>
@ 2004-04-29  8:55 ` alex
  0 siblings, 0 replies; 16+ messages in thread
From: alex @ 2004-04-29  8:55 UTC (permalink / raw)
  To: caml-list

This is an autoresponder. I'll never see your message.

-------------------
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] 16+ messages in thread

* [Caml-list] Re:
  2003-07-26  1:37 ` SooHyoung Oh
@ 2003-07-26  8:59   ` Nicolas Janin
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Janin @ 2003-07-26  8:59 UTC (permalink / raw)
  To: SooHyoung Oh, Matt Gushee, caml-list

It would be interesting to know how many people are directly interested by
such a project (provided that many people won't say they are interested, but
will eventually use such a library when it is in a mature state).

----- Original Message -----
From: "SooHyoung Oh" <shoh@duonix.com>
To: "Matt Gushee" <mgushee@havenrock.com>; <caml-list@pauillac.inria.fr>
Sent: Saturday, July 26, 2003 3:41 AM


> Subject: Re: [Caml-list] Graphics frustration
> Date: Sat, 26 Jul 2003 10:37:20 +0900
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 7bit
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Mailer: Microsoft Outlook Express 6.00.2600.0000
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
> X-Loop: caml-list@inria.fr
> X-Spam: no; 0.00; caml-list:01 gushee:01 mgushee:01 havenrock:01 all--:01
arc:99 ocamlplot:01 api:01 camlimages:01 englewood:01 manure:01
ignores:01 --lao:01 merel:01 bug:01
> Sender: owner-caml-list@pauillac.inria.fr
> Precedence: bulk
>
>
> What do you think about SVG (Selective Vector Graphics)?
> It uses only text for graphics as postscript so it's not difficult to use
> OCaml for SVG.
> If you interested about that, I'll send you a few examples.
>
> ---
> SooHyoung Oh
> ----- Original Message -----
> From: "Matt Gushee" <mgushee@havenrock.com>
> To: <caml-list@pauillac.inria.fr>
> Sent: Thursday, July 24, 2003 1:20 PM
> Subject: [Caml-list] Graphics frustration
>
>
> > Hello, all--
> >
> > I have been working on an application which will generate on-the-fly
> > graphics for the Web, but I have become very frustrated by the
> > limitations of the available graphics libraries for OCaml. If anyone
> > reading this thinks there are solutions I have overlooked, I would be
> > happy to discuss details. Right now, though, my purpose is to find out
> > whether others share my concerns, and how much interest there is in
> > developing better graphics libraries.
> >
> > What I would like to see is a single library with at least the
> > following capabilities:
> >
> >   * drawing primitives: line, rectangle, ellipse and/or arc, perhaps
> >     bezier curves
> >
> >   * rendering text with arbitrary Type 1 and/or TrueType fonts
> >
> >   * antialiasing
> >
> >   * basic image manipulation functions such as transformations,
> >     contrast adjustment, cropping, etc.
> >
> >   * saving to common bitmap formats such as JPEG and PNG
> >
> >   * cross-platform
> >
> > taking the various graphics packages together, all these capabilities
> > exist, but as far as I can tell there is no single package that combines
> > them all. So, in developing my application, I started out with
> > OCamlPlot, but discovered that it
> >
> >   - doesn't do antialiasing
> >
> >   - uses only 2 or 3 built-in fonts for PNG output
> >
> >   - has a rather rigid and idiosyncratic API
> >
> >   - doesn't run on Windows
> >
> > Then I decided to try MLgraph + Camlimages, which is an improvement, but
> > still falls short: MLgraph is excellent for drawing, but saves only to
> > PostScript--and I find the final result, converted to PNG with
> > CamlImages, rather unsatisfactory (the main problem is that antialiasing
> > doesn't work very well, which may actually be a Ghostscript issue).
> > Performance with this combination is also markedly poorer than with
> > OCamlPlot.
> >
> > Then there's OCamlGD, which seems quite promising. When complete, it
> > will probably satisfy all my requirements; but there hasn't been a
> > relesase in quite a while.
> >
> > So that's a quick summary of my situation. Do others agree with me that
> > this is a significant problem? Are there any good solutions in the
> > works?
> >
> > I am happy, by the way, to put some effort into developing something
> > better. My contribution would be limited, though (I'm not a C
> > programmer, for example, so I wouldn't be able to create a wrapper for
> > an existing C library.).
> >
> > Comments?
> >
> > --
> > Matt Gushee                 When a nation follows the Way,
> > Englewood, Colorado, USA    Horses bear manure through
> > mgushee@havenrock.com           its fields;
> > http://www.havenrock.com/   When a nation ignores the Way,
> >                             Horses bear soldiers through
> >                                 its streets.
> >
> >                             --Lao Tzu (Peter Merel, trans.)
> >
> > -------------------
> > 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
> >
>
> -------------------
> 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
> _____________________________________________________________________
> Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
> http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France

-------------------
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] 16+ messages in thread

* Re: [Caml-list] Re:
  2003-03-08  9:06 ` [Caml-list] Seth Kurtzberg
@ 2003-03-10 16:51   ` Brian Hurt
  0 siblings, 0 replies; 16+ messages in thread
From: Brian Hurt @ 2003-03-10 16:51 UTC (permalink / raw)
  To: Seth Kurtzberg; +Cc: Vee Satayamas, caml-list


They're teaching C++ as a first language these days.  You simply don't 
touch on the more complicated aspects of the language.  Or don't teach 
them until you're good and ready to teach them.

Brian

On Sat, 8 Mar 2003, Seth Kurtzberg wrote:

> My inclination is that this is perhaps not the best approach.  As OCaml is 
> using concepts and methods from a wide variety of languages, jumping straight 
> into OCaml might make it difficult for the student to understand and absorb 
> the different paradigms.
> 
> On Saturday 08 March 2003 01:53 am, Vee Satayamas wrote:
> > Hello,
> >
> > I 'm interested in using Caml as the
> > first language to teach student.
> > What is your opinion? Is there any
> > place use Caml as the first language
> > in programming course.
> >
> > Thank you,
> > Vee Satayamas
> >
> > =====
> > Please feel free to talk to me.
> > My homepage : http://www.geocities.com/liberalvee
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Everything you'll ever need on one web page
> > from News and Sport to Email and Music Charts
> > http://uk.my.yahoo.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
> 
> 

-------------------
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] 16+ messages in thread

* [Caml-list] Re:
  2003-03-08  8:53 Vee Satayamas
@ 2003-03-08  9:06 ` Seth Kurtzberg
  2003-03-10 16:51   ` Brian Hurt
  0 siblings, 1 reply; 16+ messages in thread
From: Seth Kurtzberg @ 2003-03-08  9:06 UTC (permalink / raw)
  To: Vee Satayamas, caml-list

My inclination is that this is perhaps not the best approach.  As OCaml is 
using concepts and methods from a wide variety of languages, jumping straight 
into OCaml might make it difficult for the student to understand and absorb 
the different paradigms.

On Saturday 08 March 2003 01:53 am, Vee Satayamas wrote:
> Hello,
>
> I 'm interested in using Caml as the
> first language to teach student.
> What is your opinion? Is there any
> place use Caml as the first language
> in programming course.
>
> Thank you,
> Vee Satayamas
>
> =====
> Please feel free to talk to me.
> My homepage : http://www.geocities.com/liberalvee
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.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

-- 
Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.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


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

* [Caml-list] Re:
  2002-10-19 17:14 climb
@ 2002-10-20 20:15 ` Alessandro Baretta
  0 siblings, 0 replies; 16+ messages in thread
From: Alessandro Baretta @ 2002-10-20 20:15 UTC (permalink / raw)
  To: climb, Ocaml

I must advise you to download the O'Reilly caml-book, and
read through it. The answers to all your questions are in there.

http://caml.inria.fr/oreilly-book/

Alex


climb wrote:
>  i am quite confused about the orgnization of source files.
> i have programmed with java . java has a simple rule to orgnize files: one file contains one class(public) or interface, and name of the file and the class  must be identical.
> 
> As to Ocaml.
> Does the file name of *.ml or mli has some similar relation ship with the content ?
>   for example , in the on-line manul
>   it says :
>   if complie like this
>   ocaml -c aux.mli
>   ocaml -c aux.ml
>   behaves exactly as if 
>   module Aux: sig (* contents of aux.mli*) end = struct (*contents of aux.ml*) end;;
>   in the toplevel
>   that seems to imply the exsiting fo some relationship , but i still has these questions:
> 1) can many modules be write in just one file ? 
>    maybe not , then how does classes?

Yes. Modules can contain modules. Every compilation unit
automatically defines a module. An ".mli" defines the
signature of the module defined ecapsulating the
corresponding ".ml".

> 2) Is the multi sigs with one struct  or multi structs  with one sig  compiled at a prper dependency can get the same result that like as in the toplevel?   should i write anther file to tell them how to assigning?

I don't understand what you mean.

> 3) take set.ml and set.mli for example which defined one functor: Make and two sigs : S and OrderedType.  But when we use , we use this command    Set.Make(..).       "Set" here seem can only get from the name of the file. So it seems the file name determined the library name .  Then how about the noraml module (not functor) case that if i define a module A with a funtion a(), in file b.ml and b.mli, how can i refer to a() in module A.  A.a() or B.A.a() or B.a()? 
> 

As I already pointed out, the compiler encapsulates every
".ml" in its own module declaration, where the name of the
module is equal to the name of file, with the first letter
capitalized. Therefore, if you can write

> (* File x.ml *)
>
> module Abc = struct
>   let function_of_abc () = ...
> end


> (* File y.ml *)
>
> let _ = X.Abc.function_of_abc ()



Alex

-------------------
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] 16+ messages in thread

* Re: [Caml-list] Re:
  2002-02-23 20:56 ` [Caml-list] Nicolas FRANCOIS
@ 2002-02-24 18:07   ` stalkern2
  0 siblings, 0 replies; 16+ messages in thread
From: stalkern2 @ 2002-02-24 18:07 UTC (permalink / raw)
  To: caml-list; +Cc: francois.hugel

Alle ore 15:56, sabato 23 febbraio 2002, Nicolas FRANCOIS (AKA El Bofo) ha 
scritto:
> Si tu es sous Linux, tu ne PEUX PAS faire autrement qu'utiliser emacs et
> le mode tuareg. La, c'est presque parfait (il faut bien laisser du travail
> aux developpeurs ;-) Si vraiment tu ne peux pas faire autrement, il existe
> aussi un mode specialise pour Vi.

Sous Linux il y a aussi le très bon et très simple éditeur de ocamlbrowser. 
Ocamlbrowser est le candidat outil de développement de ocaml, il est fourni 
avec la distribution standard, il permet à la fois de feuilleter la 
documentation, d'avoir un éditeur multi-pages et d'ouvrir des toplevels 
interactifs doués de mémoire des commandes exécutés.

Ciao
Ernesto
-------------------
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] 16+ messages in thread

* [Caml-list] Re:
  2002-02-17 16:05 francois.hugel
@ 2002-02-23 20:56 ` Nicolas FRANCOIS
  2002-02-24 18:07   ` stalkern2
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas FRANCOIS @ 2002-02-23 20:56 UTC (permalink / raw)
  To: francois.hugel; +Cc: caml-list

On Sun, 17 Feb 2002 17:05:02 +0100 (MET)
francois.hugel@free.fr wrote:

> Monsieur,
> j'ai le CD-ROM de l'INRIA avec le logiciel Caml Light, mais je ne sais
> pas comment accéder à un éditeur approprié pour taper des
> programmes.Pourriez-vous me renseigner,SVP, à l'adresse ci-dessous:
> francois.hugel@free.fr

Si tu es sous Window$, il suffit de lancer camlwin. Ca fait editeur (mal)
interactif, ca permet de se lancer. Assez rapidement, tu auras besoin d'un
editeur, si possible specialise. Tu trouveras cela sur le site de Caml
(pauillac.inria.fr/caml/), dans les ressources disponibles.

Si tu es sous Linux, tu ne PEUX PAS faire autrement qu'utiliser emacs et
le mode tuareg. La, c'est presque parfait (il faut bien laisser du travail
aux developpeurs ;-) Si vraiment tu ne peux pas faire autrement, il existe
aussi un mode specialise pour Vi.

Si tu es sos Mac... Heu, je ne sais pas.

\bye

-- 

                   Nicolas FRANCOIS
            http://nicolas.francois.free.fr
 A TRUE Klingon programmer does NOT comment his code
-------------------
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] 16+ messages in thread

end of thread, other threads:[~2021-04-07 12:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-17  1:12 [Caml-list] Problem with Graph module Nicolas FRANCOIS
2002-06-17 13:23 ` Jun P.FURUSE
2002-06-17 17:47   ` [Caml-list] Nicolas FRANCOIS
2002-06-18  9:48     ` [Caml-list] Re: Problem with Graph module Jun P.FURUSE
2002-06-18 17:01       ` Nicolas FRANCOIS
2002-06-18 23:21         ` Nicolas FRANCOIS
  -- strict thread matches above, loose matches on Subject: below --
2021-04-07 11:50 [Caml-list] Fabien / maufred
2021-04-07 12:50 ` [Caml-list] RE : Jean-Denis EIDEN
2011-04-07 14:21 [Caml-list] nathalielibertine
2004-08-23 20:27 briand
2004-08-24  9:09 ` [Caml-list] Damien Doligez
     [not found] <200404290855.i3T8sxxM001342@host2.route66.net>
2004-04-29  8:55 ` alex
2003-07-24  4:20 [Caml-list] Graphics frustration Matt Gushee
2003-07-26  1:37 ` SooHyoung Oh
2003-07-26  8:59   ` [Caml-list] Nicolas Janin
2003-03-08  8:53 Vee Satayamas
2003-03-08  9:06 ` [Caml-list] Seth Kurtzberg
2003-03-10 16:51   ` Brian Hurt
2002-10-19 17:14 climb
2002-10-20 20:15 ` [Caml-list] Alessandro Baretta
2002-02-17 16:05 francois.hugel
2002-02-23 20:56 ` [Caml-list] Nicolas FRANCOIS
2002-02-24 18:07   ` stalkern2

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