Kakadu has quit [Read error: Connection reset by peer]
Kakadu_ has joined #ocaml
<orbitz>
I use option or result monad in ocaml all the time
<Kakadu_>
I think that most used monad in OCaml should be Lwt
* gour
wonders if his question on the mailing list is really not appropriate for ocaml list...or something else
<Kakadu_>
gour: Don't worry. I think Gabriel is too aggressive
<gour>
easy way to chase away new users...
<Armael>
what's the matter ?
<orbitz>
gour: yep, but not going to change him so accept and move on
<Armael>
i didn't knew Gabriel could be aggressive :D
<Kakadu_>
maybe `aggressive` is not most correct term :)
<gour>
if this is his usual behaviour, may be someone could 'moderate' him...if you care for new people...just an idea
<orbitz>
he wasn't really that mean to you
<Armael>
hum, can someone link me the message ?
<Armael>
if there are achives of the ml or something
ontologiae has joined #ocaml
<troydm>
how do i measure code execution time in ocaml?
<adrien>
which code?
<adrien>
(morning and merry christmas :-) )
<troydm>
merry christmas
<troydm>
just say i want to measure a time my function is exucuting
<Armael>
in the da-ocaml there is a profiling section
<adrien>
for a single function, you can use Sys.time: store the time before, get the time after, compute the difference and print it
<adrien>
for bigger programs, as Armael said, you have the developping applications in ocaml book
<troydm>
hmm ic
<troydm>
apparently my code is slow
<troydm>
like very slow
<adrien>
and if you're using Batteries, there are functions to help doing benchmarks
<troydm>
well Sys.time returns processor time
<troydm>
is there a way to get date time in milliseconds
<Armael>
Unix.gettimeofday then ?
<troydm>
like in Java there is System.currentTimeMillis()
<troydm>
isn't Unix module, unix only?
<Armael>
hum yea
<adrien>
gour: btw, while I agree that "+1" comments get annoying when there are many of them, I also think it's valuable to know what people (especially newcomers) think
<troydm>
like gziping the same image using standart gzip takes about 0.066 ms
<troydm>
while this code executes for like 2-3 seconds
<troydm>
i'm not too familiar with Ocaml
<troydm>
but apparently something is really really wrong in this code
<troydm>
code does following:
<fasta>
troydm: isn't gzip level 9 supposed to be slow?
<troydm>
fasta: gzip -9 on the same file takes 0.066 ms
<fasta>
troydm: and the ocaml code is native code?
<troydm>
yes
<troydm>
ocamlopt compiled
<troydm>
Gzip module is part of camlzip library
<fasta>
troydm: can't you eliminate the true expression somehow?
<fasta>
troydm: I'd also expect that the camlzip library already contains such a loop.
<troydm>
if copy then loop () else () <- this?
<adrien>
troydm: use profiling as shown in the da ocaml book
<fasta>
troydm: I understand that yo use it as a flag.
<troydm>
camlzip library doesn't contains loops
<troydm>
atleast i didn't found any
<fasta>
troydm: you should use input, instead of input_byte.
eni has joined #ocaml
<troydm>
input ic buf pos len reads up to len characters from the given channel ic, storing them in string buf, starting at character number pos.
<troydm>
it reads characters
<flux>
troydm, things I would try: 1) profile - ocamlopt + gprof 2) after profiling, notice that single-byte input is very slow and follow fasta's suggestion :)
<fasta>
troydm: I think you should use input and output.
<fasta>
flux: it would help if you (or anyone else with actual OCaml experience) would write a small program to turn a simple oasis program into a profiled version, that is, it should just run the program and output all the possible profiling results which all OCaml tools have to offer.
<fasta>
troydm: if OCaml had a sufficiently smart compiler this wouldn't be needed, but in OCaml you have to write an efficient program yourself and in return you get a compiler that's not dead slow.
<fasta>
flux: perhaps something like that already exists, but it should be placed on ocaml.org in some place where people will see it.
<fasta>
troydm: camlzip just calls zlib in the end, so performance will probably be exactly the same as the command line program.
<fasta>
camlzip is how I like my libraries: documented.
<orbitz>
you also get code you can reason about
<troydm>
it worked using input
<troydm>
thx guys
eni has quit [Ping timeout: 245 seconds]
<troydm>
so
<troydm>
int32 is apparently 32 bits data
<troydm>
is there a method to write it into String buffer?
<troydm>
like i want to write 2x 32 bits integers into buffer
<troydm>
and then write this buffer into a file
<flux>
not built-in, but I know a library to do that exists :)
<flux>
possibly in Batteries
<troydm>
hmm ic
<troydm>
i was just thinking that if i will be saving images as serialized Bigarray
<troydm>
at some point there might be an incompatibility problem
<troydm>
because images saved in that format would be incomaptible with newever Marshal'ed data
<troydm>
so i'm thinking about alternatives
<flux>
well, it's not really likely the Marshal data format is going to change soon, but personally if I were to store some data, I would like to have slightly better control over its format..
wmeyer` has joined #ocaml
<adrien>
and marshal is pretty bad
<adrien>
bad compression and not that fast
ikaros has joined #ocaml
<flux>
gzipped raw data sounds nice to me, because you can extract it with gunzip and imagemagick, probably
<fasta>
Why are you reinventing the wheel?
<adrien>
and Marshal's default compression makes subsequent compression steps less effective
<fasta>
There exist binary solutions that solve this problem in a cross-platform way.
<flux>
yeah, png-files would probably be a far more optimal solution :)
<adrien>
fasta: Marshal is built into ocaml and is simple
<adrien>
flux: it's quite likely Marshal's format won't change soon but your program's types will and then marshal is awful :P
<orbitz>
binprot! :)
<fasta>
adrien: you mean the internals are simple?
<flux>
fasta, simple to use.
<flux>
and you can stick any auxiliary data to it while you are at it, with basically zero effort
<fasta>
flux: anything that is built in would be easy to use.
<flux>
fasta, exactly, that's what we're telling you :)
<fasta>
flux: but they could just have used an existing format that is cross-platform, etc.
<fasta>
flux: and also already has libraries for other languages to read and write.
<adrien>
Marshal is *WAY* older than any other binary serialization format out there
<fasta>
adrien: how old is it?
<flux>
I think ASN.1 is *WAY* older?
leoncamel has joined #ocaml
<adrien>
well, I think Marshal exists because the functionality is used in the compiler
<adrien>
and I wonder if it's not from the virtual machine
<fasta>
Is it a binary file format for terms?
<fasta>
There are other libraries for that too.
<fasta>
(debugged libraries, that is)
<fasta>
Anyway, I thought it was a good thing if one could off load maintenance effort into a third party library.
<fasta>
Closures might indeed not be handled by the ATerm format.
<wmeyer`>
hi
<adrien>
morning
asmanur has quit [Ping timeout: 265 seconds]
<fasta>
adrien: well, I think the ATerm Format would probably be more than adequate for what it needs.
<fasta>
Closures can certainly be represented.
<wmeyer`>
marshal is required for bootstraping the compiler, all the intermediate formats including bytecode files rely on marshal
<adrien>
fasta: ocaml uses that for the debugger and for sending the output of the preprocessor to the compiler
<fasta>
adrien: what?
asmanur has joined #ocaml
<fasta>
wmeyer`: how can one boostrap the compiler?
<fasta>
wmeyer`: a C compiler?
<adrien>
with pain :P
<wmeyer`>
gcc is self bootstraping
<wmeyer`>
ocaml has a bytecode versions in boot as binary blobs
<adrien>
the serialization format needed by ocaml has pretty strict requirements so it's not easy to use something else
<adrien>
so it first compiles ocamlrun (which is C) to your machine
<adrien>
and ocamlrun runs the bytecode (since the bytecode is portable)
<wmeyer`>
fasta: not everything of course bootstrapable, you still need to write a bit of C code or some more code to make bootstrapping possible or keep the older version
<fasta>
wmeyer`: so, the binary blobs could contain little spying machines?
emmanuelux has joined #ocaml
<wmeyer`>
fasta: spying machines what do u mean?
<fasta>
Trusting trust was at the time already not ground breaking.
<fasta>
But it surprises me that nobody has learnt anything.
<fasta>
wmeyer`: I mean that if there is code in that binary that does something a user probably doesn't want to see happening, they would likely never find out.
<wmeyer`>
so how do you imagine not having binaries?
<flux>
at some point you will likely use a vendor-provided assembler for buildling the binary
<wmeyer`>
that's one of the reasons that ocamlc exists
<flux>
or use the operatnig-system-provided IO functions
<wmeyer`>
so you have runtime C layer for that.
<adrien>
I like GHC
<adrien>
it's not even something you build
<adrien>
s/build/bootstrap/
<adrien>
full blob
<fasta>
wmeyer`: you would start with 1200 lines for a forth interpreter. With that Forth interpreter, you then implement the calculus of inductive constructions, then you write your compiler in that.
<wmeyer`>
sure, i know all of it
<wmeyer`>
but that's not the way how OCaml works :-)
<fasta>
flux: sure, but there is no reason to make it too easy.
<fasta>
flux: because people could still run different operating systems and implement these system calls themselves, etc.
<fasta>
Or compile the compiler in some very secure environment, etc.
<fasta>
If I was working for the French secret service, I would surely use INRIA as a way to steal company secrets.
<adrien>
I prefer to have a smallish blob to bootstrap rather than a recipe to do it myself
<adrien>
from other binaries anyway
<flux>
fasta, not that bad idea possibly, given it's being used by some trading houses!
<fasta>
flux: exactly.
<flux>
darn, you weren't being factitious :)
<fasta>
flux: that perhaps could help the French economy a bit.
<fasta>
Then again, if the US would ever find out...
<fasta>
The US has stolen plans from AirBus before, didn't they?
<wmeyer`>
why not use linux network binary drivers for it fasta?
<fasta>
wmeyer`: they are probably also doing that.
<orbitz>
if I am defining an inner module can I refer to the outter modules types if I have shadowed them at all?
<fasta>
wmeyer`: or at least some party is doing that.
<fasta>
wmeyer`: this is one of the reasons people want a completely open machine.
<fasta>
It's interesting for business too, since they also do need to manage their secrets.
<wmeyer`>
orbitz: if you shadowed them then there is no way to refer
<orbitz>
dang nabbit
<fasta>
Perhaps there are more pressing security concerns first... like being able to print a document without a segmentation fault...
<wmeyer`>
orbitz: yes, you can refer to environment in inner modules
<orbitz>
wmeyer`: ?
leoncamel has quit [Ping timeout: 252 seconds]
<orbitz>
wmeyer`: come again?
<fasta>
Still, I think that as a software industry the general performance deserves the lowest possible grade: a 0.
<orbitz>
fasta: you're being hyperbolic
<fasta>
orbitz: if you look at the enormous amount of security problems in critical software, I don't think so.
<wmeyer`>
fasta: o <------ this is a button to switch you off :-)
<orbitz>
fasta: then 0 means something different to you than to me
<orbitz>
But I don't really have an interest in one of your long irrational rants today
emmanuelux has quit [Remote host closed the connection]
<wmeyer`>
stuck with Xmonad on my AC100 (which is good, apart is completely different than Stump and missing some customisations), I can't compile my stumpwm on arm
<Armael>
thx
emmanuelux has joined #ocaml
<wmeyer`>
stumpwm uses Common Lisp for configs, but I have so many of them that I don;t know if it;s feasible at all to port it to Xmonad
<wmeyer`>
so many = one big .stumpwmrc
* gour
just returned from the walk with his small daughter (along the river side)
<troydm>
so i wrote my implementation of int32 -> to character
<wmeyer`>
troydm: unicode character?
<Armael>
i miss a WM (maybe xmonad inspired) in ocaml
<troydm>
no just 4 chars
<troydm>
so should i return a tuple
<troydm>
or list?
<troydm>
which one is faster?
<wmeyer`>
tuple
<wmeyer`>
none
<wmeyer`>
but tuple is more type safe
<wmeyer`>
it's type would char * char * char * char
<wmeyer`>
and not char list
<wmeyer`>
sctually sorry
<wmeyer`>
tuple *IS* faster than list of course
<wmeyer`>
because it allocates a single block
<wmeyer`>
where list will allocate a block for each cell
<troydm>
ic, thx
<wmeyer`>
so tuple works a bit as hetergonous vector of fixed length
<wmeyer`>
troydm: use tuples where you know that you don;t want to change the size and the size is known during contructions of the structure
<wmeyer`>
also tuples can contain different types, where list cannot
<troydm>
well technicly i could have done String.create 4
<troydm>
and and set characters that way
nimred has quit [Ping timeout: 246 seconds]
<troydm>
but i don't think it's faster than tuple
<wmeyer`>
it depends what you want
nimred has joined #ocaml
<wmeyer`>
you see, this constant 4 will not appear in the type
<wmeyer`>
so you are baking up a runtime assumption to your program
<wmeyer`>
where solution with tuples protects you from this
<wmeyer`>
surely in the end you want to convet it to string and print it or whatever, but it's much easier to use tuple in your case, rather than list or string
cdidd has quit [Remote host closed the connection]
leoncamel has joined #ocaml
fusillia has quit [Ping timeout: 252 seconds]
mye has joined #ocaml
ulfdoz has joined #ocaml
tane has joined #ocaml
tane has quit [Quit: Verlassend]
eni has joined #ocaml
hongboz has joined #ocaml
pango_ has quit [Ping timeout: 255 seconds]
fusillia has joined #ocaml
fusillia has quit [Remote host closed the connection]
wmeyer`` has joined #ocaml
wmeyer` has quit [Ping timeout: 246 seconds]
ttamttam has joined #ocaml
ttamttam has quit [Quit: Leaving.]
pango_ has joined #ocaml
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
Kakadu_ has quit [Read error: Connection reset by peer]
Kakadu_ has joined #ocaml
* gour
has noticed kind reply from Gabriel :-)
<asmanur>
he bites only people using haskell
hongboz has quit [Ping timeout: 250 seconds]
Kakadu_ has quit []
<adrien>
there's no need to bite them: using haskell is already painful enough :P
<gour>
who are those people "using haskell" ?
<adrien>
half of the population of azylums ;-)
* adrien
has yet to read the reply
<adrien>
(after I'm done cleaning the kitchen some more)
<pippijn>
I like haskell
<gour>
at the moment i'm trying to psot via gmane, but ml software wants me to confirm every message. :-( anyone here having any influence on the list's policy to either allow posting vai gmane or, at least, change info at gmane which is misleading?
<gour>
no need to say i prefer gmane and not list subscription which requires filtering/sorting/administering income messages which is coming for free with nntp
eni has quit [Ping timeout: 265 seconds]
<flux>
maybe you can subscribe without receiving messages
jpdeplaix has quit [Ping timeout: 248 seconds]
jpdeplaix has joined #ocaml
<gour>
flux: mailman can do it, but not sure about sympa...this link https://sympa-roc.inria.fr/wws/info/caml-list asks for uername/password and can't find other info about sympa's admin part
<gour>
vim/omlet support for ocaml is on the same level as emacs/tuareg/typerex?
ulfdoz has quit [Ping timeout: 246 seconds]
ikaros has quit [Quit: Ex-Chat]
ulfdoz has joined #ocaml
<adrien>
iirc the ocaml team doesn't really get to decide what goes on with the mailing-list software and configuration
<gour>
ahh...that explains it
hongboz has joined #ocaml
mye has quit [Quit: mye]
<adrien>
ocp-build isn't publicly available, right? (except as the build system for opam)
lorilan has left #ocaml []
lorilan has joined #ocaml
Yoric has joined #ocaml
eni has joined #ocaml
gnuvince has joined #ocaml
eni has quit [Ping timeout: 252 seconds]
eni has joined #ocaml
ftrvxmtrx has joined #ocaml
gnuvince has quit [Ping timeout: 252 seconds]
fayden has joined #ocaml
myx has quit [Read error: Operation timed out]
eni has quit [Ping timeout: 256 seconds]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
eikke has joined #ocaml
hongboz has quit [Ping timeout: 260 seconds]
ontologiae has joined #ocaml
ontologiae has quit [Read error: Operation timed out]
weie has quit [Quit: Leaving...]
gnuvince has joined #ocaml
lamawithonel has joined #ocaml
eni has joined #ocaml
lamawithonel has quit [Ping timeout: 260 seconds]
jewel has quit [Ping timeout: 246 seconds]
lamawithonel has joined #ocaml
jewel has joined #ocaml
cdidd has joined #ocaml
lamawithonel_ has joined #ocaml
lamawithonel has quit [Ping timeout: 252 seconds]
ontologiae has joined #ocaml
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
eni has quit [Ping timeout: 252 seconds]
jewel has quit [Ping timeout: 252 seconds]
lamawithonel__ has joined #ocaml
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel__ has quit [Client Quit]
lamawithonel has joined #ocaml
Kakadu has quit []
gour has quit [Quit: WeeChat 0.3.8]
lolcathost has joined #ocaml
wmeyer``` has joined #ocaml
wmeyer`` has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 246 seconds]
lamawithonel has quit []
Ptival is now known as Ptivadvent
gnuvince has quit [Ping timeout: 255 seconds]
leoncamel has quit [Ping timeout: 252 seconds]
eikke has quit [Ping timeout: 252 seconds]
wmeyer``` has quit [Remote host closed the connection]