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
slash_ has quit [Client Quit]
jeremiah has quit []
komar_ has quit ["WeeChat 0.2.6.2-ohshi"]
travisbrady has quit []
travisbrady has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
_JFT_ has joined #ocaml
ched_ has joined #ocaml
travisbrady has quit []
Ched has quit [Read error: 110 (Connection timed out)]
_JFT_ has quit []
_JFT_ has joined #ocaml
palomer has quit [Remote closed the connection]
jeff_s_ has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
julm has joined #ocaml
pants1 has joined #ocaml
pantsd has quit [Read error: 60 (Operation timed out)]
Associat0r has quit []
_JFT_ has quit []
jeddhaberstro has quit []
travisbrady has joined #ocaml
komamitsu has joined #ocaml
alexyk has quit []
sporkmonger has quit []
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
idiot has joined #ocaml
yziquel has joined #ocaml
idiot has left #ocaml []
m3ga has quit ["disappearing into the sunset"]
komar_ has joined #ocaml
ikaros has joined #ocaml
jeanbon has joined #ocaml
acatout has joined #ocaml
jeanbon has quit ["EOF"]
olegfink has quit [Remote closed the connection]
Camarade_Tux has joined #ocaml
Camarade_Tux has quit [Read error: 104 (Connection reset by peer)]
Tux_ has joined #ocaml
Tux_ has quit [Read error: 104 (Connection reset by peer)]
Camarade_Tux has joined #ocaml
__marius__ has quit [hubbard.freenode.net irc.freenode.net]
__marius__ has joined #ocaml
rmrfchik has joined #ocaml
Lomono_ has quit ["Don't even think about saying Candlejack or else you wi"]
<rmrfchik> hi. I want to run examples from Okasaki book. it uses standard ml. can I run it on ocaml?
<mrvn> if you adjust them
jeff_s_ has quit [Read error: 104 (Connection reset by peer)]
ulfdoz has joined #ocaml
eevar2 has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
<rmrfchik> if there comparsion between ocaml and ml? i'm not skilled ml programmer.
<rmrfchik> i.e. is ml's "datatype" the same as ocaml's "type"?
hkBst has joined #ocaml
<komamitsu> i think so.
ulfdoz has quit ["deprecated"]
Camarade_Tux has quit ["Quitte"]
komar_ has quit [No route to host]
ulfdoz has joined #ocaml
marmottine has joined #ocaml
Lomono has joined #ocaml
wysek has joined #ocaml
<wysek> hi, i have a question. I'd like to use Set.Make(...) in a a' typed record
<wysek> type 'a some_instance = { mutable set1 : XXX; }
<wysek> where XXX needs to be sth like "module MessageSet = Set.Make('a)"
<wysek> it's a bit awkward way to show the problem, but I hope someone understands what I mean :)
<wysek> the question is how to do it correctly?
<julm> [Set.Make] takes a module type with a [type t] not a [type 'a t], so I don't see a way to get a polymorphic XXX
<wysek> :( is there any other ocaml module that does what Set does and is polymorphic?
<julm> perhaps in Batteries
<wysek> sure I have google. thanks!
<julm> in the standard library, perhaps have a glance at [Hashtbl] http://caml.inria.fr/pub/docs/manual-ocaml/manual034.html
yziquel has quit [Read error: 113 (No route to host)]
<julm> also you can copy the source code of Set and make it suit your needs
<wysek> actually I just need Add/Remove/Exists 'a running as fast as it can
<wysek> I'll try modifying the soource
det has quit [Remote closed the connection]
det has joined #ocaml
komar_ has joined #ocaml
komar_ has quit [Client Quit]
verte has joined #ocaml
noj has quit [Read error: 104 (Connection reset by peer)]
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
th5 has joined #ocaml
ztfw has joined #ocaml
johnnowak has joined #ocaml
johnnowak has quit []
marmottine has quit ["mv marmotine Laurie"]
jado has joined #ocaml
ulfdoz has quit [Remote closed the connection]
ulfdoz has joined #ocaml
<jado> hi, is it possible in ocaml to have a function that takes in argument for instance an int OR a string and returns an int OR a string ; so if my function is called f : i would like that f n = n+1 and f s = String.lowercase s ; moreover, i don't want to create a type Int of i | String of s and give this type as argument to my function
<julm> jado, it is not possible, how [f] would then be able to know whether it's [int] or [string]; you must use a variant type : [type Int of int | String of s] or a polymorphic variant type [`Int of int|`String of string]
<jado> julm: i just used Obj.magic :D
<julm> you shouldn't
<jado> i know it's just for fun
<julm> prepare to segfault
<jado> my program works just fine :p
<flux> jado, if you can embed the operation into the datatype itself, you can sort of do it
jeanbon has joined #ocaml
<flux> obviously that cannot happen with plain integers or strings
<flux> but, say: let mk_string s = (s, String.lowercase) and let mk_int i = (i, fun n -> n + 1) and let f (v, op) = (op v, op)
<flux> so then you can have f (mk_string "hello") and f (mk_int 42)
<jado> yes but that's not what i wanted
<flux> well, then the only real alternative is the variant, but that cannot express the limit you have (ie. type 'a on f produces type 'a)
youscef has joined #ocaml
<jado> with Obj.magic you mean ?
<flux> actually it might be possible to identify strings from integers with the Obj-moduli and have a truly polymorphic function that works with integers and strings
<flux> no, I meant that the way I showed works without Obj.magic
<flux> but Obj has other functions than just .magic, you know
<flux> I would really avoid using Obj.magic if you can. albeit, I must admit I've once used it for implementing a certain module that would've required the use of weak hash tables and mutexes to do otherwise..
<flux> (also it'd be a lot more complicated)
<jado> i'm not using it for real programming
<flux> oh right, and also for converting Unix.fd into an integer for debugging purposes
<flux> (it appears the use case of Obj.magic worked just fine, though, the process has been up for two months now)
<jado> hehe
<flux> actually it used Obj.repr and Obj.obj, but that is essentially the same
LeCamarade|Away is now known as LeCamarade
noj has joined #ocaml
Yoric[DT] has joined #ocaml
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
yziquel has joined #ocaml
barismetin has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pantsd has joined #ocaml
Camarade_Tux has joined #ocaml
<yziquel> hi. is there any module designed to handle temporary files?
<flux> doesn't look like there'd be anything in the standard distribution
komamitsu has quit []
<yziquel> flux: found something in batteries: opens temporary files but it gives back a file handle. I'd like something more in the line of bash/perl. I wish to use Shell.cmd to execute a program to create a temporary file...
<flux> yziquel, well, you can look the code batteries uses?
ztfw` has joined #ocaml
ztfw has quit [Remote closed the connection]
jado has quit [Read error: 113 (No route to host)]
Spiwack has joined #ocaml
jeanbon has quit [Read error: 104 (Connection reset by peer)]
jeanbon has joined #ocaml
jeanbon has quit [Read error: 104 (Connection reset by peer)]
jeanb-- has joined #ocaml
jeanb-- is now known as jeanbon
jeanbon has quit [Client Quit]
sporkmonger has joined #ocaml
sporkmonger has quit []
jeanbon has joined #ocaml
itewsh has joined #ocaml
th5 has quit []
<Yoric[DT]> yziquel: well, that would definitely be interesting to have.
<Yoric[DT]> There are several attempts to get something along the lines of bash as OCaml modules.
<Yoric[DT]> One of them by Zheng Li.
<Yoric[DT]> One of them as part of ocamlnet.
<Yoric[DT]> There's also Camlish, the Caml shell, etc.
Lomono has quit [Read error: 110 (Connection timed out)]
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
youscef has quit ["KVIrc 3.4.0 Virgo http://www.kvirc.net/"]
sporkmonger has joined #ocaml
sporkmonger has quit []
sporkmonger has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
jado has joined #ocaml
youscef has joined #ocaml
Camarade_Tux has quit [Read error: 54 (Connection reset by peer)]
Camarade_Tux has joined #ocaml
mehdid has joined #ocaml
itewsh has quit [Success]
itewsh has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
poucet has joined #ocaml
jado has quit [Read error: 113 (No route to host)]
_andre has joined #ocaml
bacam has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
ikaros has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
bombshelter13_ has joined #ocaml
willb has joined #ocaml
kattla has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<kattla> Hi, is it possible to use a lexer generated by ocamllex in a non-blocking way?
rjack has joined #ocaml
alexyk has joined #ocaml
<kaustuv> kattla: Lexing.from_function takes a reader function as argument. However, if it returns 0 characters then ocamllex treats it as the end of input so you'll have to manually restart it.
<kattla> hmm, that sounds tricky, what if half a token had been read before that?
jado has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
rwmjones_ has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
eevar2 has quit ["This computer has gone to sleep"]
Ched has joined #ocaml
ched_ has quit [Read error: 104 (Connection reset by peer)]
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
alexyk has quit []
itewsh has quit [Success]
itewsh has joined #ocaml
rwmjones_ has quit ["Closed connection"]
Associat0r has joined #ocaml
itewsh has quit [Connection timed out]
travisbrady has quit []
itewsh has joined #ocaml
rjack has quit ["leaving"]
petchema has quit [Remote closed the connection]
_andre has quit [Read error: 110 (Connection timed out)]
jonafan has quit [Read error: 104 (Connection reset by peer)]
travisbrady has joined #ocaml
itewsh has quit [Success]
itewsh has joined #ocaml
jamii has joined #ocaml
slash_ has joined #ocaml
<flux> kattla, well, you could make it identify all non-matching tokens as some 'interrupted' token?
<flux> but yes, it's tricky
<flux> kattla, a simpler way would be to use a thread. if it's suitable for your purposes..
<flux> (the idea that if you have an interrupted token, you know which characters you need to refeed the lexer the next time you start it)
<flux> mrvn, btw, how's you fs going?
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
jonafan has joined #ocaml
LeCamarade is now known as LeCamarade|Away
<kattla> flux: I'm making a library, which means I'm reluctant to involve threads. I'm also reluctant to resort to trickery though :) . I'll probably just make the library blocking...
<flux> kattla, in my little self-made theory it shouldn't be difficult to fix ocamllex..
<flux> maybe you would like to post-process the produced .ml-file :-)
Camarade_Tux has quit ["Quitte"]
<kattla> I think I'd rather ignore the issue for now :)
<flux> hmm, actually the produced parsers are almost non-blocking already
<flux> they just have | 0 -> action1 () | 1 -> action2 () | other -> refill_buffers (); restart other
jado has quit [Read error: 113 (No route to host)]
bacam has joined #ocaml
youscef has quit [Read error: 110 (Connection timed out)]
youscef has joined #ocaml
bacam has quit [Read error: 113 (No route to host)]
ztfw`` has joined #ocaml
bacam has joined #ocaml
alexyk has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
barismetin has quit [Read error: 110 (Connection timed out)]
ztfw` has quit [Connection timed out]
ztfw`` has quit [Success]
Spiwack has quit ["Leaving"]
<flux> what is ocsforge? (the web space http://ocsforge.forge.ocamlcore.org/ is positively information free)
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
jeanb-- has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
nispaur has joined #ocaml
<sporkmonger> is there a formal term for uh... the opposite of currying? uncurrying?
Ched has quit [Remote closed the connection]
<flux> people talk about uncurrying
<sporkmonger> if you have functions a,b,c, and b returns c, and both a and c take ints as parameters and return ints... given "a b 1", would that be possible to parse reasonably in a dynamically typed language, or do you need type inference to make that work without the aid of parens?
<flux> I believe most type-inferencing languages (ocaml and haskell for example) can be run with dynamic types without much trouble
<flux> a b 1 is parsed as (a (b 1))
<flux> uh
<flux> (((a) b) 1) that is
<flux> so a is evaluated with parameter b, then the resulting function is evaluated with parameter 1
<flux> you can easily make that work in a dynamic setting
<sporkmonger> hmm
<sporkmonger> interesting, i would've expected (a (b 1)) rather than (((a) b) 1)
<sporkmonger> but i guess that makes sense
<flux> a (b 1) would mean: evaluate a with the result of b 1
<flux> sporkmonger, are you thinking of writing a dynamic language?
<sporkmonger> yeah
<flux> sporkmonger, for some particular purpose or just for fun?
<sporkmonger> fun
<sporkmonger> i'm writing it in ocaml, and feeling jealous of a few of its features :-)
<flux> sporkmonger, did you choose ocaml just for this project, or do you have prior exposure?
<flux> sporkmonger, in any case, good luck with your project :)
<sporkmonger> i have prior exposure, though somewhat limited
<sporkmonger> enough to be dangerous :-P
<sporkmonger> but not enough to know what i'm doing
<mrvn> flux: I'm stuck at the defragmenting
<flux> don't walk into the Obj module and you should be fine..
zerny has joined #ocaml
<flux> mrvn, just use SSD and ignore it? no?-)
<mrvn> flux: way to expensive
<flux> mrvn, I guess you want some on-line defragmenter?
<mrvn> yes
<flux> mrvn, does the FS has sufficient internal information to make that happen?
<mrvn> sure
<flux> mrvn, well, what's the problem then?-)
<mrvn> The question is how to do it so free space is not fragmented and you don't have to move data around too much.
<flux> mrvn, btw, have you considered access-pattern-based defragmenting?
<flux> although I suppose it needs some bookkeeping..
<mrvn> for that I currently have not enough info.
<flux> well, good luck with your project aswell. I'm going to sleep. ->
<mrvn> As I see it I can easily find a fragmented file, find a large enough space and then copy the file there. But then thefree space quickly becomes fragmented.
<mrvn> And defragmenting the free space means copying every bit of data around.
<nispaur> Bon, bonne soirée.
nispaur has quit [Remote closed the connection]
<sporkmonger> hmmm: http://gist.github.com/127454
<julm> ((double mystery) 2) 3;;
<sporkmonger> k
<sporkmonger> curious
<sporkmonger> if that's the case, why do you get "too many arguments" and not "This expression has type int -> int -> int but is here used with type int"?
<julm> perhaps because ocaml detects the "too many arguments" before it checks the type of each argument.
<sporkmonger> i guess i'm curious about how the int -> int -> int currying stuff works
<sporkmonger> because it kinda seems to me like if mystery 2 3;; works with a function defined in pieces, then double mystery 2 3;; ought to work too for the same reason?
<kattla> type of 'double' is 'int -> int -> int', type of 'double mystery' would be 'int -> int' if it type checked, and so on.
<kattla> eventually you are trying to use a value of type 'int' as a function
<sporkmonger> er... isn't double 'int -> int'?
<sporkmonger> mystery is 'int -> int -> int'
<kattla> ahh, remove one 'int ->' from what i said
<sporkmonger> i guess i don't understand why (double mystery) isn't int -> int -> int
<kattla> welll, double takes a value of type int as an argument
<kattla> mystery is int -> int -> int
<sporkmonger> and mystery returns int
<sporkmonger> so shouldn't it end up being a function that take's mystery's params and returns the combined function's result?
Ched has joined #ocaml
<kattla> no, the params do not propagate like that
<sporkmonger> right, i'm assuming there's a reason for that though
Camarade_Tux has joined #ocaml
<sporkmonger> and i was hoping for more than "just because" :-)
itewsh has quit [Read error: 60 (Operation timed out)]
johnnowak has joined #ocaml
itewsh has joined #ocaml
<kattla> a lot of the time you are working with values of polymorphic type
<kattla> that kind of parameter propagation would only work if all types are known
<johnnowak> does anyone have some hard data on pause times with ocaml's incremental gc?
jamii has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Client Quit]
<mrvn> sporkmonger: because a b c is (a b) c
<mrvn> sporkmonger: because if parameters would magically propagate then how would you pass a function as argument?
<sporkmonger> ooooh, ok, that last one suddenly makes a lot of sense
<mrvn> sporkmonger: because even a (b c) would not propagate parameters
<johnnowak> alternatively, is the incremental gc configurable so I can set a bound on the pause times?
<mrvn> sporkmonger: You have to get used to the fact that functions are just values like int or string.
ikaros has quit ["Leave the magic to Houdini"]
<sporkmonger> yup, i know, i'm more trying to figure out where the outer edges of currying/uncurrying are
<mrvn> johnnowak: I would think the worst pause time is compaction.
<mrvn> sporkmonger: everything is curried
<sporkmonger> mrvn: i know
<mrvn> so where should there be an edge?
<sporkmonger> hence, int -> int -> int and not int * int -> int
<johnnowak> mrvn: is compaction not done incrementally?
ikaros has joined #ocaml
<mrvn> johnnowak: maybe, maybe not. Never checked the source on that.
<johnnowak> hm. thanks
<sporkmonger> does ocaml have a built-in compose function? ie, f (g x)
travisbrady_ has joined #ocaml
travisbrady has quit [Read error: 104 (Connection reset by peer)]
<julm> let foo x y = double (sum x y);;
<julm> to compose, you can for instance define: let (|>) f g x = f (g x);;
<sporkmonger> well, yes, but i meant with compose
<sporkmonger> you can do let (funnysymbol)?
<julm> let (|>) f g x y = f (g x y);;
<julm> let foo = double |> sum;;
<julm> val foo : int -> int -> int = <fun>
<sporkmonger> wouldn't that be sum |> double?
<julm> don't you want 2*(x+y) ?
<sporkmonger> yes
<julm> then f=double and g=sum
<julm> double |> sum is equivalent to (|>) double sum
<sporkmonger> ahh k
<julm> first is in infix notation
<sporkmonger> yeah, got confused by the first let (|>) f g x = f (g x);;
<sporkmonger> since the time wouldn't match for that
<sporkmonger> *type
<julm> like 2 + 2 could be written (+) 2 2
<sporkmonger> right
hkBst has quit [Read error: 104 (Connection reset by peer)]
<sporkmonger> thanks
<travisbrady_> are omake and make often used together? i'm wondering why i often see projects with a Makefile and an OMakefile
johnnowak has quit []
youscef has quit ["KVIrc 3.4.0 Virgo http://www.kvirc.net/"]
sporkmonger has quit []
Jedai has joined #ocaml
Camarade_Tux has quit ["Quitte"]
<hcarty> travisbrady_: GODI requires a Makefile, so it may be for that reason
Camarade_Tux has joined #ocaml
kattla has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit [Client Quit]
Yoric[DT] has joined #ocaml
bombshelter13_ has quit []
rjack has joined #ocaml
shazam has joined #ocaml
jeanbon has quit [Read error: 110 (Connection timed out)]
<shazam> hello
shazam is now known as palomer
<palomer> the regexp for capitalized-ident seems to be missing from the spec
<palomer> (in the manual)
<palomer> so...what is it?
* Yoric[DT] wonders whether palomer turns to Captain Marvel.
<julm> indeed, I cannot find capitalized-ident
<julm> just "These eleven name spaces are distinguished both by the context and by the capitalization of the identifier: whether the first letter of the identifier is in lowercase (written lowercase-ident below) or in uppercase (written capitalized-ident). Underscore is considered a lowercase letter for this purpose."
<palomer> bummer
<palomer> hey, if someone could write a function g such that String.concat "" (List.map (function Some y -> y | None -> str) (g str input)) = input, I would be very happy :P
Lomono has joined #ocaml
<mrvn> palomer: let g _ x = [Some x]
zerny has quit [Remote closed the connection]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
willb has quit [Read error: 110 (Connection timed out)]
Alpounet has joined #ocaml
alexyk has quit []
<palomer> hah!
<palomer> ok, another condition: the length of g str x is at least the number of occurences of str in x
<mrvn> You want to split the input replacing str with None?
ikaros has quit ["Leave the magic to Houdini"]
rjack has quit ["leaving"]
Yoric[DT] has quit ["Ex-Chat"]
hcarty has quit [Read error: 104 (Connection reset by peer)]
Alpounet has quit [hubbard.freenode.net irc.freenode.net]
Lomono has quit [hubbard.freenode.net irc.freenode.net]
aij has quit [hubbard.freenode.net irc.freenode.net]
gl has quit [hubbard.freenode.net irc.freenode.net]
hcarty has joined #ocaml
Alpounet has joined #ocaml
Lomono has joined #ocaml
aij has joined #ocaml
gl has joined #ocaml
<palomer> mrvn, yup!