Re: [Caml-list] about OcamIL

2010-05-06 Thread Tim Hanson
lablGTK2 on linux is not fragile!  Its robust, well designed, and
produces nice guis!
(at least on debian.  props to the packagers and developers, if you're
listening)

On Wed, May 5, 2010 at 6:36 PM, ben kuin benk...@gmail.com wrote:
 I think the main problem is the lack of cross platform gui that looks
 good on windows.

 LablTk: ok only for simple gui
 LablGtk:    fragile on linux, bad on windows
 qt:      I once tried to create bindings for a newer qt release ( 
 4.2), I didn't finished it, but I think it would be doable. The big
 problem though is the huge qt dependency with this blackboxy C++/moc
 thing .

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Classes/objects with internal references to lists of objects of the same type

2010-02-05 Thread Tim Hanson
Hi All,

I'm trying to make two classes that have internal references to
themselves and each other, but can't figure it out. e.g:
---
class a_pad = object
val mutable parent_mod = new a_mod
val mutable connnected : 'a_pad list = []
end

class a_mod = object
val mutable pads : 'a_pad list = []
end
---
The a_pad objects need to call routines in their parent module, and
most importantly, they need to know what other pads they are connected
to.

I understand that this is possible with stuff like:
---
type expr = Mod of float * float * float * expr list
| Pad of float * float * float * expr * expr list
---
But that's quite cumbersome.  The imperative programming style is
useful here, since all the contained float data needs to change
constantly.  (the tree structure does not).

thank you in advance for your help.
Tim

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Favorite OCaml editor?

2010-01-05 Thread Tim Hanson
Hey All -

Yea, I used Emacs for a while, then Scite, now use Kate.  Not going
back either.  Love the code folding  ability to have many views of
the same file (like emacs), which is needed since you can't so easily
split modules across multiple files like C/C++.

Usually I open a gnu 'screen' session in the terminal, and split that
a few times for compiling and such.  I almost never use the debugger
.. maybe that's dumb, but it's less frustrating to use printfs.

While programming the limitation for me is brain-power and
understanding of the problem ...  clear thinking is so much better
than a high-powered editor that requires thought itself (cough..
emacs)

Tim

On Tue, Jan 5, 2010 at 7:21 AM, Florent Ouchet florent.ouc...@imag.fr wrote:
 Hi,

 I've used emacs+touareg for a while but as soon as the projects become big,
 I switched to kate. No way back...

 - Florent

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Lwt try_bind question...

2009-11-02 Thread Tim Hanson
Hi All,
I've been trying to use Lwt in my application (robot control).
(Background: there are 3 executables, all running simultaneously,
which communicate via sockets.  The ocaml program coordinates/controls
the video program and servo control program. )

In the file below, @ line 43 using the try_bind function I try to read
from the socket, and if it fails, wait 3 seconds before trying again.
But, I can't figure out how to make it compile.  I'm sorry if this is
fairly obvious, but the web has yet to turn up anything to fix it.
(perhaps it will in the future now :-)

I compile with the following line:
ocamlfind ocamlc -c -package lwt,lwt.unix,lwt.syntax -syntax camlp4o relay.ml

any advice will be much appreciated!

Tim

open Lwt

let new_socket () = Lwt_unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0
let local_addr num = Unix.ADDR_INET (Unix.inet_addr_any, num)

let _ =
Lwt_unix.run (
(* init a 'server' port for video prog to connect to *)
let video_socket = new_socket () in
Lwt_unix.setsockopt video_socket Unix.SO_REUSEADDR true;
Lwt_unix.bind video_socket (local_addr 4594);
Lwt_unix.listen video_socket 1;
(* init a 'client' address to connect to the servocontroller *)
let banger_socket = new_socket () in
Lwt_unix.setsockopt banger_socket Unix.SO_REUSEADDR true;
ignore_result(Lwt_unix.connect banger_socket (local_addr 4593));

let printo s = ignore_result(Lwt_io.printl s) in

(* Wait for a connection from video tracker*)
ignore_result(Lwt_unix.accept video_socket = (fun (inp, _) -
printo video socket connected!\n%!;
let buffer = String.create 512 in
(* set up a calibration sequence .. just to test *)
let rec calib () =
let msg = L\n in
ignore_result(Lwt_unix.write inp msg 0 
(String.length msg)) ;
Lwt_unix.read inp buffer 0 512 = (fun len -
let ss = String.sub buffer 0 len in
printo(got video data:^ss);
Lwt_unix.sleep 3.0 = calib
)
in
calib ()
));
(* simultaneously, read from the servocontroller *)
let buffer = String.create 512 in
let rec read_banger len =
if len  0 then (
let ss = String.sub buffer 0 len in
printo(got servo data:^ss)
);
try_bind
(fun () - (Lwt_unix.read banger_socket buffer 
0 512))
(fun n - read_banger n )
(fun _ - (Lwt_unix.sleep 3.0) = read_banger 
0 )
in
read_banger 0
)

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs