adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml-lang.org | Public logs at http://tunes.org/~nef/logs/ocaml/
lolcathost has joined #ocaml
avsm1 has quit [Quit: Leaving.]
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
eikke has quit [Ping timeout: 260 seconds]
eikke has joined #ocaml
ben_zen has joined #ocaml
gustav__ has quit [Read error: Connection reset by peer]
chambart has quit [Ping timeout: 244 seconds]
emmanuelux has quit [Ping timeout: 252 seconds]
Xizor has quit [Remote host closed the connection]
lolcathost has quit [Ping timeout: 260 seconds]
cornihilio has quit [Quit: Leaving]
destrius has joined #ocaml
madroach has quit [Ping timeout: 244 seconds]
lolcathost has joined #ocaml
lolcathost has quit [Client Quit]
lolcathost has joined #ocaml
madroach has joined #ocaml
eikke has quit [Ping timeout: 252 seconds]
majorseitan has joined #ocaml
lolcathost has quit [Quit: Lost terminal]
lolcathost has joined #ocaml
mattrepl has joined #ocaml
mattrepl has quit [Quit: mattrepl]
myx has quit [Ping timeout: 265 seconds]
cornihilio has joined #ocaml
<cornihilio> can someone please help me understand this code?: https://gist.github.com/4133869
<cornihilio> also, how do you copy a list in ocaml?
<_habnabit> why would you need to copy a list
<_habnabit> and what do you need to understand about the code
<destrius> the lines "zero -> zero" etc. use ml pattern matching, and is probably not doing what you think its doing
<_habnabit> probably the part that ... ^ yes that
<_habnabit> | zero -> zero matches any value, binds it to the name 'zero', and then returns that value
Yoric has joined #ocaml
<cornihilio> ah, okay
<cornihilio> thank you for that explanation!
BiDOrD_ has joined #ocaml
<cornihilio> could someone perhaps help me figure out what I am doing wrong here?: https://gist.github.com/4133940
<cornihilio> I feel like everything I'm doing is okay... but maybe I'm screwing up that last 'in' clause that calls the function?
BiDOrD has quit [Ping timeout: 260 seconds]
<_habnabit> what's the problem
<cornihilio> I don't know
<_habnabit> so why are you asking for help
<cornihilio> err it's hard for me to understand the compiler errors... does C-c C-r try to compile the entire file in Tuareg mode?
<_habnabit> okay, so, the problem is that you have compiler errors
<_habnabit> next time you should say that!
<cornihilio> err sorry, didn't know what you meant
<cornihilio> haven't gotten that much sleep :P
<_habnabit> http://codepad.org/dadD0uDJ is this the error you got
<cornihilio> yup!
<cornihilio> sorry I should have put that in the paste
<_habnabit> so, i'm not sure what this is even supposed to do
<_habnabit> is x a list of functions?
<cornihilio> err sorry I forgot the initial list in the first definition: https://gist.github.com/4133977
<cornihilio> no x is a number that's being passed
<cornihilio> it's the fizzbuzz problem so I'm trying to make sure I understand ocaml
<_habnabit> did you mean 'match lst with' ?
<_habnabit> instead of match x with
<cornihilio> yup!
Playground has joined #ocaml
lolcathost has quit [Remote host closed the connection]
lolcathost has joined #ocaml
lolcathost has quit [Client Quit]
<destrius> if you're coding stuff to learn ocaml, the problems at project euler can be quite useful
Playground is now known as lolcathost
<cornihilio> that's a good point... I guess I'll do that instead
<cornihilio> thank you destrius!
<destrius> its also easier when asking for help because there's a well defined problem that your code is trying to solve, which people can read to know what you're up to
<destrius> welcome!
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
<cornihilio> why doesn't 1 .. 10;; produce a list? a tutorial I'm reading uses .. to build lists of nums and chars
<cornihilio> I keep getting syntax error in reference to ..
dwmw2_gone has joined #ocaml
<cornihilio> I can't recreate what he's doing with '..' on p.32 of this http://files.metaprl.org/doc/ocaml-book.pdf
rwmjones has quit [Read error: Operation timed out]
rwmjones has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
andreypopp has joined #ocaml
cdidd has joined #ocaml
<adrien> I'm going to be away today too so can someone point beginner42 at the "misc/webkit_test.ml" file in cowboy's sources? it hasn't been kept completely up-to-date (no need for GThreadInit now) but it'll show the PAI
<adrien> s/PAI/API/
<adrien> thanks
mindbender1 has quit [Quit: Leaving.]
Cyanure has joined #ocaml
andreypopp has quit [Quit: sleep]
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
<destrius> cornihilio: again its the difference between expressions and patterns
<destrius> cornihilio: ".." isn't an operator that you can use to produce a range, its used for pattern matching
<destrius> cornihilio: there's no standard ocaml operator to produce ranges, but some libraries like batteries provide something of the form, like "1--10"
lolcathost has joined #ocaml
Yoric has joined #ocaml
pango is now known as pangoafk
mfp_ has quit [Ping timeout: 240 seconds]
andreypopp has joined #ocaml
mindbender1 has joined #ocaml
mfp_ has joined #ocaml
lolcathost has quit [Ping timeout: 255 seconds]
andreypopp has quit [Quit: sleep]
mjonsson has quit [Read error: Connection reset by peer]
mjonsson has joined #ocaml
andreypopp has joined #ocaml
lolcathost has joined #ocaml
djcoin has joined #ocaml
maufred has quit [Read error: Operation timed out]
cago has joined #ocaml
maufred has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
lolcathost has quit [Ping timeout: 255 seconds]
walter has joined #ocaml
kba has joined #ocaml
kba is now known as Guest90714
walter|r has quit [Read error: Connection reset by peer]
Guest46040 has quit [Read error: Operation timed out]
lolcathost has joined #ocaml
maufred_ has joined #ocaml
lolcathost has quit [Client Quit]
maufred has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
chambart has joined #ocaml
Kakadu has joined #ocaml
lolcathost has joined #ocaml
thomasga has joined #ocaml
Neros has joined #ocaml
Yoric has quit [Ping timeout: 265 seconds]
chambart has quit [Ping timeout: 244 seconds]
ontologiae has joined #ocaml
thomasga has quit [Quit: Leaving.]
wormphlegm has quit [Ping timeout: 265 seconds]
wormphlegm has joined #ocaml
eikke has joined #ocaml
mindbender1 has quit [Ping timeout: 265 seconds]
hkBst has quit [Ping timeout: 264 seconds]
k0001_ has joined #ocaml
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
Yoric has joined #ocaml
k0001_ has quit [Ping timeout: 245 seconds]
ftrvxmtrx has quit [Read error: Operation timed out]
larhat has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
mindbender1 has joined #ocaml
cago has quit [Quit: Leaving.]
cago has joined #ocaml
_andre has joined #ocaml
mindbender2 has joined #ocaml
mindbender1 has quit [Ping timeout: 252 seconds]
sepp2k has joined #ocaml
destrius has quit [Quit: Leaving.]
lolcathost has quit [Read error: Connection reset by peer]
lolcathost has joined #ocaml
larhat has joined #ocaml
beginner42 has joined #ocaml
<beginner42> can someone explain me why in minimal example the field House is required?
Neros has quit [Ping timeout: 255 seconds]
Tobu has joined #ocaml
<Kakadu> wut?
<Kakadu> I see module House
Neros has joined #ocaml
<Kakadu> I can't see field called House
<Kakadu> btw
<Qrntz> beginner42, took me a while to understand that this one paste consists of 2 files' contents
<Qrntz> consider delimiting the implementation and the interface by a comment at least
<Kakadu> why your module type and module has same names?
<Qrntz> anyway, I see what you mean
<Qrntz> you didn't write the module interface properly
<Qrntz> creating a module type with the same name is not how you do that
<Qrntz> that's a sure recipe for confusion
<beginner42> Qrntz: the file name is test.ml and my interface is in test.mli
<Qrntz> this does not matter, I just said that you should've mentioned that you stuffed both the implementation and the interface into the same paste
<Qrntz> brb, hold on for a moment
<beginner42> Qrntz: sorry for the confusion. next time i will add a comment
<beginner42> Qrntz: i will be back in 30 minutes
beginner42 has quit [Quit: irc2go]
andreypopp has quit [Quit: sleep]
hkBst_ has quit [Ping timeout: 244 seconds]
andreypopp has joined #ocaml
mindbender2 has quit [Quit: Leaving.]
mfill has joined #ocaml
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
cornihilio has quit [Ping timeout: 240 seconds]
Neros_ has joined #ocaml
Neros has quit [Ping timeout: 245 seconds]
hkBst_ has quit [Ping timeout: 255 seconds]
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
Neros_ has quit [Ping timeout: 255 seconds]
hkBst_ has quit [Ping timeout: 244 seconds]
myx has joined #ocaml
Neros has joined #ocaml
<lambdas> Anyone familiar with ocsigen?
<Qrntz> moderately
<lambdas> Cool. Mind me picking your brains occasionally?
avsm1 has joined #ocaml
beginner42 has joined #ocaml
<beginner42> Qrntz: i am back
<Qrntz> lambdas, I do not, but I'm not really an advanced user
<Qrntz> beginner42, so what were you trying to achieve? just an interface to the House module or something different?
<beginner42> i have a bigger problem and try to recreate it in a smaller problem.But not even that compiles
<Qrntz> this compiles
<Qrntz> does that help or I misunderstood your problem?
<Qrntz> oh, by the way…
<Qrntz> 06:45:28 < adrien> I'm going to be away today too so can someone point beginner42 at the "misc/webkit_test.ml" file in cowboy's sources? it hasn't been kept completely up-to-date (no need for GThreadInit now) but it'll show the PAI
<Qrntz> 06:45:32 < adrien> s/PAI/API/
<Qrntz> 06:45:34 < adrien> thanks
mfill has quit [Quit: leaving]
<Qrntz> I believe he was talking about https://forge.ocamlcore.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=cowboy/cowboy.git;a=blob_plain;f=misc/webkit_test.ml;h=a57a013f798f3be1580238a375c20243c92c3aff;hb=HEAD
<beginner42> Qrntz: thanks for the fix, but why do i need the line module House : HOUSE in the mli file?
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
<Qrntz> because «module type» just describes a signature you can reference by its name when you need to e. g. use it multiple times to expose different modules
fraggle_laptop has quit [Remote host closed the connection]
<Qrntz> see updated gist for an example of code that does the same without redundancy
<Qrntz> I don't think you actually need a module type to be declared, but then again if you explained your aim better…
<Qrntz> in a nutshell, «module type» doesn't bind the signature to any module, it just declares the existence of a type you can restrict module implementations to
fraggle_laptop has joined #ocaml
<beginner42> Qrntz: do i need sig inside the ml file aswell as inside the mli file?
hkBst_ has quit [Ping timeout: 248 seconds]
<Qrntz> beginner42, no, that kind of undermines the purpose of separating the interface and the implementation
<Qrntz> if you just want a module Test.House which only exposes an abstract type «state» and a function «hallo : unit -> unit» to the outside, then that gist is your verbatim solution
Neros_ has joined #ocaml
Neros has quit [Ping timeout: 260 seconds]
ontologiae has quit [Ping timeout: 255 seconds]
avsm1 has quit [Quit: Leaving.]
<beginner42> Qrntz: do i need to write module X : Y in the mli file, if the module type has the same name as module implementation
avsm1 has joined #ocaml
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
hkBst_ has quit [Ping timeout: 252 seconds]
ontologiae has joined #ocaml
<Qrntz> beginner42, you should not call a module type and a module implementation the same name
<Qrntz> and yes, you'll need to specify this if you want to expose your module
<Qrntz> (with the given module type constraint)
Cyanure has quit [Remote host closed the connection]
<beginner42> i always thought i just put the module names in the mli file and by that automatically bind the mli file to the corresponding ml file
<Qrntz> not sure I understood what you meant by that
<Qrntz> if you have just a 1 level deep module, sure
<Qrntz> if you have nested modules you'll have to annotate their signatures
<lambdas> Qrntz: I'm having a lot of trouble trying to make a multi-file ocsigen project. Have you ever done one of those?
<Qrntz> multi-file? to be honest, nope
<Qrntz> so, multiple .cm[ox] modules?
<lambdas> Yeah.
<Qrntz> afraid I won't be able to help you there unless it's OCaml itself that refuses to work and not Ocsigen :-p
avsm1 has quit [Quit: Leaving.]
<lambdas> It's just a problem with the build process, and it not being able to find interfaces when compiling the client code.
<Qrntz> does it error with something like «Could not find the .cmi file for interface X.mli»?
<lambdas> Nah. It just complains about an unbound module.
<lambdas> Namely the module which corresponds to my other .ml file.
Neros has joined #ocaml
<Qrntz> oh
* Qrntz shrugs
Neros_ has quit [Ping timeout: 240 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
cornihilio has joined #ocaml
<yezariaely> Can I write a trinary infix operator? e.g. "a b ^= c"
<Kakadu> yezariaely: you can a ^= b c
<thizanne> yezariaely: the first one would be parsed in (a b) ^= c
<yezariaely> hmm I try to implement Haskell's lenses, a means for simplifying getters/setters for record types
<yezariaely> thizanne: well if it is parsed like that, this would be fine
<thizanne> the second one would be a ^= (b c), thus (^=) a (b c)
<thizanne> yezariaely: then it's a binary infix operator, as usual
<yezariaely> thizanne but it is not parsed like that.
<thizanne> hum
<thizanne> example ?
<yezariaely> second...
<yezariaely> thizanne: let (^=) a b c = a + b + c in 1 2 ^= 3
avsm1 has joined #ocaml
<yezariaely> Error: This expression is not a function; it cannot be applied
<yezariaely> (marking the "1")
<thizanne> 1 2 ^= 3 is (1 2) ^= 3
<yezariaely> This is fine let (^=) (a,b) c = a + b + c in (1,2) ^= 3;;
<yezariaely> yes, that is the problem
<thizanne> ye
<thizanne> that's what i said before
<thizanne> I don't understand what would be "fine" then
<yezariaely> sure, but I want to get rid of the parentheses ;-)
<thizanne> well, you can't :D
Tobu has quit [Ping timeout: 260 seconds]
<thizanne> in OCaml, an function application has the precedence over a binary infixed operato
<thizanne> r
<yezariaely> ok thx. than I'll stick to that.
avsm1 has quit [Ping timeout: 256 seconds]
<lambdas> Qrntz: Phew! Finally got it working. There's definitely something screwy about the build process. It's compiling the files in the wrong order.
<Qrntz> lambdas, what do you use to build?
gustav__ has joined #ocaml
<gustav__> Do you know how to make a .deb out of ocaml source in Ubuntu? I am trying to do it with http://zoggy.github.com/ocamlrss/ right now.
<gustav__> There doesn't appear to be a PPA for it.
<Kakadu> gustav__: what is OCaml source?
<Kakadu> ocaml compiler?
<gustav__> Makefile, mysrc.ml, etc... Builds a lib.
<gustav__> No, an application/program.
<Kakadu> It is very difficult if I you are studing it yourself
<Kakadu> But I have understanded this things a month ago
<Kakadu> so
<gustav__> Hmm.
<Kakadu> I recommend to use git-buildpackage
<gustav__> I have done it before so I'll try that method, but that was a WM written in C.
<gustav__> That didn't work.
<Kakadu> what didn't work?
<gustav__> git-buildpackage. Or, well, it seems like I have to make all the debian/ files...
<Kakadu> yeah, they are simple
<Kakadu> gustav__: btw I have builded some debs last month. And I have to add these files to Qt-based project. See my commits dated 28 October here: https://github.com/bakwc/Pastexen/commits/debian
<lambdas> Qrntz: I'm just using the sample file provided from the website.
<gustav__> Gah. I have a bit of a threshold here. I don't know why.
<gustav__> Simples files but they kill my brain.
andreypopp has quit [Quit: sleep]
<Kakadu> gustav__: yeah
<gustav__> Man. I already had the package. x( I think...
<Kakadu> gustav__: At first days I couldn't realize difference bitween pristine tarball and upstream
<Kakadu> :D
<gustav__> Ah, no. It's doing something bad.
avsm1 has joined #ocaml
<gustav__> Nah. It's installed.
<gustav__> But not from a package... ehm.
<Kakadu> flux: AFAIR you were interesting in OCaml+QML. Are you QML hacker?
<flux> no
<flux> my first qml app is still waiting to be completed :)
<Kakadu> flux: :)
<Kakadu> flux: Maybe do you know one?
<flux> know one completed app?
<flux> or qml hacker?
<Kakadu> qml and OCaml both is bettter
<flux> I know a couple of people who are familiar with it
<flux> but not that combination
<Kakadu> flux: what about QML hacker and interesting in OCaml?
<flux> I don't think I know that one either :)
<flux> maybe I should sell ocaml more..
<Kakadu> ehh
<flux> in fact I'm the only ocaml-writing person I know in person
<Kakadu> I have written some generator, but I look at final OCaml+QML app and this code is a peace of shit
<flux> :-)
<flux> what are you generating?
<Kakadu> and also buggy and I don't know why
<Kakadu> I'm generating class which calls OCaml values inside his methods and which I use in QML as .... a kind of data-provider
<Kakadu> in last implementation I put properties inside of OCaml code and call them from C++
<Kakadu> and I don't like what I've received
<Kakadu> And now I'm thinking about putting properties' values to C++
<Kakadu> because it seems that they always has default value
<Kakadu> and I have found on articale about default QML types
<Kakadu> but this QML types system is extendable by C++ qmlRegisterType
<Kakadu> And I can't predict how everything will look like with this new types
<Kakadu> Aaah, forget
<gustav__> Gah. Now ocamlrss has sent it's pesky little files all over the system. X(
<Kakadu> If you don't afraid to see C++ nightmares tonight you can look at http://pastexen.com/code.php?file=2ulOjyJ.txt&raw
avsm1 has quit [Quit: Leaving.]
<pippijn> your pastebin sucks beyond imagination
<Kakadu> pippijn: pastebin server or paste itself?
<pippijn> Kakadu: pastebin server
<Kakadu> pippijn: I know
<Kakadu> my friends have implemented it recently for fun
<Kakadu> and also desktop app for fast uploading by pressing F9
<pippijn> instead of just text/plain
<Kakadu> omg
<Kakadu> I didn't know
<pippijn> http://pastexen.com/code.php?file=2ulOjyJ.txt&download <- this returns an invalid document (also html, but just half a document)
<pippijn> bottom line
<Kakadu> omg
<pippijn> you can not download a paste unless you use a browser
<pippijn> or maybe the pastebin has a user agent detection
<pippijn> and intentionally produces garbage when you try to download it
<pippijn> either way, it is the worst pastebin I've ever encountered
<pippijn> oh
<pippijn> in fact, you can't even download it with a browser
<pippijn> http://pastexen.com/code.php?file=2ulOjyJ.txt&download <- this just gives you a broken html as .txt download
hkBst_ has quit [Ping timeout: 244 seconds]
<pippijn> http://paste.xinu.at/LMA/ <- this half document
<Kakadu> hahaha
hkBst_ has joined #ocaml
<Kakadu> So bugs are reported
<Kakadu> pippijn: what do you think about generated C++ code?
<pippijn> is this code generated?
<Kakadu> yep
lambdas` has joined #ocaml
<pippijn> not bad
lambdas has quit [Remote host closed the connection]
beginner42 has quit [Quit: irc2go]
ikaros has joined #ocaml
lolcathost has quit [Ping timeout: 248 seconds]
fusillia has quit [Remote host closed the connection]
lolcathost has joined #ocaml
<dmilith> I just defined simple module: https://gist.github.com/5d96d8035015e5662861
<dmilith> anybody have idea how to use it in main.ml ?
<dmilith> I'm using native compiler
<dmilith> Error: Unbound module Signals
<dmilith> although module Signals : sig val attack : int -> string end
<dmilith> this error is while I'm trying to do open Signals;;
<dmilith> i'm compiling it using ocamlopt -o my-binary lib/signals.ml lib/main.ml
<Kakadu> mmm
<flux> dmilith, -Ilib ?
<Kakadu> -I lib
<flux> it needs to find the .cmi file
<flux> also, if you have signals.ml with that contents, you get Signals.Signals.attach
<dmilith> flux: it's said that I don't need interface file
mindbender1 has joined #ocaml
<dmilith> oh
<dmilith> Signals.Signals ? why?
<flux> module.ml results in module Module
<flux> if you put modules under it, they become Module.Foo etc
j2d2j2d2 is now known as j2d2away
<dmilith> flux: -Isignals or -I Signals ?
<dmilith> I just stripped it all to val attack : int -> string in .mli
<Kakadu> dmilith: second
<dmilith> and let in ml
<dmilith> but still nothing
<flux> dmilith, -I adds a directory to the search list
<Kakadu> dmilith: -I lib
<Kakadu> dmilith: not -I Signals
<dmilith> ok
hkBst_ has quit [Remote host closed the connection]
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
<dmilith> hm
<dmilith> Error: Unbound value Signals.attack
<gustav__> When I have a record with ALL elements having option, how should I present that? I can't do a match ... for each and every one? X(
<Kakadu> dmilith: code plz
lolcathost has quit [Ping timeout: 255 seconds]
lolcathost has joined #ocaml
<Kakadu> gustav:
<Kakadu> # type y = { a: int option ; b: string option};;
<Kakadu> type y = { a : int option; b : string option; }
<Kakadu> # let f x = match x with {a=Some aa; b=Some bb} -> true |_ -> false;;
<Kakadu> val f : y -> bool = <fun>
jbrown__ has joined #ocaml
|jbrown| has quit [Ping timeout: 255 seconds]
hkBst_ has quit [Ping timeout: 244 seconds]
mindbender1 has quit [Quit: Leaving.]
<Kakadu> okay
<Kakadu> and these file are in lib directory?
<dmilith> in same dir yes
<dmilith> no, not lib
<dmilith> in lib I have only compiled .o files and cmx and so on
<dmilith> sources are under lib/src
<flux> ocaml doesn't really do well this 'sources and objects in separate directories'
Guest90714 is now known as kba
kba has quit [Changing host]
kba has joined #ocaml
<flux> but I suppose if you have existing .cmx and .cmi file, it should work..
<Kakadu> and cmi file need precompliation
<dmilith> yes. all thre files signals* are in lib
<flux> .cm(x|o)-files are produced from .ml-files, .cmi-files from .mli-files, but .cmi-files are also produced from .ml-files if there is no existing .mli file
<dmilith> but one thing is interesting
ikaros_ has joined #ocaml
<dmilith> I'm using cmxa files as module
<dmilith> when I want to open Unix;; for example
<flux> .cmxa files contain multiple .cmx files
<flux> (they do not contain .cmi-files)
<dmilith> ah. ok
<flux> and .cmi files must be found in order to ocaml know what modules exist
<dmilith> signals.cmi is there.. the error is Unbound value attack
<flux> for example, for Unix module that is /usr/lib/ocaml/unix.cmi
<dmilith> maybe my definition is wrong?
Neros has quit [Ping timeout: 245 seconds]
<Kakadu> dmilith: If you remove .mli file you will get same error?
<dmilith> same
ikaros has quit [Ping timeout: 260 seconds]
<Kakadu> and after that new cmi is regenerated?
<dmilith> ill do clean
<dmilith> nope
<dmilith> nothing's generated
<Kakadu> it should be generated somewhere
<flux> dmilith, when you compile .mli-file, .cmi-file is generated
<flux> I would like to say that "Unbound value Signals.attack" can result in no other error than ocaml not finding signals.cmi
Neros has joined #ocaml
<flux> s/result in/result from/
<dmilith> so I need to do two step compilation?
<flux> actually, hmm
<dmilith> first of all .mlis
<dmilith> and then ml ?
<flux> it can also result if the file symbol attack doesn't exist in module Signals
<flux> dmilith, that's a good way to go
<flux> another way to go would be to say that .cmo depends on .ml and .cmi, and .cmi depends on .mli
<Kakadu> and one more way is to use ocamlbuild-like tools
<flux> but it's a bit tricky in (say) Makefile, becasuse if there is no .mli, then it goes like both .cmo and .cmi depend on .ml
<dmilith> I'm using sh script to compile all stuff
fraggle_laptop_ has joined #ocaml
fraggle_laptop_ has quit [Read error: Connection reset by peer]
<flux> that's an uncommon choice
<dmilith> I really don't like that silent failure things with ocaml ;/
<flux> well, it's not silent, you get an error message ;)
<flux> but I think it should have better diagnostics
ikaros_ has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
<flux> and it doesn't separate between a module not existing in a module and the whole module not existing
<Kakadu> flux: maybe it will be useful for newbies in case of getting error message Nn give some tips like `check A, check B, check C, else go to IRC`
<flux> well, had it originally said 'cannot find signals.cmi', I think dmilith would have been a lot further
<flux> and possibly a follow-up message 'The symbols `attach' is not defined in module Signals'
<flux> but that would have been confusing :)
<flux> (I mean, because it was expected to exist)
emias has quit [Quit: leaving]
ftrvxmtrx has quit [Quit: Leaving]
mye has joined #ocaml
andreypopp has joined #ocaml
andreypopp has quit [Client Quit]
Kakadu has quit []
<dmilith> flux: do You have some example Makefile's to compile all modules and native executable?
<dmilith> cause I'm tired of sh hacking ;]
<flux> dmilith, I suggest to use OCamlMakefile
<flux> I think it goes like
emias has joined #ocaml
<flux> SOURCES := foo.ml bar.ml RESULT := myapp include OCamlMakefile
<flux> and perhaps make nc will then build you a native code binary
<dmilith> holy boly!
<dmilith> ocamlbuild main.native
<dmilith> and all is done automatically :o
<flux> that as well :)
<dmilith> awesome...
<dmilith> now I'm looking for something like monitoring changed ocaml files to invoke compiler automatically
<dmilith> do I need to use external utils for that?
<flux> yes. maybe inotify can do it for you.
<dmilith> not on osx
<flux> correct..
<dmilith> but yea.. I know some unix tools
<dmilith> some languages have this feature built in i just wanted to ask
Submarine has quit [Remote host closed the connection]
<f[x]> hello, is it possible to rewrite http://codepad.org/HSA0del7 without record in 3.12 or 4.0?
<dmilith> interesting that giving 123 as int is fine, but I need to do (-123) for ints smaller than 0
pangoafk is now known as pango
<Qrntz> not always and you can also write it like ~-123
<Qrntz> sometimes OCaml becomes confused between unary and binary minus, ~- is explicitly unary
<cornihilio> I have this code https://gist.github.com/4136286 but I am getting this error: Error: This expression has type int but an expression was expected of type 'a list
Kakadu has joined #ocaml
<Qrntz> cornihilio, I get a different error when interpreting it
mindbender1 has joined #ocaml
<Qrntz> mine is fixed by ensuring proper grouping, that is, «(i + j :: lst)» instead of «(i + j) :: lst»
Cyanure has joined #ocaml
cornihilio has quit [Ping timeout: 256 seconds]
<flux> f[x], have you tried let apply : 'a. 'a list -> unit = fun f -> .. ?
<flux> with 4.0 or possibly 3.12
<flux> (at least not with 3.11)
larhat has quit [Quit: Leaving.]
Neros has quit [Ping timeout: 260 seconds]
cornihilio has joined #ocaml
<cornihilio> Qrntz: why would (i + j :: lst) work and not (i + j) :: lst? isn't that the same thing?
<Qrntz> it would be the same thing if it was the only expression on that line
<Qrntz> function application in OCaml binds tighter than list consing
<cornihilio> ah, okay. I think I get that.
<cornihilio> is there even/odd functions?
<Qrntz> cornihilio, it parses that line as «(fib_rec (i + j) i (i + j)) :: lst» while you need «fib_rec (i + j) i ((i + j) :: lst)»
<Qrntz> but the parentheses in the last argument can be omitted since cons binds loosely
<Qrntz> it's trivial to define them but AFAIK there aren't
<cornihilio> hmm... okay I guess I'll just use one of those recursive examples. It's weird that it's not built in though...
<Qrntz> the standard library is a bit lacking, granted
<Qrntz> a recursive odd/even will work but it's a bit excessive, you could use modulus or land instead
<Qrntz> «N mod 2»/«N land 1»
<Kakadu> about opam
<cornihilio> ah, good point. thank you!
Tobu has joined #ocaml
<Kakadu> Long time ago I have OCaml compiler built from source
<Kakadu> And it has a bug in native codogeneration
<Kakadu> had*
<Kakadu> which was fixed in debian ocaml package
<Kakadu> So I was forced to use debian package for ocaml compiler
<Kakadu> But this opam: How could it understand that I need some specific patch for building compiler?
<dmilith> um.. I'm trying to call unix kill(pid, signal) function.. it returns 0 in C.. it's unit in ocaml..
<dmilith> can I reach to this native C function?
<flux> dmilith, unix module returns errors via exceptions
<dmilith> ah. I see
Snark has joined #ocaml
Neros has joined #ocaml
eikke has quit [Ping timeout: 260 seconds]
eikke has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Ping timeout: 245 seconds]
xavierm02 has joined #ocaml
cornihilio has quit [Ping timeout: 240 seconds]
fraggle_laptop has quit [Remote host closed the connection]
answer_42 has joined #ocaml
Anarchos has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
ulfdoz has joined #ocaml
mattrepl has joined #ocaml
cago has left #ocaml []
<gustav__> Kakadu: Thanks! <3
mindbender1 has quit [Ping timeout: 252 seconds]
Submarine has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
eikke has quit [Ping timeout: 265 seconds]
beckerb has quit [Quit: Konversation terminated!]
beckerb has joined #ocaml
beckerb has quit [Quit: Konversation terminated!]
beckerb has joined #ocaml
beckerb has quit [Ping timeout: 245 seconds]
<invariant> Can I get ocaml to produce code for mips32 too?
<dmilith> what do I do wrong?
<dmilith> I have warnings Warning 11: this match case is unused.
<dmilith> don't get it
<Anarchos> invariant: i think yes, if i remember correctly
<Anarchos> dmilith: let me read it
djcoin has quit [Quit: WeeChat 0.3.9.1]
<invariant> Anarchos, how does the compiler infrastructure work then? Can I just do ocamlc -targetplatform mips32 foo.ml and things work?
<Anarchos> sigint and sigterm are just names you use as a temporary variables
<Anarchos> dmilith: you must replace them by Unix.SIGINT and so on , which are constructors.
<dmilith> uh
<Anarchos> invariant: ocamlc just produce bytecode.
<dmilith> It also works when I give explicit number
<dmilith> cause all of them are ints
<invariant> Anarchos, the option also doesn't exist.
<Anarchos> invariant: you must use ocamlopt to produce assemblers
<invariant> Anarchos, that was a detail in this question.
<flux> dmilith, do something like: terminatePid ~signal:(List.assoc signal [(sigint, sigterm); (sigterm, sigquit); (sigquit, sigkill)]) pid
<dmilith> Error: Unbound constructor Unix.SIGINT
<dmilith> um
<dmilith> let me read through it
<Anarchos> invariant: http://caml.inria.fr/ocaml/index.fr.html says that ocamlopt is available for MIPS
<flux> it's Sys.sigint, but it's not a constructor
<flux> there is a way to use it with match and it is as follows:
<flux> match signal with x when x = Sys.sigint -> ..
<dmilith> I see
<Anarchos> invariant: anyway there is no cross compiler...
<invariant> Anarchos, how can the compiler work then on small targets?
<dmilith> flux: ;] Warning 25: bad style, all clauses in this pattern-matching are guarded.
<Anarchos> invariant: no idea
<Anarchos> dmilith: just add a |_ -> failwith "dead code reached"
<dmilith> yea
mindbender1 has joined #ocaml
<flux> _ -> assert false (* my preferred solution ;) *)
<Anarchos> flux: the failwith can give explanation
<flux> anarchos, is assert false; not an explanation enough?
<flux> "this line of code is impossible to reach or something is very, very wrong"
<adrien> or
<adrien> "I didn't feel like handling this"
<flux> infact, it would be cool if the compiler warned in cases when assert false is reached, when it can statically say it will be reached
<flux> ..I suppose quite a rare case..
<adrien> -fhit-me-with-a-stick-when-I-am-very-stupid
<Anarchos> flux: well if you have 15 bazillions assert false in your code, no it is not very programmer friendly...
k0001 has joined #ocaml
<flux> anarchos, pretty assertive code I'd say..
<Anarchos> but assert false is shorter to type , sure ;)
<dmilith> flux: is it possible to get "name" of constant defined in some module? I mean to get "sigint" from signal number value?
Yoric has joined #ocaml
<Anarchos> dmilith: yes there is such method
<dmilith> which is? :}
<flux> dmilith, no, except by building a function to do that
<dmilith> how?
<flux> by building a list, say, [sigint, "sigint"; sigquit, "sigquit"] etc
<flux> then List.assoc can find the entry from that
<dmilith> I see
<Anarchos> dmilith: maybe using the infamous module Obj ?
<flux> anarchos, no..
<Qrntz> that's not what you suggest to a beginner, Anarchos
<flux> anarchos, he wants to get a descriptive string out from an integer
<dmilith> Anarchos: I started using ocaml.. 2 days ago.
<invariant> opam gives me{ patches } are invalid field names in ...
<flux> the string doesn't exist in the binary
<flux> you need to write it out :)
<dmilith> I see. I was prepared that it's not ruby ;]
mye has quit [Quit: mye]
<flux> you might wonder why sigint and friends are not constructors but rather constant integers
<flux> I believe it's because they wanted to allow a portable executable, maybe
<flux> I find no other reason :)
<Anarchos> Qrntz: maybe but it works ;)
<invariant> This is the file with the problem: .opam/opam/alt-ergo.0.94.opam
<invariant> How can you get opam in a working state?
<Qrntz> Anarchos, in some cases
<invariant> Wasn't opam proposed to be *the* new package manager?
<Anarchos> Qrntz: the list of string is for sure the best solution to dmilith
<adrien> that's a stupid approach tbh
<flux> anarchos, I'm personally very wary of applications using Obj.magic, and should my application segfault, extremely wary :)
<dmilith> flux: so the hidden message is "don't use Obj._" ?
<adrien> no
<Qrntz> Anarchos, agreed (although I would just use a 1-to-1 mapping function for it's not greatly more verbose but looks cleaner to me)
<adrien> don't use Obj.magic
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
<Qrntz> all of Obj is undocumented for a reason
<Qrntz> (not saying it shouldn't be used, of course)
<Qrntz> (being extremely cautious is enough)
<Anarchos> dmilith: i should be more strict : I NEVER use Obj module. It allows you to break the type system....
<dmilith> Anarchos: omg. monkey patching is available in ocaml? ;]
* Anarchos can even not understand why the authors of ocaml released Obj as a standard module.
<invariant> Anarchos, there are more unsafe operations that are useful which hopefully are in OCaml.
<dmilith> it might be case, for hacking purposes
mindbender1 has quit [Ping timeout: 265 seconds]
<dmilith> is there any fflush function in ocaml?
<adrien> dmilith: for use with printf functions?
<dmilith> yes
<dmilith> exactly
<invariant> dmilith, it's better to use functions which make it impossible to make mistakes.
<adrien> then append the %! format to your format string
<adrien> Printf.printf "moooooo!\n%!"
<Anarchos> adrien: i didn't know this one, is it recent ?
<adrien> no
<Qrntz> not at all
<dmilith> printf is unsafe?
<adrien> dmilith: what makes you say that?
<adrien> dmilith: ocaml's printf is safe
<dmilith> invariant: what do you mean?
<invariant> dmilith, functions which take a resource as input, and a function to operate on the resource, but always clean up themselves.
mye has joined #ocaml
<invariant> I installed utop and I installed batteries. How can I display Bat functions in utop now?
<dmilith> invariant: the printf %!" solution works well
mmajchrzak_ has joined #ocaml
mfill has joined #ocaml
ftrvxmtrx has joined #ocaml
k0001_ has joined #ocaml
_andre has quit [Quit: leaving]
k0001 has quit [Ping timeout: 245 seconds]
mfill has quit [Ping timeout: 255 seconds]
mfill has joined #ocaml
mfill has quit [Client Quit]
mfill has joined #ocaml
mfill has quit [Client Quit]
mfill has joined #ocaml
mfill has quit [Client Quit]
<invariant> Can anyone tell me how utop is supposed to work?
<invariant> I am running the opam version of utop, but I don't get why it doesn't pick up the opam ocamlfind libraries.
mfp_ has quit [Read error: Connection reset by peer]
ontologiae has quit [Ping timeout: 245 seconds]
majorseitan has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0/20121120063459]]
mfp_ has joined #ocaml
<invariant> It appears that utop is a program which just has a bunch of constant data compiled in, but doesn't actually use ocamlfind :/
<diml> invariant: it does use ocamlfind, and should find the libraries installed
<diml> are you sure you environment variables are correct?
<invariant> diml, can you explain how to install/configure it with opam then?
<diml> opam install utop
<diml> it usually works
<invariant> diml, that worked.
<invariant> diml, just to be clear, I open utop and type 'Ba' without the quotes and there are no completions.
tane has joined #ocaml
<diml> invariant: which completion do you expect?
<invariant> ocamlfind list | grep bat batteries (version: 1.5.0)
<invariant> invariant, BatArray etc.
<diml> invariant: did you type #use "batteries" first ?
<invariant> invariant, no.
<invariant> diml, no
<diml> you have to do it
<diml> i mean #require, not #use
<invariant> diml, is #require like the concept of a package in Java?
<invariant> diml, that is, it's not possible to just require every package and expect things to work?
<diml> invariant: #require is a directive of the toplevel to add directories to search paths and load libraries
<diml> invariant: no
<diml> well, you can do it by using Topfind directly
<invariant> diml, what happens when a module is provided by two packages?
<invariant> diml, and you require both of them.
<adrien> *BOOM*
<adrien> (actually, no)
<adrien> (I'm just being stupid)
<invariant> I think it would be useful if there would be an option which would just load everything.
<adrien> the best thing to do is to get both authors in a room, both with clubs, and the one who survives can keep the module name
<diml> invariant: in general you don't want to do that
<adrien> i.e. it's better to have one name changed
<diml> yes
<adrien> and usually there aren't such conflicts
<adrien> s/usually //
<adrien> I don't think I've seen one yet
<invariant> diml, I don't want to bother with caring in which package something is either.
<gustav__> http://pastebin.com/8MmEz4WQ Sigh...
<invariant> diml, if there is a conflict, it could just ask me based on some intelligent considerations which one I mean.
<invariant> diml, but then all the types of all the arguments would have to be the same.
<invariant> (which makes conflicts extremely unlikely)
<adrien> invariant: seriously, the only sane answer to conflicts is a fight to death between authors to decide who gets to keep the name
<adrien> assert there are no such conflicts
<invariant> adrien, there are too many OCaml programmers, anyway.
<adrien> that only means more blood
<invariant> diml, although you might feel that such comments don't belong in your README, it would surely help other people.
<diml> invariant: if you really want to load everything: Topfind.load_deeply (Fl_package_base.list_packages ());;
metasyntax|work has quit [Quit: WeeChat [quit]]
<invariant> There are a few conflicts.
emmanuelux has joined #ocaml
<invariant> diml, but it loads in 0.4seconds.
<invariant> diml, in other words: totally awesome! :)
k0001_ has quit [Ping timeout: 244 seconds]
<dmilith> is it a convention to use duck typing in ocaml?
<invariant> diml, how can I tell utop to start with executing that?
<diml> invariant: put it in ~/.ocamlinit
<invariant> diml, you really want to put that into your README too.
<invariant> diml, thanks
<diml> invariant: OK, I'll complete the README
<invariant> I now get: Exception: Symtable.Error _
<invariant> This happens when using the same .ocamlinit with ocaml (not utop).
ikaros_ is now known as ikaros
<diml> this way you will see the error
lolcathost has quit [Ping timeout: 246 seconds]
<invariant> diml, Error: Reference to undefined global `Event'
<diml> invariant: #thread;;
<diml> before loading everything
<invariant> Unknown directive `thread'.
<Qrntz> dmilith, OCaml doesn't have duck typing
<Qrntz> it has structural typing instead
<Qrntz> those two are distinct, despite being confused often
<dmilith> structural typing. interesting
<diml> invariant: try #use "topfind" before
<invariant> diml, that works, but it feels like solving a maze without knowing whether the maze has an exit.
lolcathost has joined #ocaml
<Qrntz> dmilith, the major difference is that duck typing means runtime dynamic type checking
<invariant> diml, I believe what you did was inline the definition of what you said the first time. Is that correct?
<Qrntz> OCaml instead eliminates all the types at compile time after inferring things like structural equality
<invariant> Qrntz, but OCaml also has eval.
<invariant> Qrntz, as such, aren't run-time and compile-time a bit blurred?
<flux> invariant, ocaml has eval in the same sense C has eval.. ?
<dmilith> I'm curious what do You think about http://www.podval.org/~sds/ocaml-sucks.html ?
<Qrntz> invariant, last I remembered, OCaml only had hacky eval via Toploop
<Qrntz> if this not what you meant, you are welcome to elaborate
<invariant> Qrntz, that is what I meant. How is it not the same has the eval Lisp has?
<invariant> er as
<Qrntz> invariant, I'm not particularly familiar with Lisp's eval
<Qrntz> OCaml's eval is quite hacky noting its absence of type safety
<Qrntz> don't think that blurs the definition of compile-time versus run-time
<Qrntz> dmilith, all languages suck, OCaml does it less
<Qrntz> besides, see «Caveats» at that page and remember to always use the right tool for the job nonetheless
<Qrntz> that article is also a bit outdated now
<dmilith> Qrntz: yea, you can find haters of _.
<dmilith> I just on my way of moving my C++ code to Ocaml.
<dmilith> I'm here.. because of Scala..
<dmilith> high level stuff is in scala, low level currently in C++
<Qrntz> doing C++ after you've been introduced to OCaml is a pain
milosn has quit [Ping timeout: 276 seconds]
<dmilith> and C++ is even worse with runtime crashes.. cause they aren't even exceptions
<Qrntz> I tried that and it wasn't pleasant even despite using pretty high-level libraries
<invariant> But in C++ you can build parallel programs.
<dmilith> Qrntz: I'm using functional programming since a half year scheme adventure
<Qrntz> who said you couldn't in OCaml, invariant?
<dmilith> but I was looking for something almost same performant as C++ with higher level of code
<dmilith> so far.. ocaml is a good candidate
<invariant> Qrntz, there is no parallel gc.
<Qrntz> invariant, is there a GC in C++?
<invariant> Qrntz, or fine-grained parallism. I suppose you can fork?
<Qrntz> you sure can
<dmilith> is there any library to communicate between processes? something like Actor in ocaml?
<Qrntz> dmilith, JoCaml, various MPI, ZMQ bindings
<Qrntz> JoCaml is most close to the actor model
<invariant> Qrntz, let me put it differently: can I write a binary tree in OCaml for use in a database in which different threads access different leafs in paralell including updates, etc.?
<Qrntz> invariant, is the hypothetical database itself written in OCaml?
<invariant> Qrntz, yes
<Qrntz> I don't see why you can't, but it wouldn't be easy
<invariant> Qrntz, if the GC runs, the whole world stops, doesn't it?
<invariant> Qrntz, that is one problem.
milosn has joined #ocaml
<Qrntz> no, OCaml's GC is not stop-the-world
<Qrntz> it is incremental
<invariant> Qrntz, generational, you mean?
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 248 seconds]
jamii has joined #ocaml
<Qrntz> it is generational and incremental
<invariant> Qrntz, is the incremental part that it just does small collections and then hands over control back to user code?
dsrguru has joined #ocaml
<invariant> I know what the generation part means.
<dmilith> http://caml.inria.fr/pub/docs/manual-ocaml/libref/Callback.html - I need that to access my ocaml code from C code?
<Qrntz> yes, it interleaves collections with the main program's execution
k0001 has joined #ocaml
<Qrntz> dmilith, yes
lolcathost has quit [Quit: Lost terminal]
<dsrguru> are there any good resources for learning ocaml if you're familiar with other functional languages
<dmilith> brilliant!
<dsrguru> I want something that won't tell me what I already know but rather just focuses on ocaml's specifics
<flux> dsrguru, well, have you looked at the ocaml manual?
<dsrguru> flux: not yet :)
<dsrguru> my goal was to avoid reference materials unless I knew where to jump to
<invariant> Qrntz, can you point at any example in OCaml which provides a level of parallelism comparable to what C++ can provide? I don't mind if it is imperative code.
<invariant> dsrguru, Google works fine in my experience.
<dsrguru> flux: does the manual have a section on ocaml's specifics and idiosyncrasies?
<Qrntz> invariant, it depends on how you define what C++ can provide.
<Qrntz> what is the level of parallelism measured in?
<flux> dsrguru, well, I think it walks through the ocaml features
<dsrguru> invariant: it gave me a lot on the differences between SML and OCaml but not and other languages to OCaml
<invariant> Qrntz, I am thinking of the datastructres in PostgreSQL.
<dsrguru> *not on other
<flux> dsrguru, it doesn't have a section on 'ocaml specialities'
<invariant> Qrntz, these use locks to provide atomicity.
<flux> well, it has parts on the object system and polymorphic variants
<flux> I'm not sure if they document GADTs.. mayeb I should read the documentation again some day: )
Xizor has joined #ocaml
<invariant> Qrntz, in short, you need operations to create threads (os threads) and you need some way of managing access to a shared resource with those threads.
<dsrguru> flux: I'll take a look. I was just wondering if ppl knew of a resource designed for this purpose so I wouldn't have to wade through hundreds of pages to find the five I needed
<dsrguru> kind of like a "Write yourself a scheme in 48 hours"
<dsrguru> but for ocaml instead of haskell
<flux> dsrguru, you can read/skip faster the parts you are familiar with ;)
<flux> like the first intro parts
rwmjones has quit [Read error: Operation timed out]
<dsrguru> flux: haha it looks like I might end up doing that
<invariant> dsrguru, you can also try to read the source code of something big.
<invariant> dsrguru, see how far you get and then lookup things in the manual.
<dsrguru> invariant: that's how I learned C and ruby, but if a more efficient approach existed, that would obviously be preferable
<invariant> dsrguru, there are various books on OCaml too.
<dsrguru> I just wanted to check for its existence here first, rather than repeat what hundreds of others might have done in the past
<Qrntz> invariant, OS threads as in kernel threads?
<invariant> Qrntz, yes
<dsrguru> invariant: the point was if I could find something much shorter than a book
<dsrguru> like what "Write yourself a scheme in 48 hours" is for Haskell
<invariant> dsrguru, you can also just skip the prose.
<invariant> dsrguru, then when you see some code that doesn't make sense, read the whole page.
<dsrguru> yes, I'll probably end up doing that with the official guide
<invariant> I thought the contents of the various OCaml books that I have read was useful.
<dsrguru> I just wanted to know if someone already existed for the purpose of getting functional programmers up to speed with OCaml, since I couldn't find it on google
k0001_ has joined #ocaml
<dsrguru> k
mmajchrzak_ has quit [Quit: Leaving]
<dsrguru> will browse, thanks
<invariant> They are no 'for dummies' books.
<flux> dsrguru, there is a comparison between sml and ocaml that explains many syntactic differences
<flux> dsrguru, while doing that it iterates through many ocaml (and sml) constructs
<invariant> flux, he already referred to that.
<flux> oh indeed he did
<dsrguru> flux: I know. I found that on Google, and that's exactly the kind of resource I'm looking for, except I don't know standard ML
<dsrguru> Jason Hickey's "Introduction to Objective Caml" looks pretty decent
<dsrguru> I'll probably skim that for the code
<dsrguru> oh http://ocaml.org/tutorials/index.html looks promising :)
<dsrguru> all right thanks flux and invariant
<flux> dsrguru, good luck ;)
k0001 has quit [Ping timeout: 256 seconds]
<invariant> Qrntz, can you still answer my question?
k0001_ has quit [Ping timeout: 260 seconds]
<Qrntz> ach, sorry, I went AFK for a bit
<Qrntz> invariant, yes I can
<Qrntz> OCaml threads are lightweight userspace ones and as such are subject to the GIL, I know of no way to use kernel-level multiprocessor-scheduled threads from OCaml natively
cornihilio has joined #ocaml
<ousado> invariant: ocamlnet might be for you
<Qrntz> they weren't meant for parallelism originally, http://mirror.ocamlcore.org/caml.inria.fr/pub/ml-archives/caml-list/2002/11/64c14acb90cb14bedb2cacb73338fb15.en.html is why (according to Xavier Leroy)
rwmjones has joined #ocaml
<Qrntz> but you can achieve parallelism via external libraries, such as (yes) ocamlnet, Plasma et al.
<adrien> Qrntz: no
<invariant> ousado, but isn't there still some overhead when compared to a C++ solution?
<adrien> ocml threads aren't lightweight userspace threads
<Qrntz> ow
<adrien> and they are not not that either
<adrien> first it depends
<ousado> invariant: and if? does it matter?
<invariant> adrien, but there is lwt for that, isn't there?
<adrien> and the common case is kernel threads
<adrien> invariant: for instance, yes
<Qrntz> adrien, I must've mistaken the terminology
<invariant> adrien, that is, you need lwt and os threads.
<flux> there are two kinds of threads in ocaml
<invariant> But I have never seen anyone demonstrate the two together to do something hard.
<flux> there are green threads which are quite light, and then there are posix threads that map to real operating system threads
<adrien> Qrntz: what they have is a lock that prevents several threads from running at once (actually: several threads doing allocations)
<flux> only posix threads are available to natively compiled binaries
<ousado> invariant: ocaml is so fast - if you have some tiny overhead but working code I don't see no problem
<adrien> invariant: to be honest, I'd say mixing the two is usually a bad idea
<adrien> over-engineering
<flux> I think the worst thing is that the Event module isn't fully featured. for example it doesn't do timeouts
<ousado> but if you're writing some climate-change simulation,k take a look at ATS
<Anarchos> Qrntz: the story is not exact.....
<flux> actually the model provided by Event is great (from Concurrent ML), but unfortunately it's watered down by that thing I mentioned (workaroundable) and another thing that's more difficult to fix: it doesn't garbage collect threads (like CML)
<Qrntz> adrien, so there's a GIL that prevents the kernel-level threads in native code from running in parallel
<invariant> ousado, is there an example of a datastructure being updated in parallell in ATS?
<adrien> Qrntz: s/I/A/
<Anarchos> Qrntz: Caml Light had a parallel GC from the start , coming up from the PhD thesis of Damien doligez
<invariant> er parallel
<Qrntz> Anarchos, that didn't work out well according to what I know
<Qrntz> adrien, GAL?
<ousado> invariant: there are some parallel stuff demos, yeah, but honestly, what do you need this for?
<adrien> Qrntz: yes: allocator, or GC
<Qrntz> ah, I see
<invariant> ousado, let's say I care about the environment ;)
<Anarchos> Qrntz: in fact it did work well, but the developers of ocaml found it too difficult to debug
<Qrntz> Anarchos, that's what I'm talking about
<Anarchos> ousado: to interface ocaml with a multithreaded C++ API, i have no choice to need parallelism within ocaml
<Anarchos> Qrntz: ok
<flux> anarchos, you can hide it to a message passing interface with a c++ wrapper :)
<ousado> can't you realease the GIL in ocaml?
<ousado> like in python?
<flux> you can run non-ocaml code in parallel, if that's what you mean
<ousado> yes
<adrien> you can also run ocaml code in parallel
<adrien> provided you don't do allocations :P
<ousado> like a multithreaded C++ thing
<adrien> ousado: take the C function read()
<adrien> it blocks
<adrien> yet, if you run it inside a thread, it won't block other threads
<flux> I had a piece of code that decoded a lot of jpeg files with libjpeg
<ousado> adrien: yes
<flux> it was able to release that lock while doing it, going multicore
<ousado> adrien: with the multithreaded C++ thing I was referring to Anarchos "no choice"
<ousado> which I don't agree with
<Anarchos> flux: no i can't : it is the BeOS API; massively multithread. If i want to mimic in ocaml the C++ objects, i need callbacks in both direction... so multithread in ocaml too
<Anarchos> adrien: you got the point and i have to do allocations ;)
<ousado> Anarchos: well that you want to do something in some certain way is different from having no choice
<flux> anarchos, so a c++ thread can accept the callback and pass a message to the snigle ocaml thread etc.. ?
<Anarchos> flux: worse : the C++ thread can accept a the callback, spawn a new C++ thread which calls ocaml concurrently....
<invariant> This topic is worthless without code.
<Anarchos> flux: anyway i must try to reuse this new "register_callback" thing, which registers the C++ stack to the ocaml GC. It could do the trick for me
myx has quit [Ping timeout: 252 seconds]
nixfreak has joined #ocaml
<nixfreak> can you call inline assembly using ocaml ?
<flux> you can link assembly code in in the same way you can link c code
<flux> there is no inline assembly syntax for ocaml as far as I know
<flux> actually, I think there was this inline C extension, but I haven't tried it.. probably a proof-of-concept rather than a finished solution.
<nixfreak> is there any drivers written in ocaml (examples)?
<flux> there is Mirage, but I don't know of any traditional operating system drivers in OCaml
<ousado> nixfreak: with apologies to the channel, sounds like you want to look at ATS
<nixfreak> ATS ?
<ousado> ats-lang.org
<nixfreak> looking at it now. I looked at a site using Ocaml + GLMLite can ocaml handle the cpu processing of physics and graphics ?
<flux> probably not as well as an average C program, which would likely use a library for it ;)
<flux> there are opencl bindings, though
<flux> (I take it you meant gpu, not cpu?)
Snark has quit [Quit: Quitte]
<nixfreak> yes
cornihilio has quit [Ping timeout: 252 seconds]
dsrguru has quit [Quit: leaving]
cornihilio has joined #ocaml
everyonemines has joined #ocaml
Cyanure has quit [Remote host closed the connection]
Kakadu has quit []
everyonemines has quit [Client Quit]
cdidd has quit [Remote host closed the connection]
lolcathost has joined #ocaml
Anarchos has left #ocaml []
nixfreak has quit [Ping timeout: 265 seconds]
nixfreak has joined #ocaml
Submarine has quit [Remote host closed the connection]
mindbender1 has joined #ocaml
answer_42 has quit [Quit: WeeChat 0.3.9.1]
chambart has joined #ocaml
<dmilith> I don't get it. What's wrong with fork?
<dmilith> threads are overrated a bit
<dmilith> you can always use MPI
<dmilith> or anything like this
<dmilith> but anyway
<dmilith> If somebody wants scalability will use scala on jvm
dwmw2_gone has quit [Ping timeout: 245 seconds]
ikaros has quit [Quit: Ex-Chat]
mindbender1 has quit [Quit: Leaving.]
cornihilio has quit [Ping timeout: 244 seconds]
Anarchos has joined #ocaml
sepp2k1 has quit [Remote host closed the connection]
nixfreak has quit [Ping timeout: 245 seconds]
eikke has joined #ocaml
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
eikke has quit [Ping timeout: 265 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
eikke has joined #ocaml
cornihilio has joined #ocaml
xavierm02 has quit [Quit: Leaving]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
jamii has quit [Read error: Connection reset by peer]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
eikke has quit [Ping timeout: 248 seconds]
tani has joined #ocaml
tani has quit [Client Quit]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
eikke has joined #ocaml
dwmw2_gone has quit [Excess Flood]
tane has quit [Ping timeout: 255 seconds]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
astertronistic has quit [Ping timeout: 244 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
mye has quit [Quit: mye]
mjonsson has quit [Remote host closed the connection]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio> can you create a let binding withing a let? such as this https://gist.github.com/4137886
<cornihilio> not a let function definition, but for a temporary variable