flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Kerris7 has joined #ocaml
fschwidom has quit [Remote closed the connection]
vixey has quit [Network is unreachable]
psnively has quit []
Amorphous has quit [Read error: 60 (Operation timed out)]
Kerris7 has quit []
paul424 has joined #ocaml
Amorphous has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
<paul424> hey I have a type # type 'a t = {mutable my_array:'a option array ,array_size: int,mutable p: int, mutable q: int } ;; and then # let empty size = (my_array: (Array.make size None), array_size: size, p: 0 ,q: 0);; does not work
hkBst has quit [Read error: 104 (Connection reset by peer)]
<flux> paul424, you should you separate fields with ;, not ,
<paul424> yeap I noticed that already, thanks anyway ....
<paul424> solved the probolem long ago ;)
<flux> yeah, one should hope that kind of problem wouldn't last for too long :)
<paul424> hehhe :)
<paul424> flux: are u there ? could u have a look on something, cause I have problem with type system
<flux> well, try me
<paul424> I just used the 'a option to have greater flexiblity but when I want to use my_function(43, structure) I get : structure is of type 'a option not int option
<paul424> http://rafb.net/p/3jT06963.html code is like this
<paul424> in last line I get error: This expression has type int * 'a CyclicQueue.t but is here used with type int * int CyclicQueue.t
<flux> your code compiles due to my not being defined
<flux> if I "fix" it with let rec my I get a different error
<flux> (I get File "bar.ml", line 38, characters 54-61:This expression has type int * ('a * 'b * 'c) but is here used with type int * int CyclicQueue.t)
<flux> uh, I meant to say "your code doesn't compile due to my not being defined"
<paul424> mh,,,,
<paul424> hmm ...
<flux> let my = CyclicQueue.empty 54,CyclicQueue.enqueue(43,my),CyclicQueue.enqueue(23,my) - as you can see, my isn't defined before that line, thus it isn't visible in the definition, thus it cannot be compiled
<paul424> ohh I am so clumsy when it comes to program in ocaml ... how should I define it ?
<flux> are you trying to define a recursive type?
<paul424> NOOOO
<flux> I mean, a value
munga has joined #ocaml
<paul424> no
<paul424> it is the implemnetation of cyclic list
<flux> so is let rec my = .. what you're looking for?
<flux> in any case that kind of construction doesn't make 'my' compatible with the definition of QUEUE_FUN..
<paul424> I want to use the impereative style of ocaml
<flux> oh
<flux> perhaps then you want to do let my = CyclicQueue.empty;; CyclicQueue.enqueue(43,my);; etc
<paul424> oh ok thanks ;)
<paul424> what is the way to print something ... the print function or what ?
Associat0r has quit []
alexyk has quit []
alexyk has joined #ocaml
<flux> well, there's a bunch of print functions
<flux> print_string, print_endline, print_int, etc
<flux> or you can use the Printf module
Megzlna has left #ocaml []
<paul424> ok thanks
paul424 has quit ["ChatZilla 0.9.83 [Firefox 3.0.4/2008102920]"]
Mr_Awesome has joined #ocaml
cataska has quit [kornbluth.freenode.net irc.freenode.net]
bohanlon has quit [kornbluth.freenode.net irc.freenode.net]
cataska has joined #ocaml
bohanlon has joined #ocaml
alexyk has quit []
sporkmonger has joined #ocaml
alexyk has joined #ocaml
<hcarty> alexyk: If you are still looking for how pass a list in to C, check out this tutorial: http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php
alexyk_ has joined #ocaml
gaja has quit ["leaving"]
gaja has joined #ocaml
alexyk has quit [Read error: 110 (Connection timed out)]
seafood has joined #ocaml
alexyk_ has quit []
alexyk has joined #ocaml
sporkmonger has quit []
alexyk has quit []
alexyk has joined #ocaml
alexyk_ has joined #ocaml
alexyk has quit [Read error: 110 (Connection timed out)]
apples` has quit ["sleep"]
alexyk_ has quit []
Mr_Awesome has quit ["aunt jemima is the devil!"]
r0bby has quit [Connection timed out]
alexyk has joined #ocaml
Snark has joined #ocaml
alexyk has quit []
jonafan_ has joined #ocaml
xahlee has joined #ocaml
alexyk has joined #ocaml
xahlee has quit ["banned in #emacs by johnsu01 (john sullivan)"]
jonafan has quit [Read error: 110 (Connection timed out)]
Kerris7 has joined #ocaml
alexyk has quit []
Kerris7 has quit ["Who is Candlejack? Is he going to c"]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
Snark has quit ["Ex-Chat"]
Kerris7 has joined #ocaml
m3ga has joined #ocaml
m3ga has quit [Remote closed the connection]
seafood has quit []
Kerris7_ has joined #ocaml
Kerris7 has quit [Read error: 54 (Connection reset by peer)]
_zack has joined #ocaml
rwmjones_ has joined #ocaml
asabil has joined #ocaml
_zack has quit ["Leaving."]
_zack has joined #ocaml
ikaros has joined #ocaml
Kerris7 has joined #ocaml
Kerris7_ has quit [Read error: 54 (Connection reset by peer)]
olgen has joined #ocaml
marmotine has joined #ocaml
Kerris7_ has joined #ocaml
Kerris7 has quit [Read error: 54 (Connection reset by peer)]
asabil has quit ["Ex-Chat"]
vixey has joined #ocaml
Kerris7_ has quit [Read error: 60 (Operation timed out)]
hkBst has joined #ocaml
Yoric[DT] has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
Kerris7 has joined #ocaml
ikaros has quit [".quit"]
glondu has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
seafood has joined #ocaml
asabil has joined #ocaml
slash_ has joined #ocaml
seafood_ has joined #ocaml
itewsh has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
seafood has joined #ocaml
Gionne has quit ["Leaving"]
seafood has quit [Read error: 60 (Operation timed out)]
seafood_ has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
thelema has joined #ocaml
seafood has joined #ocaml
Kerris7 has quit []
seafood has quit [Read error: 60 (Operation timed out)]
Kerris7 has joined #ocaml
seafood has joined #ocaml
Kerris7 has quit []
willb has quit [Read error: 110 (Connection timed out)]
Kerris7 has joined #ocaml
seafood_ has joined #ocaml
itewsh has quit ["KTHXBYE"]
seafood has quit [Read error: 110 (Connection timed out)]
asabil has quit [Read error: 104 (Connection reset by peer)]
asabil has joined #ocaml
_zack has quit [Read error: 60 (Operation timed out)]
Gionne has joined #ocaml
Mr_Awesome has joined #ocaml
willb has joined #ocaml
seafood_ has quit []
<Gionne> http://pastebin.com/m6b2507f8 how do i pass the second parameter to the List.map?
<flux> hmm
<flux> I'm thinking you don't know what the first function definition does, or atleast that's a very curious way to write it
<flux> let first g = fun to_pair(x, sl) -> (x, first_s g [] sl) ;; that is
<flux> because if you want that to refer to some existing to_pair, well, that doesn't
<Gionne> mm
<Gionne> i have to apply it to a Prod(s, sl)
slash_ has quit [Read error: 110 (Connection timed out)]
Associat0r has joined #ocaml
alexyk has joined #ocaml
Kerris7 has quit []
Kerris7 has joined #ocaml
Kerris7 has quit [Client Quit]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Optikal_ has quit ["leaving"]
jeremiah has joined #ocaml
hcarty has quit [Read error: 104 (Connection reset by peer)]
ikaros has joined #ocaml
asabil has quit ["Ex-Chat"]
ikaros has quit [".quit"]
marmotine has quit ["mv marmotine Laurie"]
* alexyk joined the ranks of godi-less since getting 3.11
olgen has quit []
Snark has joined #ocaml
Anarchos has joined #ocaml
alexyk has quit []
<Gionne> how do i write a generic string value? http://pastebin.com/m1aa650f5
rwmjones_ has quit [Read error: 104 (Connection reset by peer)]
<flux> what?
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
<Gionne> if i have a Var (any string) in input i have to remove it
<Gionne> not in input, in the list
<Gionne> i have a list of symbol which can be Term, Epsilon or Var
<Gionne> i have to keep just the first 2
<vixey> Gionne, why are you doinfg this?
<vixey> Gionne, Do you know Shunting Yard algorithm?
<Gionne> nope
<flux> gildor, well, doesn't your function do that?
<Gionne> nope
<Gionne> doesn't compile
<Gionne> syntax error here: "*"
alexyk has joined #ocaml
<flux> if I add type v = Var of string to the beginning, it works just fine
<flux> ah, right
<flux> you want to match something else than string "*"
<Gionne> yes
<Gionne> but now i noticed i need those results, there's something wrong before that
glondu has joined #ocaml
<Gionne> thanx, i also found the other error
<Gionne> ;)
<alexyk> I have a choice: to have a list of handles, or wrap handles in objects and have lists of objects; is there much overhead from having lists of objects? are they represented as pointers internally, or blocks which are copied?
<gildor> flux: you keep calling me ;-)
<flux> gildor, I wonder why, though.. I need to focus on what I press next time I respond to gionne, but irssi should pick gionned when I hit "gi<tab>" if gionne has talked last time
<flux> ;)
<alexyk> hmm, noone uses objects around here, but they're sheer goodness, actually
<flux> I use objects
<flux> at times
<alexyk> flux: cool! so how about lists of objects, are they expensive?
<flux> alexyk, expensive in what sense?
<alexyk> creating/destroying lists of objects vs list of ints
<alexyk> passing around to functions
<flux> well, surely they are more expensive
<flux> passing an object is just as expensive as passing anything (even an int)
<alexyk> flux: are the whole objects passed or are they pointers?
<flux> I think a better comparison would be against a record of closures
<flux> alexyk, they are behind a pointer ("boxed"), as is everything in ocaml, except primitive types
<alexyk> basically I can use an int handle or wrap it in object, and weigh abstraction vs efficiency
<alexyk> flux: so passing a tuple (string, int) is as expensive as passing an object pointer?
<flux> yes
Yoric[DT] has joined #ocaml
Camarade_Tux has joined #ocaml
<Yoric[DT]> hi
<flux> alexyk, the other side of the coin is obviously that mutations to the object go everywhere where there is a reference to it
<alexyk> flux: well. it's a good thing :)
<flux> in any case, if you wanted const methods to an object, you could use phantom types to have those :)
<flux> ..it would make all methods polymorphic, though..
<flux> (perhaps it'd be simpler to provide another version of the object, with the mutation methods removed)
blue_prawn has joined #ocaml
<flux> ooh
<flux> perhaps the christmas time would be nice time to really check that out
<flux> were jocaml and ocaml libraries binary compatible?
Associat0r has quit [Read error: 104 (Connection reset by peer)]
<mfp> flux: yes, same version number == binary compatible
<mfp> (rather => :)
<flux> mfp, so, ocaml libraries work with jocaml.. but obviously not vice versa?
<mfp> flux: JoCaml will detect at build time the "companion OCaml" and configure things so that its libs are used automatically
<mfp> I'm not sure, depends on how JoCaml has modified the runtime
<flux> perhaps the types required to make use of jocaml magic just aren't possible to construct in ocaml
<flux> that'd be very graceful degration
<mfp> if the changes are self-contained (only in the .cmx / .o), it might work, as long as no channels or anything are exposed in the interface
<flux> (+da)
<flux> perhaps, or perhaps not :)
<flux> but I think this release sort of shows that the jocaml guys are serious about the branch
<mfp> I have jocaml 3.10.0 & ocaml 3.10.2, if they work well together it'll be quite a surprise /me tries
sporkmonger has joined #ocaml
<flux> "Jocaml 3.10.0 should be binary compatible with ocaml 3.10.2 (but includes thebugs patched from 3.10.0 to 3.10.2)"
<flux> mfp, have you otherwise played around with jocaml?
<flux> I wonder if one could rewrite for example lwt to just magically work with it
<flux> the jocaml abstractions being hidden under the library
<flux> or cothreads - that might be more difficult
<mfp> there should be some sort of standard template for release ANNs
<mfp> + mandatory blog entry or something
<mfp> when something is released in Haskell-land, reddittors get to chose between (or see all of) the mailing list ANN, the hackage upload page, the project page & the blog entry
Yoric[DT] has quit ["Ex-Chat"]
bzzbzz has joined #ocaml
hcarty has joined #ocaml
<rwmjones> gildor, ping ... I don't know if it was my imagination, but does ocamlcore have a place for "useful code snippets", ie. smaller than a module/package, but larger than a one-liner?
<rwmjones> gildor, that is to say, I thought ocamlcore did but maybe I was imagining it :-)
<flux> put them all into a library called RwmCore?-)
<rwmjones> JonesCore, like JonesForth maybe ...
<rwmjones> we actually had 'merjislib'
<rwmjones> quite useful ...
<blue_prawn> if it's your imagination, it would be a good idea to create it
<alexyk> mfp: your solution to add Gc.finalise didn't work for me... runtime complaint! So if I have a method destroy, and in initializer say Gc.finalise destroy, destroy doesn't exit there yet; saying self#destroy instead, compiles and doesn't run
<mfp> alexyk: did you see Alain Frisch's reply?
<mfp> alexyk: Gc.finalise won't work for immediate values
<mfp> such as ints
<alexyk> mfp: ah...
<mfp> a trivial workaround is to do for instance val h = (handle, handle) and use Gc.finalise on it
<mfp> with (fun (x, _) -> destroy x)
<mfp> you have to be careful when you define the finalizer
<alexyk> mfp: the whole idea of objects suddenly dims -- I had either int ports or int handles, and really could have either, will probably go back to objectlessness
<mfp> because the closure you give to Gc.finalise could hold a reference to the value, meaning it'd never be collected
<mfp> using objects or not depends on how you intend to use those values later
<mfp> if you want to use row polymorphism or not
<mfp> or if you need late binding to be able to redefine some methods
<mfp> it's largely orthogonal to the handle management thing
<alexyk> mfp: true; in my app, it's just a convenience
blue_prawn has quit ["Client exiting"]
<rwmjones> gildor, thanks
<rwmjones> gildor, https://forge.ocamlcore.org/snippet/detail.php?type=snippet&id=5 ... you ought to have a "Public Domain" option there
<gildor> rwmjones: submit a bug against "Site Admin" project if you are really missing "Public Domain" ;-)
* rwmjones decided to tackle the 'email problem' once and for all today
<rwmjones> I subscribe to 150 mailing lists, so an ocaml program is going to monitor those lists and prioritize messages for me
<mfp> 150!
<mfp> uh then again I'm subscribed to 50 and I hadn't realized it :P
<rwmjones> it's not that many, but it's impossible to keep track of
<rwmjones> so I want a program which keeps track of all the threads (even crossing groups)
<rwmjones> and notifies me when stuff comes in which is:
<rwmjones> - in a thread that I've previously commented in
<rwmjones> - new threads in certain "must-read" groups
<rwmjones> and various other criteria
<mfp> "- in a thread that I've previously commented in" seems a very good idea
ulfdoz_ is now known as ulfdoz
* mfp takes a quick look at mutt's manual to see if it's there somewhere
<palomer> 150!
<rwmjones> mfp, mutt doesn't really handle multiple folders that well
* rwmjones is a mutt user, obviously
<mfp> maybe some hack involving message scoring
<mfp> but just having some process drop the relevant msgs to a specific folder might be easier
Gionne has quit ["Leaving"]
asabil has joined #ocaml
Stefan_vK has joined #ocaml
jonafan_ is now known as jonafan
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
<alexyk> how do you time execution in toplevel? I'm playing prelude.ml's parallel combinators and want to measure speedups
<alexyk> rwmjones: how about setting all to no delivery ? :)
<flux> alexyk, I've used Unix.gettimeofday, but I suppose Unix.times would be better
<flux> or perhaps using both?
<alexyk> wow! it works!
<flux> and then write a function like let timing f = let t0 = .. in f (); let t1 = .. in Printf.. (t1 -. t0) etc
<alexyk> List.map (fun x -> Unix.sleep 1; x) [1;2;3;4];; (* 4 seconds by wallclock *)
<alexyk> par_map (fun x -> Unix.sleep 1; x) [1;2;3;4];; (* 2 seconds! *)
<alexyk> flux: I avoided it by using Unix.sleep :)
<alexyk> flux: when I need something more subtle, I will use Unix.times...
<alexyk> but I wish there was a prefix which is type-agnostic, to time f x y z ...
<alexyk> this should really be a feature of toplevel
<alexyk> toggle timings on
vixey has quit [Remote closed the connection]
<flux> alexyk, well, if you have it like let timing f a = .. then you can call it timing (f x y) z
<hcarty> or "timing (fun () -> f x y z)"
r0bby has joined #ocaml
vixey has joined #ocaml
palomer has quit [Remote closed the connection]
yziquel has joined #ocaml
jlouis has joined #ocaml
seafood has joined #ocaml
seafood_ has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
seafood_ has quit []
alexyk has quit []
kig has joined #ocaml
ikaros has joined #ocaml
alexyk has joined #ocaml
seafood has joined #ocaml
jackie_ has joined #ocaml
apples` has joined #ocaml
alexyk has quit []
jackie_ has quit [Client Quit]
willb has quit [Read error: 110 (Connection timed out)]
ikaros has quit [".quit"]
Yoric[DT] has joined #ocaml
vixey has quit [Remote closed the connection]
anryx has joined #ocaml
apples` has quit [Read error: 104 (Connection reset by peer)]
apples` has joined #ocaml