ayrnieu changed the topic of #ocaml to: OCaml 3.08.4 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 joined #ocaml
__DL__ has quit [Remote closed the connection]
Gueben has quit [Read error: 104 (Connection reset by peer)]
mlh_ has joined #ocaml
teiax has quit ["This computer has gone to sleep"]
Skal has quit [Remote closed the connection]
znutar has quit [Read error: 110 (Connection timed out)]
Nutssh has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
AndroFlux has joined #ocaml
_fab has joined #ocaml
humasect_ has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
humasect has quit [Read error: 110 (Connection timed out)]
twobitsprite has quit ["Lost terminal"]
avlondon1 has joined #ocaml
znutar has joined #ocaml
avlondono has quit [Read error: 110 (Connection timed out)]
mrsolo has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
avlondon1 is now known as avlondono
<faigo> any tips of ocaml in latex?
mwc has joined #ocaml
CruX_ has quit [Remote closed the connection]
CruX has joined #ocaml
znutar has quit ["Leaving"]
AndroFlux has quit ["leaving"]
AndroFlux has joined #ocaml
humasect_ has quit ["Leaving.."]
Kempston has joined #ocaml
<Kempston> how do i leave function ?
pango_ has joined #ocaml
<Nutssh> Throw an exception or just let it walk off of the end (where there's an implicit return)
<Kempston> how do i throw an exception ?
<Kempston> failwith returns me from function that called function as well
<Kempston> raise tells me i'm returning wrong type
Codename_V has joined #ocaml
<Codename_V> hey guys. when I just run ocaml, and I'm at the interactive prompt, how do I use libraries? I tried "open Unix;;", but that didn't seem to help much.
pango has quit [Read error: 104 (Connection reset by peer)]
<ax> i think it is #load "unix.cma"
Kempston has left #ocaml []
<Codename_V> hmm, load is an unbound value it's telling me
<ax> use #load
<ax> i got confused the first time too :)
<Codename_V> ah, gotcha
<Codename_V> thanks a bunch
AndroFlux has quit ["leaving"]
mwc has quit ["leaving"]
<Codename_V> hmm, so I'm trying to make a simple irc client. anyone have any ideas why it would die halfway through spitting out the message of the day?
<Codename_V> here's my crappy code: http://rafb.net/paste/results/7yJcav56.html
<Smerdyakov> Oh, didn't you know? You need to use the optional 'dontDieHalfwayThroughMOTD' parameter to socket functions.
<mlh_> gets me every time
threeve has quit []
Snark has joined #ocaml
__DL__ has joined #ocaml
<pango_> ThreadUnix is deprecated
pango_ has quit [Remote closed the connection]
ski has joined #ocaml
mlh_ has quit [Client Quit]
vezenchio has joined #ocaml
Snark has quit [Read error: 113 (No route to host)]
Snark has joined #ocaml
Snark has quit [Remote closed the connection]
Gueben has joined #ocaml
Snark has joined #ocaml
ejt has joined #ocaml
Benooit has joined #ocaml
faigo has quit [Read error: 110 (Connection timed out)]
faigo has joined #ocaml
Gueben has quit [Connection timed out]
juri has quit ["leaving"]
Skal has joined #ocaml
jave has joined #ocaml
<jave> is there some autodoc like facility for ocaml programs?
revision17 has quit [Read error: 110 (Connection timed out)]
faigo has left #ocaml []
revision17 has joined #ocaml
<haakonn> you mean ocamldoc?
<CruX> can i use gdb,ddd,kgdb for debugging ocaml binaries ?
<CruX> and gprof ?
<ejt> you can use gprof on native builds, ocamldebug on bytecode builds
<jave> haakonn: im a newbie, ill check out ocamldoc
shrimpx has quit [niven.freenode.net irc.freenode.net]
det has quit [niven.freenode.net irc.freenode.net]
ax has quit [niven.freenode.net irc.freenode.net]
skylan has quit [niven.freenode.net irc.freenode.net]
TaXules has quit [niven.freenode.net irc.freenode.net]
Hipo has quit [niven.freenode.net irc.freenode.net]
shrimpx has joined #ocaml
TaXules has joined #ocaml
Hipo has joined #ocaml
ax has joined #ocaml
skylan has joined #ocaml
det has joined #ocaml
faigo has joined #ocaml
<haakonn> i really miss a gui-based easy-to-use debugger for ocaml :(
<haakonn> i use kprof pretty successfully though
Benooit is now known as Gueben
Nutssh has quit ["Client exiting"]
vodka-goo has joined #ocaml
<haakonn> i'm pondering a way to iterate a list. i'm thinking i'd like to do some operation on the head, and then return the result along with a function that can be called if the caller wants to continue iteration on the rest of the list, so as only to do as much work as necessary. the idea is that the caller doesn't have access to the list being iterated, and i don't want to start from the beginning of the list each time. sounds sane? is this a technique that could work
<ski> yes (depending on what you want it for)
<ski> do you want to return a plain lazy stream ?
<haakonn> i don't know about stream; i simply want to return a value of some type
<haakonn> (and the function to "continue")
<mflux_> codename_v, does the server say 'ping' at any time?
<ski> what is the value you want to return ?
<ejt> sounds like a lazy stream to me
<haakonn> ski: it's a value of some sum type (same as the head of the list in question)
<ski> is it some local frozen state to be passed to the returned function ? or something that's genuinely useful to the environment ?
<haakonn> not sure what that means, but i'm guessing the first :)
<haakonn> i will look into lazy streams though
* ski would guess you want the second
<ski> anyway, the second is more or less streams
<haakonn> are we talking streams as in the standard Stream module?
<haakonn> or anywhere else i could learn about this?
<haakonn> looking at Stream, looks very useful
<ski> depends .. standard Streams are ephemeral .. maybe that is sufficient (or you want that), maybe you need persistent streams
<ski> also, maybe you want just infinite streams maybe you want possibly finite streams
<ejt> or just implement what you described, it'll work
<ski> yes
smimou has joined #ocaml
<haakonn> ok, though i have a hard time trying to think so high-orderly
mrpingoo has joined #ocaml
<ejt> haakonn: your way seems a little complicated, I would just write a map_until function, that takes the operation to do on each item and a predicate to say whether to continue
<haakonn> ejt: i've been considering that same thing, but for some reason i decided not to, hmm
<haakonn> if i can't remember the reason it may not have been a good one ;)
<ejt> :) it should be quick to try anyway
vodka-goo has quit [Read error: 110 (Connection timed out)]
TeXitoi has quit ["Lost terminal"]
<haakonn> Stream.empty: "Return () if the stream is empty, else raise Stream.Failure" -- huh, why not just return a bool?
<mflux_> I think the point is to use them with the stream parsers?
<mflux_> which may actually prefer the exception approach
<mflux_> haakonn, have you given a look to the calmp4o language extension for streams?
<haakonn> no ... i'm going down the predicate route, but i was just looking at the Stream doc and thought it was weird
<haakonn> thanks
threeve has joined #ocaml
exa has joined #ocaml
Submarine has joined #ocaml
mrpingoo has quit []
shrimpx has quit [niven.freenode.net irc.freenode.net]
det has quit [niven.freenode.net irc.freenode.net]
ax has quit [niven.freenode.net irc.freenode.net]
skylan has quit [niven.freenode.net irc.freenode.net]
TaXules has quit [niven.freenode.net irc.freenode.net]
Hipo has quit [niven.freenode.net irc.freenode.net]
bacam has quit [niven.freenode.net irc.freenode.net]
slashvar[lri] has quit [niven.freenode.net irc.freenode.net]
ejt has quit [niven.freenode.net irc.freenode.net]
vezenchio has quit [niven.freenode.net irc.freenode.net]
oracle1 has quit [niven.freenode.net irc.freenode.net]
mflux_ has quit [niven.freenode.net irc.freenode.net]
pattern has quit [niven.freenode.net irc.freenode.net]
Hadaka has quit [niven.freenode.net irc.freenode.net]
noj has quit [niven.freenode.net irc.freenode.net]
Skal has quit [niven.freenode.net irc.freenode.net]
Submarine has quit [niven.freenode.net irc.freenode.net]
faigo has quit [niven.freenode.net irc.freenode.net]
CruX has quit [niven.freenode.net irc.freenode.net]
cmeme has quit [niven.freenode.net irc.freenode.net]
Smerdyakov has quit [niven.freenode.net irc.freenode.net]
pnou has quit [niven.freenode.net irc.freenode.net]
descender has quit [niven.freenode.net irc.freenode.net]
threeve has quit [niven.freenode.net irc.freenode.net]
revision17 has quit [niven.freenode.net irc.freenode.net]
__DL__ has quit [niven.freenode.net irc.freenode.net]
tom_p has quit [niven.freenode.net irc.freenode.net]
Amorphous has quit [niven.freenode.net irc.freenode.net]
batdog has quit [niven.freenode.net irc.freenode.net]
vincenz has quit [niven.freenode.net irc.freenode.net]
haakonn has quit [niven.freenode.net irc.freenode.net]
mw has quit [niven.freenode.net irc.freenode.net]
rossberg has quit [niven.freenode.net irc.freenode.net]
j_n has quit [niven.freenode.net irc.freenode.net]
Codename_V has quit [niven.freenode.net irc.freenode.net]
_shawn has quit [niven.freenode.net irc.freenode.net]
exa has quit [niven.freenode.net irc.freenode.net]
Gueben has quit [niven.freenode.net irc.freenode.net]
Snark has quit [niven.freenode.net irc.freenode.net]
ski has quit [niven.freenode.net irc.freenode.net]
avlondono has quit [niven.freenode.net irc.freenode.net]
_fab has quit [niven.freenode.net irc.freenode.net]
jave has quit [niven.freenode.net irc.freenode.net]
mfurr has quit [niven.freenode.net irc.freenode.net]
joeytwiddle has quit [niven.freenode.net irc.freenode.net]
gim has quit [niven.freenode.net irc.freenode.net]
Banana has quit [niven.freenode.net irc.freenode.net]
mattam has quit [niven.freenode.net irc.freenode.net]
Codename_V has joined #ocaml
_shawn has joined #ocaml
exa has joined #ocaml
jave has joined #ocaml
Gueben has joined #ocaml
Snark has joined #ocaml
ski has joined #ocaml
avlondono has joined #ocaml
_fab has joined #ocaml
mfurr has joined #ocaml
joeytwiddle has joined #ocaml
gim has joined #ocaml
Banana has joined #ocaml
mattam has joined #ocaml
__DL__ has joined #ocaml
rossberg has joined #ocaml
revision17 has joined #ocaml
tom_p has joined #ocaml
bacam has joined #ocaml
slashvar[lri] has joined #ocaml
Skal has joined #ocaml
threeve has joined #ocaml
shrimpx has joined #ocaml
TaXules has joined #ocaml
Hipo has joined #ocaml
ax has joined #ocaml
skylan has joined #ocaml
det has joined #ocaml
haakonn has joined #ocaml
ejt has joined #ocaml
vezenchio has joined #ocaml
mflux_ has joined #ocaml
oracle1 has joined #ocaml
descender has joined #ocaml
j_n has joined #ocaml
pattern has joined #ocaml
Smerdyakov has joined #ocaml
Submarine has joined #ocaml
faigo has joined #ocaml
Amorphous has joined #ocaml
Codename_V has quit [niven.freenode.net irc.freenode.net]
_shawn has quit [niven.freenode.net irc.freenode.net]
_shawn has joined #ocaml
mw has joined #ocaml
cmeme has joined #ocaml
vincenz has joined #ocaml
pattern has quit [niven.freenode.net irc.freenode.net]
batdog has joined #ocaml
CruX has joined #ocaml
pnou has joined #ocaml
Naked has joined #ocaml
noj has joined #ocaml
Naked is now known as Hadaka
pattern has joined #ocaml
Codename_V has joined #ocaml
Codename_V has quit [niven.freenode.net irc.freenode.net]
mikeX has joined #ocaml
revision17 has quit [Read error: 110 (Connection timed out)]
revision17 has joined #ocaml
no_dammagE has joined #ocaml
no_dammagE has quit [Remote closed the connection]
Codename_V has joined #ocaml
MarcWeber has joined #ocaml
ski_ has joined #ocaml
Submarine has quit [Remote closed the connection]
ski has quit [Read error: 110 (Connection timed out)]
teiax has joined #ocaml
mw has left #ocaml []
mellum has joined #ocaml
MarcWeber has quit ["leaving"]
<mellum> can somebody explain this to me? module IntMap = Map.Make(struct type t = int let compare = compare end);; let s = List.fold_left (fun s x -> IntMap.add x 0 s) IntMap.empty [3; 17; 666] in IntMap.fold (fun x _ () -> print_int x) s ()
<mellum> why does this print 666173 and not 317666? The manual says I get the keys in increasing order...
mikeX has quit ["Leaving"]
Schmurtz has joined #ocaml
CruX has quit [Nick collision from services.]
CruX has joined #ocaml
CruX has quit [Nick collision from services.]
CruX_ has joined #ocaml
<mfurr> mellum: it appears the manual does not match the implementation... perhaps you should submit a bugreport to inria
gim has quit ["reboot"]
gim has joined #ocaml
ski_ is now known as ski
SmerdyOffice has joined #ocaml
<SmerdyOffice> Anyone know an assembly language frontend for OCaml? (I need x86 in particular.)
<SmerdyOffice> Actually, I mean a machine language frontend.
<teiax> do you mean to do something like inline assembly?
<teiax> or a VM
<teiax> ?
<SmerdyOffice> I want to parse machine code so that I can analyze it.
<teiax> ah, that sounds like fun
ski has quit ["foo"]
<teiax> but I don't know of any already built
<Schmurtz> Smerdyakov, you may consider tout write some glue code in C
<Schmurtz> it's easy to call C code from ocaml
<Schmurtz> and write asm commands in your C code
<teiax> I don't think thats what he has in mind though
<Schmurtz> er, I don't answer the question...
<teiax> I was thinking the same thing you were though at first
<SmerdyOffice> Schmurtz, do you mean that you don't understand the question?
<teiax> I wonder if the code generator in the compiler would be useful at all for you
<SmerdyOffice> Maybe in some small way, but I wouldn't expect very much, because it doesn't need to _read_ machine or assembly code.
<teiax> yes, the best you could hope for would be an elegant data structure
clog has joined #ocaml
batdog has joined #ocaml
rossberg has joined #ocaml
mfurr has joined #ocaml
avlondono has joined #ocaml
joeytwiddle has joined #ocaml
Banana has joined #ocaml
__DL__ has joined #ocaml
Gueben has joined #ocaml
revision17 has joined #ocaml
exa has joined #ocaml
tom_p has joined #ocaml
Mike_L has joined #ocaml
Snark has joined #ocaml
smimou has joined #ocaml
<Schmurtz> Smerdyakov, you want to write a disassemble tool ?
jave has joined #ocaml
_fab has joined #ocaml
<SmerdyOffice> No, I am doing program verification on machine code.
<teiax> hmmmm
<teiax> that sounds very tricky
<SmerdyOffice> I and many others have been doing it for a while, though my group has worked on assembly code instead of machine code, and I want to start with machine code this time.
<Schmurtz> assembly code is just a human-understandable version of machin code
<teiax> hehehe, I wish lilo would say stuff like that during the boot process :{
<SmerdyOffice> Schmurtz, I don't agree, unless you want to say that OCaml is just a human-understandable version of machine code?
<teiax> yes, I'd say that there IS some extra information in assembly code which is tossed when it becomes machine code
<Schmurtz> assembler to machine code or machine code to assembler is a trivial task
<Schmurtz> teiax, really ?
<teiax> sure
<teiax> you can name things in assembly code
<Schmurtz> ok
<teiax> some assemblers have features which are very like higher level languages
<teiax> all that stuff gets tossed out the window when you "assemble" it
<teiax> yes, you can produce assembly code from machine code, but you cannot often produce the original assembly code from machine code only
<SmerdyOffice> Not to mention that you must trust in the correctness of your assembler or prove a correctness theorem about it if you want to draw conclusions from program analyses on assembly programs.
<teiax> you can produce C, or even Ocaml from machine code
<teiax> yes, hm, that is very true
<Schmurtz> or assembler
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
ski has joined #ocaml
<mflux_> and cpu?
<mflux_> and memory and bus and..
<mflux_> and if you inspect the machine with your senses they must be provably reliable too.
<mflux_> if you want to prove something about the code, isn't it better to handle the assembly, because it's one step more from it to the machine code?
<mflux_> well, I suppose if you already have the machine code it would be an extra step to convert it to assembler first
<mflux_> but I think that mapping an assembler (not a macro assembler) has between the assembly and machine code should be 1:1
<SmerdyOffice> Of course it isn't 1:1. These assembly programs have the same machine code:
<SmerdyOffice> label1:
<SmerdyOffice> label2:
<SmerdyOffice> Machine code is easier to reason about, because it's simpler.
<SmerdyOffice> And assemblers are non-trivial pieces of software to prove correct.
exa has quit [Remote closed the connection]
exa has joined #ocaml
monochrom has joined #ocaml
mrsolo has joined #ocaml
mrsolo has quit [Remote closed the connection]
mrsolo has joined #ocaml
pango has joined #ocaml
zigong has joined #ocaml
zigong has quit [Remote closed the connection]
zigong has joined #ocaml
Smerdyakov has quit [Connection timed out]
vincenz has quit [Client Quit]
Nutssh has joined #ocaml
ulfdoz has joined #ocaml
<ulfdoz> g'eve, I'm fiddling on a parser for sieve. As sieve shall be extensible, I wonder what possibilities are there, to reflect this in the parser. I could copy the idea with the function table from SooHyoung Oh's Ocamlyacc Tutorial, but how to deal with optional parameters for the commands? I'm new to parser building and not experienced with programming in *ML.
<monochrom> I have not thought much on parsers for extensible things.
Mathman has joined #ocaml
<ulfdoz> Probably there are types with labeled fields. That could help, but I don't yet see it. :\
vincenz has joined #ocaml
<Mathman> hi there. I'm wondering if this ocaml book I'm reading is wrong. it says that when you combine patterns, they can only contain constants or the wildcard. but I did a little test and it seems to work just fine with variables.
<Mathman> here's my little test:http://rafb.net/paste/results/XknpB139.html
<Mathman> oops, here it is again so you can click on it easier: http://rafb.net/paste/results/XknpB139.html
<Mathman> anyway, according to this book, I shouldn't be able to have those x's in there. is that not right?
<ski> combine as in combine two patterns together into one pattern with '|' ?
<Mathman> yeah
<ulfdoz> x has no value, and you have no chance to change the value of x in myand after definition of myand.
<ski> (that is called 'or-pattern)
<ulfdoz> So it isn't really variable.
<ski> i think the correct statement would be that all branches of an or-pattern has to bind the same set of variables, and each variabe having the same type
<Mathman> well here's what the book says:The only strong constraint is that all naming is forbidden within these patterns. So each one of them must contain only constant values or the wildcard pattern.
no_dammagE has joined #ocaml
<Mathman> alright, well, I guess it doesn't matter too much. just confused me there for a second.
<ski> $ ocaml
<ski> Objective Caml version 3.08.1
<ski> # let myand v = match v with
<ski> (true,x) | (x,true) -> x
<ski> | _ -> false;;
<ski> val myand : bool * bool -> bool = <fun>
<ski> and it works (note how my version is not same as yours)
<ski> Mathman : i can only guess either the author didn't know what s/he was writing about .. or s/he possibly describes an earlier version in which this restriction might have been present (i suspect latter)
<Mathman> I see. thanks.
<Mathman> I take it you guys don't get too upset about pasting a few lines. =)
<pango> Mathman: it could also have been true for some older versions... (how old is this book ?)
<Mathman> I'm not sure. it's this book: http://caml.inria.fr/pub/docs/oreilly-book/html/index.html
<pango> the original (french) book was published in 2000
<ski> Mathman : well, if it's many lines i think most people think it's surely better to use some paste-service
<pango> I don't know if they updated the info since then (or while translating it)
<Mathman> I see. so I guess it's probably good that I'm testing things as I go along.
<pango> translation occurred around 2002
exa has quit [Read error: 110 (Connection timed out)]
Snark has left #ocaml []
mikeX has joined #ocaml
Smerdyakov has joined #ocaml
ski has quit ["Zzz"]
no_dammagE has quit [Remote closed the connection]
Smerdyakov has quit [Read error: 110 (Connection timed out)]
Gueben has quit [Read error: 104 (Connection reset by peer)]
zigong has quit [Remote closed the connection]
smimou has quit ["?"]
mikeX has quit [Read error: 110 (Connection timed out)]
ulfdoz has left #ocaml []
zigong has joined #ocaml
zigong has left #ocaml []
Schmurtz has joined #ocaml
mikeX has joined #ocaml
ejt has quit [Remote closed the connection]
threeve has quit []
Skal has quit [Remote closed the connection]
<mikeX> is there an easy way to read the output of a system command (and say display it in a widget etc)?
Smerdyakov has joined #ocaml
<SmerdyOffice> I'd say you should look at the unix library.
<Schmurtz> I think you must use unix library
<Schmurtz> exec and pipes
<SmerdyOffice> From the perspective of the unix library, there is no need to use anything involving the term "pipe."
__DL__ has quit ["Bye Bye"]
<mikeX> SmerdyOffice, Unix.create_process?
arcticd has joined #ocaml
<arcticd> Hi
<arcticd> I have a question about the example function in this post: http://groups.yahoo.com/group/ocaml_beginners/message/229 ( the 'let rec read_lines ch lines' one)...How would I call this? Because I need two arguments but the second one (the list) isn't really needed...
<SmerdyOffice> mikeX, there are a number of variations, determining which IO streams of the created process you get.
threeve has joined #ocaml
<SmerdyOffice> arcticd, how is it "not needed"?
<mikeX> SmerdyOffice, ok, I'll look into it further
<arcticd> SmerdyOffice: Whats the function's use of me giving it an empty list?
Smerdyakov has quit [Read error: 110 (Connection timed out)]
<SmerdyOffice> arcticd, do you understand how the function works?
<arcticd> Its recursive so it calls itself as long as there are any lines left in the file
<mikeX> I think the 'Some ->' is missing a 'line'
<arcticd> I found that out myself already but thanks :)
<mikeX> arcticd, the function is called with an empty list, because a list is build (el :: el :: el :: [])
<arcticd> Ok...how do I create that empy list when calling it?
<mikeX> read_lines ch []
<mikeX> that's the call
<mikeX> the empty list is symbolised as []
<arcticd> Oh yeah...now it works :)...Tried it with [] before but gave me strange things back
<arcticd> Thanks
<arcticd> This language has the steepest learning curve of all I know :)
<mikeX> yeah I find it hard too :/
<mikeX> arcticd, join #flood if you'd like a more complete example
<mikeX> i just happened to use that function somewhere just now !
<SmerdyOffice> arcticd, I think OCaml has a much less steep learning curve than most mainstream languages.
<SmerdyOffice> articd, the problem is that you chose to learn some other languages first, and you can't necessarily transfer all of your knowledge from them to OCaml.
<SmerdyOffice> While most mainstream languages are nearly identical in the ways that count.
<mikeX> SmerdyOffice, did you start off with imperative languages?
<arcticd> It's hard to see when something in ocaml is imperative or functional
<arcticd> For me as a beginner
<mikeX> arcticd, what languages did you learn prior to ocaml?
Nutssh has quit ["Client exiting"]
<arcticd> Oh I took the Pascal -> Perl -> Java -> Ruby route :)
<mikeX> I see... i started with pascal too :/
<arcticd> And I think they'll force me into that this year in school again :(