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
monadic_kid has quit ["Leaving"]
psnively has quit []
AxleLonghorn has left #ocaml []
Camarade_Tux has quit ["Leaving"]
mikaz has left #ocaml []
Ariens_Hyperion has quit []
ozzloy has quit ["leaving"]
ozzloy has joined #ocaml
ched_ has joined #ocaml
ched__ has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit [Remote closed the connection]
ulfdoz has joined #ocaml
ulfdoz has quit [Remote closed the connection]
ulfdoz_ has joined #ocaml
hsuh has joined #ocaml
mjambon has quit ["Leaving."]
vuln has joined #ocaml
kaustuv has quit [Remote closed the connection]
kaustuv has joined #ocaml
mjonsson has quit [Read error: 113 (No route to host)]
mjonsson has joined #ocaml
deech has quit [Read error: 104 (Connection reset by peer)]
deech has joined #ocaml
vuln has quit ["leaving"]
T_S_ has joined #ocaml
hcarty has quit [Remote closed the connection]
hcarty has joined #ocaml
Camarade_Tux has joined #ocaml
seafood has joined #ocaml
mal`` has quit [Read error: 60 (Operation timed out)]
mal`` has joined #ocaml
seafood has quit []
Alpounet has joined #ocaml
mlbot has joined #ocaml
Skolem has quit [hubbard.freenode.net irc.freenode.net]
lutter has quit [hubbard.freenode.net irc.freenode.net]
dav has quit [hubbard.freenode.net irc.freenode.net]
gl has quit [hubbard.freenode.net irc.freenode.net]
bebui has quit [hubbard.freenode.net irc.freenode.net]
mjonsson has quit [hubbard.freenode.net irc.freenode.net]
hsuh has quit [hubbard.freenode.net irc.freenode.net]
Amorphous has quit [hubbard.freenode.net irc.freenode.net]
det has quit [hubbard.freenode.net irc.freenode.net]
patronus has quit [hubbard.freenode.net irc.freenode.net]
mellum has quit [hubbard.freenode.net irc.freenode.net]
smimram has quit [hubbard.freenode.net irc.freenode.net]
\xs has quit [hubbard.freenode.net irc.freenode.net]
delroth has quit [hubbard.freenode.net irc.freenode.net]
mfp has quit [hubbard.freenode.net irc.freenode.net]
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
rumbleca has quit [hubbard.freenode.net irc.freenode.net]
gildor has quit [hubbard.freenode.net irc.freenode.net]
sbok has quit [hubbard.freenode.net irc.freenode.net]
munga has quit [hubbard.freenode.net irc.freenode.net]
prigaux has quit [hubbard.freenode.net irc.freenode.net]
acatout has quit [hubbard.freenode.net irc.freenode.net]
steg has quit [hubbard.freenode.net irc.freenode.net]
brendan has quit [hubbard.freenode.net irc.freenode.net]
mattam has quit [hubbard.freenode.net irc.freenode.net]
haelix_ has quit [hubbard.freenode.net irc.freenode.net]
Alpounet has quit [hubbard.freenode.net irc.freenode.net]
Mr_Awesome has quit [hubbard.freenode.net irc.freenode.net]
mrvn has quit [hubbard.freenode.net irc.freenode.net]
bjorkintosh has quit [hubbard.freenode.net irc.freenode.net]
r0bby has quit [hubbard.freenode.net irc.freenode.net]
palomer has quit [hubbard.freenode.net irc.freenode.net]
olegfink has quit [hubbard.freenode.net irc.freenode.net]
mbishop has quit [hubbard.freenode.net irc.freenode.net]
mlbot has quit [hubbard.freenode.net irc.freenode.net]
ulfdoz_ has quit [hubbard.freenode.net irc.freenode.net]
authentic has quit [hubbard.freenode.net irc.freenode.net]
hto has quit [hubbard.freenode.net irc.freenode.net]
bacam has quit [hubbard.freenode.net irc.freenode.net]
oof has quit [hubbard.freenode.net irc.freenode.net]
bartiosze has quit [hubbard.freenode.net irc.freenode.net]
totom has quit [hubbard.freenode.net irc.freenode.net]
sanguinev has quit [hubbard.freenode.net irc.freenode.net]
hcarty has quit [hubbard.freenode.net irc.freenode.net]
ched_ has quit [hubbard.freenode.net irc.freenode.net]
Fullma` has quit [hubbard.freenode.net irc.freenode.net]
T_S_ has quit [hubbard.freenode.net irc.freenode.net]
BiD0rD has quit [hubbard.freenode.net irc.freenode.net]
pants1 has quit [hubbard.freenode.net irc.freenode.net]
mishok13 has quit [hubbard.freenode.net irc.freenode.net]
ozzloy has quit [hubbard.freenode.net irc.freenode.net]
hlab has quit [hubbard.freenode.net irc.freenode.net]
Pepe_ has quit [hubbard.freenode.net irc.freenode.net]
jknick has quit [hubbard.freenode.net irc.freenode.net]
jedai has quit [hubbard.freenode.net irc.freenode.net]
holgr has quit [hubbard.freenode.net irc.freenode.net]
ReinH has quit [hubbard.freenode.net irc.freenode.net]
bohanlon has quit [hubbard.freenode.net irc.freenode.net]
Asmadeus has quit [hubbard.freenode.net irc.freenode.net]
xevz has quit [hubbard.freenode.net irc.freenode.net]
tab has quit [hubbard.freenode.net irc.freenode.net]
Hadaka has quit [hubbard.freenode.net irc.freenode.net]
jlouis has quit [hubbard.freenode.net irc.freenode.net]
jeremiah has quit [hubbard.freenode.net irc.freenode.net]
Demitar has quit [hubbard.freenode.net irc.freenode.net]
tarbo2 has quit [hubbard.freenode.net irc.freenode.net]
kelaouchi has quit [hubbard.freenode.net irc.freenode.net]
flux has quit [hubbard.freenode.net irc.freenode.net]
petchema_ has quit [hubbard.freenode.net irc.freenode.net]
ppsmimou has quit [hubbard.freenode.net irc.freenode.net]
ski__ has quit [hubbard.freenode.net irc.freenode.net]
aij has quit [hubbard.freenode.net irc.freenode.net]
tsuyoshi has quit [hubbard.freenode.net irc.freenode.net]
gim has quit [hubbard.freenode.net irc.freenode.net]
tomaw has quit [hubbard.freenode.net irc.freenode.net]
mal`` has quit [hubbard.freenode.net irc.freenode.net]
deech has quit [hubbard.freenode.net irc.freenode.net]
kaustuv has quit [hubbard.freenode.net irc.freenode.net]
Camarade_Tux has quit [hubbard.freenode.net irc.freenode.net]
ertai has quit [hubbard.freenode.net irc.freenode.net]
l_a_m has quit [hubbard.freenode.net irc.freenode.net]
sgnb has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
mlbot has joined #ocaml
Alpounet has joined #ocaml
mal`` has joined #ocaml
Camarade_Tux has joined #ocaml
hcarty has joined #ocaml
T_S_ has joined #ocaml
deech has joined #ocaml
mjonsson has joined #ocaml
kaustuv has joined #ocaml
hsuh has joined #ocaml
ulfdoz_ has joined #ocaml
ched_ has joined #ocaml
ozzloy has joined #ocaml
hlab has joined #ocaml
BiD0rD has joined #ocaml
Fullma` has joined #ocaml
smimram has joined #ocaml
palomer has joined #ocaml
Mr_Awesome has joined #ocaml
Amorphous has joined #ocaml
l_a_m has joined #ocaml
bjorkintosh has joined #ocaml
mrvn has joined #ocaml
r0bby has joined #ocaml
lutter has joined #ocaml
dav has joined #ocaml
bebui has joined #ocaml
Skolem has joined #ocaml
gl has joined #ocaml
ReinH has joined #ocaml
\xs has joined #ocaml
xevz has joined #ocaml
flux has joined #ocaml
det has joined #ocaml
jeremiah has joined #ocaml
pants1 has joined #ocaml
olegfink has joined #ocaml
mfp has joined #ocaml
patronus has joined #ocaml
mellum has joined #ocaml
acatout has joined #ocaml
authentic has joined #ocaml
Pepe_ has joined #ocaml
Demitar has joined #ocaml
delroth has joined #ocaml
tarbo2 has joined #ocaml
mbishop has joined #ocaml
tab has joined #ocaml
sgnb has joined #ocaml
jknick has joined #ocaml
rumbleca has joined #ocaml
hto has joined #ocaml
TaXules has joined #ocaml
mishok13 has joined #ocaml
Ori_B has joined #ocaml
steg has joined #ocaml
mattam has joined #ocaml
brendan has joined #ocaml
gildor has joined #ocaml
sbok has joined #ocaml
prigaux has joined #ocaml
munga has joined #ocaml
haelix_ has joined #ocaml
bacam has joined #ocaml
tsuyoshi has joined #ocaml
ski__ has joined #ocaml
Hadaka has joined #ocaml
ppsmimou has joined #ocaml
tomaw has joined #ocaml
petchema_ has joined #ocaml
gim has joined #ocaml
Asmadeus has joined #ocaml
jlouis has joined #ocaml
aij has joined #ocaml
holgr has joined #ocaml
bohanlon has joined #ocaml
jedai has joined #ocaml
kelaouchi has joined #ocaml
oof has joined #ocaml
totom has joined #ocaml
bartiosze has joined #ocaml
sanguinev has joined #ocaml
ertai has joined #ocaml
Snark has joined #ocaml
<Camarade_Tux> kaustuv, 19:8b81ecb2a22f makes Show crash on my computer with SIG -10 (SIGBUS)
<ched_> k
komar_ has joined #ocaml
monadic_kid has joined #ocaml
smimou_ has joined #ocaml
smimram has quit [Read error: 110 (Connection timed out)]
ched_ has quit [Remote closed the connection]
ztfw has joined #ocaml
monadic_kid has quit ["Leaving"]
Ched has joined #ocaml
komar_ has quit [Remote closed the connection]
ztfw` has joined #ocaml
ztfw has quit [Read error: 110 (Connection timed out)]
jeanbon has joined #ocaml
Fullma has joined #ocaml
zerny has joined #ocaml
ChristopheT has joined #ocaml
<kaustuv> Camarade_Tux: trying to render what sort of data structure?
Fullma` has quit [Read error: 110 (Connection timed out)]
Christop` has joined #ocaml
Christop` has left #ocaml []
jeanbon has quit [Read error: 113 (No route to host)]
ztfw`` has joined #ocaml
komar_ has joined #ocaml
ztfw` has quit [Read error: 60 (Operation timed out)]
jeanbon has joined #ocaml
Yoric[DT] has joined #ocaml
T_S_ has quit []
monadic_kid has joined #ocaml
Christop` has joined #ocaml
Christop` has left #ocaml []
zerny has quit [Read error: 110 (Connection timed out)]
Christop` has joined #ocaml
Christop` has left #ocaml []
<Camarade_Tux> kaustuv, anything. () or 42 for instance
maskd has joined #ocaml
ChristopheT has left #ocaml []
hlab has quit [Read error: 60 (Operation timed out)]
hlab has joined #ocaml
bzzbzz has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
Yoric[DT] has quit ["Ex-Chat"]
Anarchos has joined #ocaml
<Anarchos> how to print the environment of a Parse_error in ocamlyacc ?
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
_yziquel has joined #ocaml
jeanbon has quit ["EOF"]
jeanbon has joined #ocaml
Amorphous has quit [Read error: 104 (Connection reset by peer)]
jeanbon has quit [Client Quit]
jeanbon has joined #ocaml
<_yziquel> > List.map (let n = ref false in let l = lazy (if !n then raise Not_found) in fun _ -> (n := not !n; try (Lazy.force l; true) with Not_found -> false)) [();();()];;
<mlbot> - : bool list = [false; false; false]
<_yziquel> Is there way to have [false; true; true] instead?
<_yziquel> I mean, having the exception not recorded in the lazy structure?
Yoric[DT] has joined #ocaml
<flux> man that's some complicated code :)
<flux> _yziquel, how would you like it to work?
Amorphous has joined #ocaml
<mrvn> flux: for Lazy.force to evaluate again and again till it doesn't throw an exception
<_yziquel> mrvn: yep
<mrvn> No Lazy.force_again in the module that i can see.
<olegfink> because once forced, the result replaces the original thunk iiuc
<flux> ah, right
<_yziquel> it would be quite useful to be able to cut off the lazy computation, for whatever reason, and to have it done again later on...
<_yziquel> so a dedicated exception for that would be nice in the Lazy module.
<olegfink> sounds a bit like continuation to me.
kaustuv has quit [Remote closed the connection]
kaustuv has joined #ocaml
<olegfink> hrm
* olegfink doesn't completely understand the comments in lazy.ml
<mrvn> olegfink: continuations would resume the computation and not redo them.
<olegfink> mrvn: but isn't that what amb does?
<_yziquel> what's amb?
komar_ has joined #ocaml
<olegfink> non-deterministic choice
<olegfink> an ocaml-related discussion is at http://okmij.org/ftp/ML/ML.html#amb
<monadic_kid> amb short for ambiguous
<flux> _yziquel, well, a module similar to Lazy isn't difficult to write yourself: module Lazy' : sig type 'a t val lazy' : (unit -> 'a) -> 'a t val force : 'a t -> t end = struct type 'a container = Waiting of (unit -> 'a) | Ready of 'a type 'a t = 'a container ref let lazy' f = ref (Waiting f) let force v = match !v with Ready v -> v | Waiting f -> let v' = f () in v := (Ready v'); v' end
<flux> may contain bugs :)
<flux> it's not thread safe either, but I don't know if the one in the std library is
<mrvn> and one should write it so one has the choice of retrying after an exception or not.
<flux> I don't think a standard lazy value should have any kind of retrying built in anyway :)
<flux> laziness and impurity can be hard to follow
<_yziquel> flux: laziness and impurity is precisely what I need...
<mrvn> then don't call Lazy.force_retry
<flux> I've used laziness and impurity too. but once the value has been evaluated once, I don't expect it to be evaluated again..
<flux> even if the previous case ended up in an error
<_yziquel> flux: true, but it may be too soon to evaluate it at a certain point in time.
<flux> _yziquel, perhaps there should be another way to indicate that than a lazy value then
<flux> perhaps a regular flag that accompanies the lazy value
<_yziquel> flux: unfortunately, not without trying...
<mrvn> flux: Lazy.force should rethrow the exception. It wouldn't hurt to also have a force_try or so that doesn't store an exception.
<_yziquel> flux: trying is the flag.
<mrvn> Could even be an optional arg
<flux> mrvn, yeah, I suppose force_try would be ok
<_yziquel> an optional arg would be ideal: you'd think twice before using it.
<flux> _yziquel, well, can't you just use that kind of module then?
<flux> I'd prefer .try_force/.force_try, if such function needed to exist
Ariens_Hyperion has joined #ocaml
<flux> _yziquel, perhaps instead of a value you can return a sum-type: type 'a t = Value of 'a | Retry of 'a lazy
<flux> that would make sense to the reader too, I'd say!
<flux> well, | Retry of (exn * 'a lazy)
<_yziquel> looked at your module. lazy : (unit -> 'a) -> 'a t is simply not good enough for me. i really need lazy : 'a -> 'a t.
komar_ has quit [Remote closed the connection]
<mfp> _yziquel: you want a new syntactical construct (-> camlp4)
<Alpounet> (or 5)
<_yziquel> mfp: not only. If I have l = lazy (expr), I need Lazy.force l == Lazy.force l. so it's not simply a syntactic construct, but it also involves the "purple magic" of the lazy module.
<_yziquel> no, i don't. my mistake.
komar_ has joined #ocaml
<mrvn> plus YourLazy.force could return the same value giving you ==.
monadic_kid has quit ["Leaving"]
<mfp> _yziquel: AFAICS all you need is something like flux' Lazy' module above (with whatever semantics you need) plus a lazy' keyword that turns lazy' x into Lazy'.lazy (fun () -> x)
<_yziquel> Or perhaps, reusing the lazy module, and doing some Obj magic to duplicate the data first, evaluate one copy, and if not adequate, keep the old one. Any good documentation for the Obj module?
<mfp> Lazy is tricky enough by itself (blocks whose tag changes & modified by the GC, etc.). Now, adding Obj into the mix...
_zack has joined #ocaml
<mfp> Obj is deliberately left undocumented, the idea being that only those who know the internal representation of OCaml values (plus a bit about the GC) will dare to use it.
deech has quit [Read error: 54 (Connection reset by peer)]
deech has joined #ocaml
Snark has quit [Read error: 113 (No route to host)]
<mrvn> Why does Lazy even do that?
<mfp> mrvn: the GC replaces the evaluated thunk with the value when forwarding the pointer in order to skip one indirection (and save a couple words)
hsuh has quit [Remote closed the connection]
Fullma` has joined #ocaml
Camarade_Tux_ has joined #ocaml
Fullma has quit [Success]
<Alpounet> mfp, are you gonna work on some testunit stuffs for Batteries ?
_zack has quit [Read error: 54 (Connection reset by peer)]
_zack1 has joined #ocaml
_zack1 has quit [Client Quit]
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
<palomer> hrmph
<_yziquel> flux: with flux's Lazy module, and with let empty = Lazzy.lazzy (fun () -> raise Not_found), I get a "contains type variables that cannot be generalized" error at compile time.
<mrvn> you nee to specify a type for it
ttamttam has joined #ocaml
<_yziquel> let empty : 'a aux_t Lazzy.t = Lazzy.lazzy ((fun () -> raise Not_found) : unit -> 'a aux_t) doesn't work either.
jeanb-- has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
<flux> _yziquel, well, you just cannot export values from a module that have 'a in them
<flux> while it does appear to work with lazy.. hmm, I wonder if there's any possibility of a loophole here..
<_yziquel> flux: lazy is a keyword. there's no lazy value in the Lazy module.
<kaustuv> Camarade_Tux_: weird. Are you on a 64bit platform?
<flux> _yziquel, this fails to compile too: type 'a t let a : 'a t Lazy.t = lazy (failwith "")
<flux> _yziquel, the problem with a 'a -typed value is that two different modules that compile in that module can end up with a different idea what that 'a is
<flux> I suppose it doesn't matter in this case, but it's there to protect you ;)
<flux> _yziquel, just use let empty () = .. ?
<mrvn> Only fucntions can be polymorphic.
<Camarade_Tux_> kaustuv, yes
<_yziquel> flux: no that destroys the whole type.
<flux> _yziquel, hey, I might have a solution: replace type 'a.. in the module with type +'a..
<kaustuv> Camarade_Tux_: ah, interesting. I'm getting seg faults now too for ()
<flux> I found unison fails to sync my 800G data or so with exception Out_of_memory
<mrvn> What does the + do?
<flux> I wonder if it really is that memory intensive.. it's a bummer that I need to split my sync into parts
<_yziquel> covariant.
<flux> I'm not sure why that fixes this issue
<flux> maybe someone can explain it to me :)
<flux> _yziquel, did it fix the issue?
<_yziquel> no.
<flux> well, atleast it fixed my minimal test case :)
<_yziquel> "the first type was expected to be covariant, but it is invariant".
<flux> yeah, I suppose mutability kills it
<flux> _yziquel, think what would happen, given that type, if there was a function let mangle a = a := Value 42 in the Lazzy module
<flux> its type would be val mangle : int container ref -> unit
<flux> if you have value 'a container ref (which is the same as 'a Lazzy.t), you could call that function with that value
<flux> which would break
<flux> especially if there was another function that did exactly the same but with, say, a string
sanguinev has quit [SendQ exceeded]
<flux> because another module could call mangle2 empty
<flux> this way two modules would have a different idea what empty's type is in their context (int Lazzy.t or string Lazzy.t) and that would result in crashes
<flux> I wonder why not all immutables types aren't covariant by default?
<mrvn> and +'a type is smart enought to catch mangle?
<flux> well, you can't declare a mutable type covariant
<flux> so if you have type +'a t = 'a ref it just doesn't compile
<flux> so that kind of situation cannot happen
<kaustuv> Camarade_Tux_: ah, found the bug.
<Camarade_Tux_> =)
<flux> _yziquel, if you _really_ want it, you can possibly use Obj.magic at some point
<flux> but I would advice against using such tricks :)
<mrvn> empty () isn't that hard to use.
<flux> I wonder how it "destroys the type"
<kaustuv> Camarade_Tux_: revision bd5c40ed96e9 should fix the problem.
<_yziquel> flux: empty would be type unit -> 'a t, and not of type 'a t. Therefore, if you try to compose it with other elements of the type, you will need to end up with unit -> 'a t. Therefore, the structure is not readily available for lazy inspection.
<flux> _yziquel, what kind of composition are you thinking? search/replace references to empty with empty ()? the problem occurs only if a final exported type contains a 'a
<mrvn> flux: empty () != empty () so there is no risk.
<_yziquel> and worse, you cannot compose twice the same structure with empty, because you get two structures, and not one.
det has quit [Read error: 104 (Connection reset by peer)]
det has joined #ocaml
<flux> _yziquel, for each type you want, you can define: let int_empty : int Lazzy.t = empty () etc..
<flux> type inference often handles that almost automatically, unless you explicitly want same kind of emptys to be shared
monadic_kid has joined #ocaml
<Camarade_Tux_> kaustuv, great, the bug is fixed
<_yziquel> flux: a lazy, possibly infinite tree of sorted data, infinite in the sense that there may be infinitely many top nodes. You can access the sorted data as a sorted lazy list in constant time, hence the need for exceptions. The tree structure is to help out sorting the sum of the elements of two trees, and ideally one should also be able to sort trees of such t
<_yziquel> rees.
<kaustuv> Camarade_Tux_: note that the result is no longer 100% faithful to memory layout. Precisely, it will show immediage (unboxed) values as boxed, but only if they appear at the root of the dag. Obviously unboxed values are not in the heap.
<flux> _yziquel, how does using empty () instead of empty make that more difficult?
<kaustuv> Camarade_Tux_: the "size" field will say "unboxed" for such cases instead of giving the block size
<flux> _yziquel, do you have lots of values with 'a in their type?
<mrvn> what does ocaml use after 'z?
<flux> 'hello_world
<flux> oh, you mean automatically
<flux> 'a1 I think
ttamttam has left #ocaml []
<flux> > let a b c d ef g h i j k l m o p q r s t u v w x y z a b c d e = ();;
<mlbot> val a :
<mlbot> 'a ->
<mlbot> 'b ->
<mlbot> 'c ->
<mlbot> 'd ->
<mlbot> ... (15 more lines)
<flux> bah :)
<flux> yeah, 'a1, 'b1 etc
<mrvn> > let foo a b c d e f g h i j k l m n o p q r s t u v w x y z aa = ();;
<mlbot> val foo :
<mlbot> 'a ->
<mlbot> 'b ->
<mlbot> 'c ->
<mlbot> 'd ->
<mlbot> ... (14 more lines)
<mrvn> flux: great minds think alike.
<flux> mrvn, yes. except other minds think faster! :-)
<flux> (or type)
<Alpounet> > let f (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = () ;;
<mlbot> val f :
<mlbot> 'a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i * 'j * 'k * 'l * 'm * 'n * 'o *
<mlbot> 'p * 'q * 'r * 's * 't * 'u * 'v * 'w * 'x * 'y * 'z -> unit = <fun>
<Alpounet> > let f (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa) = () ;;
<mlbot> val f :
<mlbot> 'a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i * 'j * 'k * 'l * 'm * 'n * 'o *
<mlbot> 'p * 'q * 'r * 's * 't * 'u * 'v * 'w * 'x * 'y * 'z * 'a1 -> unit = <fun>
<Alpounet> btw, I'm not likely to need that much type variables :-p
monadic_kid has quit ["Leaving"]
kaustuv has quit ["6e6bc4e49dd477ebc98ef4046c067b5f"]
<flux> I wonder in which conditions Ocaml runtime says 'Out_of_memory'
<flux> because I somehow doubt that even while I have large directories with many files, 2G of memory shouldn't run out while syncing them with unison
<flux> and if I ran out of heap memory, wouldn't linux just kill the process instead of giving it the chance to raise an exception
<flux> is it just running out of stack space?
<Camarade_Tux_> flux, iirc it would print a "stack overflow" then
<flux> ah, right
<flux> well, then my question remains :)
<flux> > let rec f a = f (a + 1) in f 0;;
<mlbot> Thread killed
<flux> argh, tail recursion :)
<flux> > let rec f a = f (a + 1) in f 0 - 1;;
<mlbot> Thread killed
<Camarade_Tux_> also, you could get the OOM killer for unison, except that unison is unlikely to receive it if it's doing computations at the same time
<Alpounet> flux, I limit ressources and time for mlbot to execute OCaml code
<Camarade_Tux_> for instance, on my computer, the victim is always firefox
<flux> hm, that doesn't consume memory, I wonder why
* Camarade_Tux_ wants two 16GB ram sticks
<flux> argh, bug agian
<flux> old versions of ocaml have perhaps has less than perfect suppor for raising Stack_overflow in native binaries
<flux> atleast recursion let loose is indicated as a problem that leads to Out_of_memory
<flux> well, perhaps I can atleast try increasing stack size if the problem persists
<flux> to 500M or something..
<Camarade_Tux_> flux, doesn't that only work for bytecode ?
<flux> camarade_tux_, it works for my simple test case in native code too, with 3.11
<flux> but iirc there have been some fixes regarding that lately, in 3.10 or 3.11
<Camarade_Tux_> (Gc.get ()).stack_limit documentation should be fixed then
<flux> how so?
<flux> I meant the operating system stack limit
<flux> ulimit -s 500000
<Camarade_Tux_> oh right, I misunderstood you
<flux> I thought you meant the exception, but no, it too appears to work for .opt
Ariens_Hyperion has quit []
Ariens_Hyperion has joined #ocaml
ztfw``` has joined #ocaml
ztfw``` is now known as ztfw
hsuh has joined #ocaml
<hsuh> what assembler can i use for ocaml msvc on windows?
<hsuh> i remember having done something easier than downloading the whole visual studio
Alpounet has quit [Remote closed the connection]
mlbot has quit [Remote closed the connection]
ztfw`` has quit [Read error: 110 (Connection timed out)]
hsuh has quit [Remote closed the connection]
Alpounet has joined #ocaml
mlbot has joined #ocaml
Ariens_Hyperion has quit []
kaustuv has joined #ocaml
BiD0rD has quit [Read error: 60 (Operation timed out)]
deech has quit [Read error: 54 (Connection reset by peer)]
deech has joined #ocaml
<Camarade_Tux_> flux, I just got "Killed" from an OOM killer
<Camarade_Tux_> (after firefox had been killed of course xD )
<Alpounet> has anyone tried Cameleon2 ?
jeanbon has quit ["EOF"]
BiD0rD has joined #ocaml
Fullma has joined #ocaml
monadic_kid has joined #ocaml
<Alpounet> > let cantor l (a,b) = (a, (a+.a+.b)/.3.)::((a+.b+.b)/. 3.,b)::l ;;
<mlbot> val cantor : (float * float) list -> float * float -> (float * float) list =
<mlbot> <fun>
<Alpounet> > List.fold_left cantor [] [0.,1.] ;;
<mlbot> - : (float * float) list =
<mlbot> [(0., 0.333333333333333315); (0.66666666666666663, 1.)]
Fullma` has quit [Read error: 60 (Operation timed out)]
AlexR has joined #ocaml
<AlexR> Hi all. I've got an ocamllex/ocamlyacc question-- any takers?
<AlexR> Well, maybe someone will pick this up later: I'm parsing a mildly whitespace sensitive language. The thing I'm having difficulty with is that NEWLINE tokens are only significant if they precede an identifier. Is there some way for me to filter the token stream so that all NEWLINEs are dropped except for those that come before an ID?
<mbishop> hmm
<mbishop> > let x x y z = z x y in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in x;;
<mlbot> - : 'a ->
<mlbot> 'b ->
<mlbot> (('c ->
<mlbot> (('d ->
<mlbot> (('e ->
<mlbot> ... (94 more lines)
<mbishop> heh
<Alpounet> mbishop, do you want to have the 94 left lines ? -:-p
slash_ has joined #ocaml
<mbishop> no thanks heh
jeanbon has joined #ocaml
jeanb-- has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
<kaustuv> AlexR: Have a high priority rule for identifiers matching \n*[a-zA-Z_][a-zA-Z0-9]* (for example) and then strip the newlines from its head. Then have a lower priority rule that discards \n
<kaustuv> if you want just the last newline, change to \n instead \n*
<_yziquel> What does Obj.field do? creates a new internal structure?
<kaustuv> _yziquel: no, [Obj.field bl i] is the ith element of block bl
<kaustuv> A block is basically an array of integers or pointers to other blocks
<mrvn> _yziquel: You really do not want to use Obj in real live.
<AlexR> kaustuv: That's a good idea, thanks. Any clue how I could still keep track of line numbers? Presumably ocamllex won't let me see how many of the \n+ it matched.
<_yziquel> mrvn: thanks for the advice, but i do not see any other way around rewritting some functions in the Lazy module.
<_yziquel> s/around/around other than/
<mrvn> AlexR: make a rule for newlines = newline newlines that increases your line counter
<kaustuv> AlexR: you can always get the matched string and count the \ns yourself
<mrvn> _yziquel: just write your own lazy module
<AlexR> mrvn: I can put OCaml code in rules?
<kaustuv> AlexR: note that ocamllex has no internal newline bumping code. You have to do it yourself
<_yziquel> mrvn: that's what i'm doing. with Obj, as in Lazy.
<mrvn> AlexR: how else do you get anything back from the parser?
<AlexR> k: Yeah, I'm doing it myself now. If ocamllex did it automatically then it would be no problem
<mrvn> _yziquel: do itfrom scratch and not with Lazy.
<_yziquel> mrvn: didn't work, could not typecheck correctly New_lazy.lazy (fun () -> raise Notfound).
<mrvn> _yziquel: sure it can. You just can't let the 'a escape.
<AlexR> mrvn: Oh, I mistook patterns (ie, let whitespace = [' ' '\t' ]+) for rules. So you meant adding a parser rule newlines?
<mrvn> AlexR: if your grammar allows for it
<_yziquel> mrvn: not letting 'a escape is a pain.
<AlexR> mrvn: I don't think it will...I'd have to sprinkle the newlines rule all over the place to recapture the language I have now.
<AlexR> Thanks all for the help
Yoric[DT] has quit [Remote closed the connection]
Yoric[DT] has joined #ocaml
<mrvn> n8
ikus060 has joined #ocaml
<ikus060> Hi, I'm a real newbies with ocaml and I want to made some modification to Unison.
<ikus060> First, I get problem to understand how to declare a 'class'
<ikus060> reading the docs I see "class p1 p2 p2 () = ..." and "class (p1, p2, p3) = ..." What the difference
<ikus060> ping
<ikus060> ping
<ikus060> is there any one alive here ?
<kaustuv> ikus060: have you tried reading http://caml.inria.fr/pub/docs/manual-ocaml/manual005.html ?
<Alpounet> I guess you should start at the "Object system" page of the OCaml manual
<Alpounet> !ocaml
Ariens_Hyperion has joined #ocaml
<monadic_kid> class p1 p2 p2 () = doesn't look right
<ikus060> well, the compiler doesn't complain
<ikus060> in unison source code I see "class ~p1 ~p2 () = ..."
<monadic_kid> anyways one looks like a constructor of a tuple
<ikus060> oups, my mistake it's classe ?p1 ?p2 () =
AlexR has left #ocaml []
<monadic_kid> i don't see either example in that code
<monadic_kid> i mean don't see the latter example
<ikus060> the link is broken ?
<monadic_kid> i dont see this form "class (p1, p2, p3) =" in that example, anyways I think the difference is just one is constructor of a tuple
<kaustuv> ikus060: I think you should read the manual. However, in that code scrolled_text is a class that takes several arguments. Those with ? in front of them are optional named arguments, and those with ~ are ordinary named arguments. The final () is needed for technical reasons.
<ikus060> kaustuv: thanks, I will take a look into the ocaml manual than
monadic_kid has quit ["Leaving"]
ikus060 has quit ["Leaving"]
<Alpounet> do you guys think an interval list is suitable for representing iteration steps of the Cantor set construction ?
<Alpounet> (with an interval being a float*float = (a,b), representing [a,b])
<kaustuv> If S is the nth iterate, then Sn+1 is S/3 \cup (S + 2)/3, where /3 is scaling down by 3, and + 2 is translation right by 2. Ideally you'd like a data structure where scaling, translation, and set union are constructors.
<kaustuv> You can later construct a list of intervals from this structure.
<Alpounet> for instance, it's List.fold_left based
<Alpounet> s/for instance/for the moment
<Alpounet> I do each step with List.fold_left'ing the previous step list
<kaustuv> I think you are doing more work than needed. If you want the final list, compute it at the end from the binary tree of unions.
<BiD0rD> Hi, what determines when does ocaml raise a "Fatal error: exception Out_of_memory" ? (I mean how mush used memory)
<Camarade_Tux_> BiD0rD, the amount of memory available on your system
<BiD0rD> Including swap ?
<Camarade_Tux_> yeah
* Camarade_Tux_ needs to save memory from a program that uses 2GB =/
<Alpounet> kaustuv, yeah, a bintree for intermediate work is probably more suitable.
<Alpounet> $ time ./cantor 25
<Alpounet> 33554432 intervals in list
<Alpounet> real 0m25.553s
<Alpounet> user 0m23.481s
<Alpounet> sys 0m2.060s
<Alpounet> with my current impl.
<Camarade_Tux_> well, /me goes too bed, good nigh
<Camarade_Tux_> t
<Alpounet> gn Camarade_Tux.
Camarade_Tux_ has quit ["Leaving"]
jeanbon has quit ["EOF"]
<kaustuv> Alpounet: is there any safeguard in mlbot to prevent running the following code until you run out of memory?
<kaustuv> List.init max_int (fun n -> List.init n Std.identity) ;;
<Alpounet> kaustuv, yeah, there's a time limit
<Alpounet> (a bit short maybe :-p)
<Alpounet> (600ms)
<Alpounet> > List.init max_int (fun n -> List.init n Std.identity) ;;
<mlbot> Type Error
<Alpounet> > List.init ;;
<mlbot> Type Error
<Alpounet> interesting...
<Alpounet> List.fold_right ;;
<kaustuv> A timeout seems reasonable as I can't seem to fill my 2G main memory faster than ~30 seconds
<Alpounet> > List.fold_right ;;
<mlbot> - : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b = <fun>
<kaustuv> Well, not without using Bigarray, I suppose.
<kaustuv> > Bigarray.Array1.create Bigarray.int Bigarray.c_layout max_int ;;
<mlbot> Symtable.Error(_)
<Alpounet> Bigarray isn't provided in Pervasives ...
<Alpounet> (since I use the Toploop module, I haven't food any way to integrate libraries)
<Alpounet> found*
<Alpounet> maybe Dynlink ?
<kaustuv> I think it's good that you don't support too many libraries. The bot should be for quick experiments, not a replacement for the toplevel.
<Alpounet> I think so, but I would like to get Batteries integrated.
Ariens_Hyperion has quit []
AlexR has joined #ocaml
<AlexR> Hi all- anyone have tips for debugging ocamlyacc parsers? I'm currently looking at the trace output and then running through the file dumped by ocamlyacc -v to reverse engineer the parser I've created. This is a bit frustrating and takes a long time. Any better ideas?
T_S_ has joined #ocaml
<kaustuv> AlexR: unfortunately, debigging LALR grammars is a black art
<kaustuv> s/big/bug/
<kaustuv> it's probably not much help if you're already done writing your grammar, but I would suggest looking at menhir instead of ocamlyacc. Menhir produces much better explanations.
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml