__DL__ changed the topic of #ocaml to: OCaml 3.09.0 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
Smerdyakov has quit ["Leaving"]
Smerdyakov has joined #ocaml
Smerdyakov has quit ["Leaving"]
smimou has quit ["bli"]
Mitar has joined #ocaml
<Mitar> Is there any blog engine written in OCaml?
bluestorm has quit ["Leaving"]
Mitar has left #ocaml []
pnou has joined #ocaml
pnou has quit ["leaving"]
ptseng has quit ["Leaving"]
pango_ has joined #ocaml
clog_ has joined #ocaml
ptseng has joined #ocaml
mwc has joined #ocaml
kryptt has joined #ocaml
ptseng has left #ocaml []
ptseng has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
ptseng has quit [Client Quit]
ptseng has joined #ocaml
clog has quit [Read error: 110 (Connection timed out)]
clog_ is now known as clog
mwc has quit ["brb"]
mwc has joined #ocaml
mkhl has quit []
mwc has quit []
kryptt has quit [Read error: 110 (Connection timed out)]
malc_ has joined #ocaml
malc_ has quit ["leaving"]
ptseng has quit ["Leaving"]
pnou has joined #ocaml
ptseng has joined #ocaml
pnou_ has joined #ocaml
pnou has quit [Read error: 104 (Connection reset by peer)]
<flux__> rongenre, if you want better efficiency, you should use block reading functions
<flux__> rongenre, input_line will need to allocate dynamically memory
humasect has quit ["Leaving.."]
<rongenre> so how should I do it?
<rongenre> turns out, incidentally, that the big pig was calling write_string
<flux__> rongenre, use input
<flux__> you will need to String.make the buffer beforehand, but only once
<rongenre> ah yes.. you know, I did it, allocated a big buffer and used Buffer to accumulate the output lines
<flux__> hmm
<rongenre> should I paste code in, or is there an easy way to share code?
<flux__> there are several paste sites around
<rongenre> link?
<flux__> http://rafb.net/paste/ seems to be one recently used
<rongenre> profiling's showing this to be a bit slower than input_line
<rongenre> I imagine the for loop over the buffer's a pig, but it's hard to tell
<flux__> how long are the lines?
<rongenre> 100 chars is reasonable
<flux__> hmm.. you can actually read multiple lines with that function?
<rongenre> yeah, works fine
<rongenre> (tested by piping through md5. I'm paranoid)
<flux__> oh, right, well you could consider reusing linebuf, by using Buffer.reset
<flux__> I guess the performance is still down because of Buffer.contents, which too needs to allocate memory
<flux__> but I suppose it would result in a more cumbersome interface if you just returned indexes and lengths for the buffer
<rongenre> 4x speed difference between using this and input_line
<rongenre> input_line has an extern function which scans for newlines
<flux__> I take it you've compiled that to binary, not just bytecode?
<rongenre> yup, -O3
<rongenre> unsafe, noassert.. ;-)
<rongenre> I've heard on the mailing list, probably a few years back, that having a buffer stuck in the closure does affect speed negatively
<rongenre> I don't know if that's still the case, probably a decent experiment
<flux__> I think the difference is that the 100 bytes is allocated each time reader () is called
<flux__> while if you would just reuse it, it wouldn't be
<rongenre> well let me see, it won't be thread safe, but it's not like this is java code ;-)
<flux__> well, you can make the function return a tuple (reader, threadsafe_reader) ;)
<flux__> besides it wouldn't be thread safe anyway, due to the handling of the buffer
<rongenre> yeah you're right
<rongenre> it doens't affect the run time though.. here
<flux__> have you compared how fast it would be if instead of Buffer.contents it would return nothing?
<rongenre> let me see... that's another memory allocation, you're right
<rongenre> not a lot differently, actually..
<rongenre> ~19 secs down to ~17
<flux__> removing Buffer.add_char?-)
<rongenre> no, not doing that
<rongenre> checking it out
<rongenre> yeah.. that's half of it
<rongenre> down to ~8 secs
<rongenre> still not as fast as input_line
<flux__> well, you could scan for the next '\n' within the known valid buffer in a separate function
<flux__> I imagine ocaml optimizer might be a bit out of the game when you have variables
<rongenre> yeah, let me try that refactor
<rongenre> kind of what i'd heard regarding how the optimizer could work
<flux__> but, I'm off to office, happy hacking.. it doesn't seem likely you'll get much faster than input_line, though ;)
<flux__> if you're comparing performance to wc -l, maybe you should write a program that does only wc -l
<rongenre> Yeah I should
<rongenre> what's nice is it's still faster than wc in perl ;-)
<flux__> more realistic comparison would be perl -e 'while(<>){++$n}'; or awk '{++n}'
<rongenre> which means I can justify it at work
<flux__> oh, well it's still plenty fast ;)
<rongenre> thanks for your help
<rongenre> i need to sleep as well, it's late in CA
<flux__> maybe you could even compare it to #include <string> #include <iostream> int main() { std::string str; while (std::getline(std::cin, str)) { } }
<rongenre> I dug up the wc code... they do some interesting stuff in terms of optimizing the read
sebell has joined #ocaml
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
sebell has quit ["leaving"]
vodka-goo has joined #ocaml
m3ga has joined #ocaml
malc_ has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
bluestorm has joined #ocaml
<bluestorm> i have a little problem when using format string
<bluestorm> i want to do something like this :
<bluestorm> Printf.printf "%03d" var
<bluestorm> but "3" is a var itself
<bluestorm> i tried to do something like this :
<malc_> Printf.printf "%.*d" 3 3;;
<bluestorm> hum
<bluestorm> really ?
<bluestorm> hum
<bluestorm> how come i never saw it in the manual ?
<bluestorm> thanks a lot
smimou has joined #ocaml
Oatmeat|umn has quit ["Leaving"]
<flux__> hey, that's cool, I didn't know that :-)
knobo_ has quit [Read error: 101 (Network is unreachable)]
_fab has joined #ocaml
knobo has joined #ocaml
<pango> didn't know about ^^ operator until recently too
<malc_> which operator?
<pango> # Printf.printf ("%s, " ^^ "%s!\n") "Hello" "world" ;;
<pango> Hello, world!
<malc_> it's ^ not ^^
<malc_> oh.. hmm
<pango> ^ is for strings
<pango> ^^ is for formats
<flux__> there should be a format_of_string that would check the format string runtime. that is, some function of type string -> 'a, and the compiler would check the rest. unfortunately almost no type information is available runtime
<flux__> maybe that would lead to less stable environment, everybody would start writing * -> 'a -kind of functions ;)
paolino has joined #ocaml
stesch has joined #ocaml
stesch has left #ocaml []
rongenre has quit [Remote closed the connection]
rongenre has joined #ocaml
dvekravy has quit [Read error: 101 (Network is unreachable)]
jeremy_c has joined #ocaml
pnou_ has quit ["leaving"]
pnou has joined #ocaml
jeremy_c has quit ["leaving"]
jeremy_c has joined #ocaml
ski has joined #ocaml
paolino has quit [Excess Flood]
malc_ has quit ["leaving"]
Alive has joined #ocaml
<Alive> Hi!!!
<vegai> Howdy ho.
mkhl has joined #ocaml
<Alive> Who knows Russian?
* ski doesn't know
<bluestorm> hum
<bluestorm> who knows hebrew ?
<ski> hehe
<bluestorm> yesterday i had an error while coding PHP
<bluestorm> looked like hebrew
<Alive> ñ ÎÁ ÒÕÓÓËÏÍ ÐÏÇÏ×ÏÒÉÔØ ÈÏÞÕ!
<bluestorm> so i'm looking for someone to translate :p
* ski wonders whether bluestorm means ivrit ..
<bluestorm> may be ivrit yes
<bluestorm> hum
<bluestorm> :p
<bluestorm> i guess 'ivrit is ivrit in ivrit
<Alive> I no :(
<Alive> äÁ×ÁÊ ÎÁ ÒÕÓÓËÏÍ, Á?
* ski wonders whether vodka-goo knows any russian
<Alive> Not ridiculously
jeremy_c has quit [Remote closed the connection]
<smimou> ski: I know vodka-goo and unfortunately he doesn't speak a word of russian
<ski> hmhm
<Alive> ðÌÏÈÏ, ÞÔÏ ×Ù ÍÅÎÑ ÎÅ ÐÏÎÉÍÁÅÔÅ.
Alive has left #ocaml []
Smerdyakov has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
Smerdy has joined #ocaml
Smerdyakov has quit [Nick collision from services.]
Smerdy is now known as Smerdyakov
smimou has quit ["bli"]
smimou has joined #ocaml
ski has quit [Nick collision from services.]
ski_ has joined #ocaml
ski_ is now known as ski
jeremy_c has joined #ocaml
jeremy_c has quit [Client Quit]
jeremy_c has joined #ocaml
<jeremy_c> Is the tuareg-mode the standard Emacs mode for editing OCaml is there a diff one I should begin with?
<Smerdyakov> I use caml-mode.
<jeremy_c> Any reason? I actually have them both downloaded.
<Smerdyakov> Nope.
<jeremy_c> Smerdyakov: your sopose to tell me : abc is the best, 100% better than the other :-D
<Smerdyakov> jeremy_c, is English your native language?
<jeremy_c> yes. Am I confusing you or using bad English?
<Smerdyakov> Both, but mostly the latter. Come on, "sopose to"?
<jeremy_c> what's wrong w/that?
<Smerdyakov> "You're supposed to tell me..."
<Smerdyakov> ^-- correct way
<jeremy_c> Smerdyakov: many locales have slang that we use, sopose to is just fine, maybe not global.
<jeremy_c> your was bad, yes.
<jeremy_c> you are right.
<Smerdyakov> That's spoken slang. There is no correct written rendition of it.
<jeremy_c> missed the whole point :-/
<pango> does caml-mode support ocamldebug ?
<pango> (because tuareg mode definitely does)
<Smerdyakov> I don't know.
<jeremy_c> pango: it comes with camldebug.ml
<jeremy_c> Just playing with the two and with about 1/2 ounce of knowledge of Ocaml, I tend to enjoy the way Tuareg indents over caml-mode ... However, those preferences may very well change as I learn more.
<pango> that can be modified too
ptseng has quit ["Leaving"]
mkhl has quit []
Smerdyakov has quit ["Leaving"]
Smerdyakov has joined #ocaml
__DL__ has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
<jeremy_c> When running an Ocaml program, I have multiple source files. Can I not just specify all of them on the command line? ocaml abc.ml def.ml ... ?
<Smerdyakov> Who knows. I usually compile programs separately from running them.
<pango> if it works, they must specified in the right order (no forward references)
<pango> check ocamlfind too
<jeremy_c> I am sure I am doing something goofy. I have a source file Protocol.ml ... it's contents are module type PROTOCOL = ... ... ... end ;;
<jeremy_c> Then another source file Com.ml which contains module Com = functor (P : PROTOCOL) -> ... ... ... end ;;
<Smerdyakov> Should be Protocol.PROTOCOL.
<Smerdyakov> Each source file defines a module, not a set of top-level variables/modules.
<jeremy_c> Duh. Didn't open it.
<pango> separate compilation implicitly creates separate modules
skylan has quit [Remote closed the connection]
<pango> open adds some module visible identifiers to current namespace; it's not a requirement, you can also use fully qualified names
<jeremy_c> pango: yeah. I thought I had opened it because PROTOCOL is it's only definition, just thought it might be easier.
skylan has joined #ocaml
skylan_ has joined #ocaml
ski has quit ["NMI"]
twobitsprite has joined #ocaml
skylan has quit [Connection timed out]
<twobitsprite> hey... how would I draw to the X root window with the graphics library? The open_graph function says it accepts a string with arguments, but I'm not sure how to tell it to use the root window...
ski has joined #ocaml
ski has quit ["NMI"]
ski has joined #ocaml
_JusSx_ has joined #ocaml
_fab has quit [Remote closed the connection]
__DL__ has quit [Remote closed the connection]
Smerdyakov has quit ["Leaving"]
Submarine has joined #ocaml
quamaretto_ has joined #ocaml
menace has joined #ocaml
ski_ has joined #ocaml
Smerdyakov has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
humasect has joined #ocaml
Submarine_ has joined #ocaml
Submarine has quit [Nick collision from services.]
Submarine_ is now known as Submarine
malc_ has joined #ocaml
<quamaretto_> Smerdyakov: What's the URL of that site again? (Lost it)
<quamaretto_> I was on there but couldn't muster my mad descriptive skillz
vodka-goo is now known as estelle
<quamaretto_> *scrutiny*. Gah! "softwarecritique.net? softwarecriticism.com? softwarelambastation.nu?"
_JusSx_ has quit ["leaving"]
<Smerdyakov> You didn't even add anything yet.
<quamaretto_> Smerdyakov: I know. I was there.
<quamaretto_> I don't think it will be practical to use deep hierarchies as the main way of categorizing languages. It would be better to place languages in categories according to (mostly) orthogonal characteristics such as strong/weak/no type system, target (interpreted/bytecode/native), lazy vs. non-lazy evaluation, etc.
<quamaretto_> Anyway, I'm gonna go back to work. :) See you later
<Smerdyakov> Who said anything about deep hierarchies?
<quamaretto_> It seems like that is the direction you're going, since the only current language is ML in Functional -> Statically Typed, and it could have it's own sub-languages
<quamaretto_> But if you didn't have that intent, fine
<Smerdyakov> Many views are possible. That's just the one I started with.
Smerdyakov has quit ["eat"]
<quamaretto_> >:| COME BACK HERE
quamaretto_ has quit ["ILL GET YOU SMERDYAKOV"]
<flux__> hmm.. is there a code generator which would allow one embed ocaml inside html, and eventually generate a binary out of it?
<flux__> akin to php, jsp or perl's mason
<flux__> or maybe one could just use some generic tool to do that
<flux__> I can't figure out the keywords to search such beast, though ;)
<flux__> m4 could work, but I would maybe prefer to use syntax such as mason's <% codehere %> or % code here
<flux__> otoh.. writing such a 'code generator' could be a task for sed
<flux__> (or other tool lacking high sophistication, or why not just ocaml lex ;))
Submarine has quit [Connection timed out]
<flux__> perl -pe 'if (!s/^% (.*)/$1/g) { s/(.*?)<%(.*?)%>/$1 . "\"; printf \"%s\" (" . $2 . "); print \""/ge;s/^(.*)$/print "$1\\n";/; }' - it maybe lacks some sophistication, but atleast it serves as a base ;)
<flux__> (implements the forementioned syntax)
exa has joined #ocaml
menace has quit ["Verlassend"]
Smerdyakov has joined #ocaml
mkhl has joined #ocaml
malc_ has quit ["leaving"]
smimou has quit ["bli"]
estelle has quit ["Connection reset by by pear"]