<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 ..
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?
<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
<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(
<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]
<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?
<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.
<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
<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
<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]