gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
iago has quit [Quit: Leaving]
cdidd has joined #ocaml
<_habnabit> is there some way of allocating a bigarray wrapping memory that ocaml is managing from C?
<_habnabit> alloc_bigarray seems to just wrap a pointer instead of copying its contents
tlockney has quit [Excess Flood]
tlockney has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
NihilistDandy has joined #ocaml
KDr2 has joined #ocaml
mjonsson has joined #ocaml
NihilistDandy has quit []
KDr2 has quit [Ping timeout: 244 seconds]
KDr2 has joined #ocaml
bzzbzz has quit [Quit: leaving]
<malouin> is there a godified http client?
<thelema> malouin: netclient?
<malouin> there is a netclient godi package?
twittard has quit [Quit: twittard]
<thelema> malouin: godi-ocamlnet
letrec has joined #ocaml
Drup has quit [Quit: Leaving.]
oriba has quit [Quit: oriba]
<malouin> I see.
<malouin> already installed, even.
lamawithonel_ has joined #ocaml
lamawithonel has quit [Ping timeout: 276 seconds]
datkin has quit [Remote host closed the connection]
datkin has joined #ocaml
twittard has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
g0dmoney- has quit [Ping timeout: 246 seconds]
g0dmoney- has joined #ocaml
Tobu has joined #ocaml
lamawithonel__ has joined #ocaml
lamawithonel_ has quit [Ping timeout: 245 seconds]
codesnow has joined #ocaml
mjonsson has quit [Quit: Leaving]
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
codesnow has quit [Ping timeout: 260 seconds]
EmmanuelOga has quit [Quit: WeeChat 0.3.7-dev]
Kakadu has joined #ocaml
twittard has quit [Quit: twittard]
thelema has quit [Remote host closed the connection]
thelema_ has joined #ocaml
NihilistDandy has joined #ocaml
<adrien> morning
edwin has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
ftrvxmtrx has joined #ocaml
Snark has joined #ocaml
letrec_ has joined #ocaml
letrec has quit [Ping timeout: 260 seconds]
Cyanure has joined #ocaml
avsm has joined #ocaml
wagle has quit [Remote host closed the connection]
wagle has joined #ocaml
Cyanure has quit [Ping timeout: 248 seconds]
MaskRay has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
Xizor has joined #ocaml
Cyanure has joined #ocaml
<iZsh> thelema_: tiny suggestion for BatSet: a find: ('a -> bool) -> 'a t -> 'a function, and a "replace/add" function which add an elm, and replace the existing one if it already exists according to the cmp function provided at creation
pango is now known as pangoafk
ppilatus has quit [Remote host closed the connection]
jchillerup has joined #ocaml
<jchillerup> Hi! I am pretty new to OCaml. I have a string in which I want to do a global_replace
<jchillerup> I just can't seem to figure out the right syntax
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
<iZsh> jchillerup: what do you want to replace with what?
pangoafk has quit [Ping timeout: 260 seconds]
avsm has joined #ocaml
Drup has joined #ocaml
NihilistDandy has quit []
Goldfish137 has joined #ocaml
<Goldfish137> Hello
<Ptival> hello
<Ptival> jchillerup: do you have a problem with the matching regexp, or with the replace template?
Tobu has quit [Ping timeout: 260 seconds]
avsm has quit [Quit: Leaving.]
Tobu has joined #ocaml
<jchillerup> iZsh: I want to replace ' with \'
<jchillerup> And the string is already in a variable
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
<jchillerup> radio = on_metadata(fun(meta) -> system("/usr/share/liquidsoap/log.py '"^ meta["filename"] ^"'"), radio);
<jchillerup> I want to replace ticks in meta["filename"] with thier escaped counterparts
<iZsh> try String.escaped then
<jchillerup> like this: meta["filename"].excaped?
<jchillerup> escaped*
<Ptival> no
<Ptival> String.escaped meta["filename"]
Drup has quit [Quit: Leaving.]
MaskRay has quit [Remote host closed the connection]
oriba has joined #ocaml
ikaros has joined #ocaml
<jchillerup> Ah, thanks
<iZsh> jchillerup: btw, you have a security bug
<iZsh> oops, maybe that's why you were trying to escape it
<iZsh> I wouldn't do it like that then
<iZsh> use a whitelist, not a "blacklist"
silver has quit [Remote host closed the connection]
silver has joined #ocaml
Zedrikov has joined #ocaml
Xizor has quit []
<_habnabit> or, even better, don't use system
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
Zedrikov has quit [Quit: Bye all, see you next time!]
antoineB has joined #ocaml
The_third_man has quit [Ping timeout: 240 seconds]
<antoineB> hello, i am new to ocaml, and i don"t manage to create a Set (in the interactive ocaml)?
<_habnabit> okay?
codesnow has joined #ocaml
<thelema_> antoineB: module IntSet=Set.Make(struct type t = int let compare = compare end);;
<thelema_> antoineB: let s = IntSet.singleton 5;;
<thelema_> iZsh: BatSet.modify_def
<antoineB> thelema_: thanks you
Submarine has quit [Ping timeout: 244 seconds]
pango has joined #ocaml
pango has quit [Quit: I'll be back]
codesnow has quit [Ping timeout: 265 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
oriba has quit [Quit: oriba]
milosn has quit [Read error: No route to host]
milosn has joined #ocaml
datkin has quit [Read error: Connection reset by peer]
kozikow has joined #ocaml
datkin has joined #ocaml
datkin_ has joined #ocaml
<kozikow> Hello everyone
<kozikow> I have strange problem, because it looks like my function is adding only one object to the list in each loop
datkin_ has left #ocaml []
<kozikow> I guess that's it's because "let =" is actually an alias and it's calculating all values when I am trying to access the list
<kozikow> So it turns out that I have list of 5 same objects instead of 5 different objects (it's what I am trying to achieve)
<kozikow> Does anyone know how to do something like "forcing" the evaluation of let?
<_habnabit> ocaml isn't lazy
brooksbp has joined #ocaml
<kozikow> That's what I thought
<kozikow> But it's the only thing I can think of
pango has joined #ocaml
<kozikow> why my code is not doing what I am expecting
<kozikow> | h::t -> let nowy = (get_string trigram.[1] trigram.[2] h) in parse_word t nowy (nowy::acc
<_habnabit> yes, I'm looking
<_habnabit> hold on
<kozikow> It's funny, because when I run the code and at each iteration I try to output the list
<kozikow> I get following output:
<kozikow> __H el: __H _He el: _He el: _He Hel el: Hel el: Hel el: Hel ell el: ell el: ell el: ell el: ell llo el: llo el: llo el: llo el: llo el: llo
<kozikow> this
<datkin> I think it's because you're mutating the string?
<datkin> Hmm, perhaps not.
<_habnabit> well, in any case, I actually just wrote this function for work
<datkin> No, that is it.
<_habnabit> what string is getting mutated?
<datkin> [let str = "___" in] seems to allocate only 1 string.
<_habnabit> oic
<_habnabit> I didn't think that would do it
<_habnabit> oh, this function is shorter than I remember
<_habnabit> let gen_count_by_seq word_length seq = 0 -- (String.length seq - word_length) |> Enum.map (flip (String.sub seq) word_length)
Kakadu has quit [Quit: Konversation terminated!]
Kakadu has joined #ocaml
<_habnabit> hooray enum
<kozikow> Wow, strange
silver has quit [Quit: I put on my robe and wizard hat]
<_habnabit> # gen_count_by_seq 3 "Hello" |> List.of_enum;;
<_habnabit> - : string list = ["Hel"; "ell"; "llo"]
<Ptival> you're mutating the closure
<kozikow> Thanks _habnabit
<kozikow> I am now trying to understand why it's working the way it is
<kozikow> thanks everyone
<_habnabit> we just told you: you have five of the same string in your list
<kozikow> That's what I guessed
<kozikow> But now I am trying to understand
<kozikow> why is it so
<_habnabit> apparently `let f () = let s = "foo" in s` will always give you the same string
<_habnabit> # let f () = let s = "foo" in s in f () == f ();;
<_habnabit> - : bool = true
<_habnabit> yep
<kozikow> Well it's good optimization from the point of compiler
<kozikow> but shouldn't it guess that string is mutable?
<_habnabit> personally I would prefer that compilers not 'guess' anything
<kozikow> Is there a way of telling the compiller that I am planning to mutate the object?
<kozikow> I tried adding ref "___"
<kozikow> but it didn't help
<datkin> Just do [String.copy];;
<datkin> Or just [String.create 3]
<Ptival> yes
<kozikow> It works, thanks :)
<Ptival> and it's not an optimization :)
<_habnabit> ref does the opposite of what you want
<kozikow> My guess was that compiler assumes that since this object will be allocated in each function call it allocates it on the first call and then if garbage collector doesn't collect the object it reuses it
<kozikow> So if I would allocate array this way
<kozikow> let's say let arr = [|2;3;4|] and then mutate it
<kozikow> the effect would be the same?
<datkin> The compiler doesn't do anything weird. This is the first line of the compiled function:
<datkin> L1: const "___"
<kozikow> If it's const, so why it allowed me to mutate it without the warning?
<_habnabit> datkin, where do you get that output from?
<kozikow> Is there a way to get readable output from ocaml compiler in anything else than assembler?
<datkin> ocamlc -dinstr (so it's a bytecode instructions, not assembly instructions)
<datkin> ocamlopt -S will give you the assembly though:
<datkin> .ascii "___"
<datkin> It just allocates the string somewhere in the data segment, and references that address every time you call the function.
<kozikow> ocamlc -dinstr looks cool
<kozikow> So, in my opinion, compiler should issue the warning
<kozikow> That I am planning to mutate the thing, which was classified as const
<Ptival> what warning?
<kozikow> That we are mutating the const string
<datkin> I think in this case "const" means something different than what you're thinking.
<Ptival> yes
<datkin> It means something along the lines of "allocate a string with this constant (statically-known) value"
<datkin> And it only gets allocated once.
<Ptival> I think so
<kozikow> It's what it's doing, but imo it's still a quirk in language
<Ptival> kozikow: String.set does in-place modification of a string. Your function is closed over the string, so you're actually modifying the string for all invocations of the function
<Ptival> it is not supposed to be surprising
<Ptival> adding "ref" means now you're closed on a reference to the string, so it doesn't solve the problem, just adds a level of indirection
<kozikow> Yes, I know, but I say that it's counter-intuitive
<_habnabit> programming is an unnatural act; nothing is 'intuitive'
brooksbp has quit [Quit: Leaving]
<kozikow> I'm too used to C++
<kozikow> Anyway, thanks for help everyone :)
<datkin> Where to do something similar you would either allocate a new string everytime you call "triple" or you would allocate the string once outside of the function, and you would have the same problem.
<kozikow> I would use string s = "aaa";
<kozikow> which would call the constructor
<kozikow> In every call and it's basically what I wanted.
<antoineB> hi try to make a function that create a bigram from a list
<antoineB> ex: ["a";"b";"c"] -> [["a";"b"];["b";"c"]]
<antoineB> but my the function type isn't good: val bigram : ('a list -> 'a) list -> ('a list -> 'a) list list = <fun>
<_habnabit> well, yes. that's because you're putting List.hd in your list
<_habnabit> and List.hd is ('a list -> 'a)
<_habnabit> so a list containing List.hd would be ('a list -> 'a) list
Cyanure has quit [Remote host closed the connection]
MaskRay has quit [Remote host closed the connection]
<antoineB> thank you
<_habnabit> (probably you meant to write List.hd r)
<antoineB> yes
<antoineB> just a typing error
letrec_ has quit [Ping timeout: 240 seconds]
emmanuelux has quit [Quit: @+]
<Goldfish137> Hello
ulfdoz has quit [Read error: Operation timed out]
iago has joined #ocaml
g0dmoney- has quit [Ping timeout: 255 seconds]
g0dmoney- has joined #ocaml
lamawithonel__ has quit [Ping timeout: 276 seconds]
lamawithonel__ has joined #ocaml
ulfdoz has joined #ocaml
The_third_man has joined #ocaml
Ptival has quit [Quit: leaving]
Ptival has joined #ocaml
antoineB has quit [Quit: Lost terminal]
cdidd has quit [Remote host closed the connection]
EmmanuelOga has joined #ocaml
oriba has joined #ocaml
snearch has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
lamawithonel__ has quit [Ping timeout: 260 seconds]
lamawithonel__ has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
<Drakken> Goldfish137 hello
ikaros has joined #ocaml
lamawithonel__ has quit [Ping timeout: 248 seconds]
lamawithonel__ has joined #ocaml
Cyanure has joined #ocaml
milosn has quit [Ping timeout: 260 seconds]
Kakadu has quit [Quit: Konversation terminated!]
Smerdyakov has joined #ocaml
milosn has joined #ocaml
Snark has quit [Quit: Quitte]
EmmanuelOga has quit [Ping timeout: 244 seconds]
lamawithonel has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
lamawithonel__ has quit [Ping timeout: 260 seconds]
lamawithonel has quit [Excess Flood]
lamawithonel has joined #ocaml
ftrvxmtrx has joined #ocaml
lamawithonel has quit [Excess Flood]
lamawithonel has joined #ocaml
EmmanuelOga has joined #ocaml
snearch has quit [Quit: Verlassend]
mjonsson has joined #ocaml
mjonsson_ has joined #ocaml
kozikow has quit [Ping timeout: 260 seconds]
sander has joined #ocaml
<sander> hello
<sander> I am using GODI for the first tme
<sander> but I have problem .. It stalls during the build process, it seems to try to fetch ocaml-ssl-0.4.4.tar.gz
<sander> oh
<sander> now, after a long time, it responds "unable to resolve host address `internap.dl.sourceforge.net' "
<adrien> it can take a lot of time in these cases
<sander> is there an option to provide more feedback what it is doing?
Submarine has quit [Remote host closed the connection]
<sander> seems like a nice system though
<adrien> well, that was wget and it was doing much: only waiting
<adrien> and, yes, godi works quite well :-)
<adrien> bedtime for me; good night :-)
Smerdyakov has quit [Quit: Leaving]
<sander> bye
bsdemon has joined #ocaml
bsdemon has quit [Client Quit]
bsdemon has joined #ocaml
antoineB has joined #ocaml
<antoineB> hello, i din't manage to use Std.input_list from extLib in interactive "ocaml" ?
bsdemon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
bsdemon has joined #ocaml
edwin has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
sander has quit [Quit: Leaving]
antoineB has quit [Quit: Lost terminal]
mjonsson has quit [Quit: Leaving]
snearch has joined #ocaml
twittard has joined #ocaml
bsdemon has quit [Quit: Computer has gone to sleep.]
lamawithonel has quit [Ping timeout: 276 seconds]
wagle has quit [Ping timeout: 260 seconds]
mcclurmc has quit [Ping timeout: 245 seconds]
lamawithonel_ has joined #ocaml
Cyanure has quit [Remote host closed the connection]
bsdemon has joined #ocaml
wagle has joined #ocaml
bsdemon is now known as andreypopp
emmanuelux has quit [Quit: @+]
ikaros has quit [Quit: Ex-Chat]
wagle has quit [Ping timeout: 252 seconds]
snearch has quit [Quit: Verlassend]
EmmanuelOga has quit [Quit: WeeChat 0.3.7-dev]
EmmanuelOga has joined #ocaml
emmanuelux has joined #ocaml
emmanuelux has quit [Ping timeout: 245 seconds]
Goldfish137 has quit [Quit: Quitte]
gnuvince has joined #ocaml
lamawithonel_ has quit [Ping timeout: 276 seconds]
wagle has joined #ocaml
andreypopp has quit [Quit: Computer has gone to sleep.]
lamawithonel has joined #ocaml
lamawithonel has quit [Ping timeout: 276 seconds]
lamawithonel_ has joined #ocaml
quintessence has joined #ocaml
lamawithonel__ has joined #ocaml
lamawithonel_ has quit [Ping timeout: 276 seconds]