gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
sepp2k has quit [Quit: sepp2k]
npouillard has quit [Ping timeout: 276 seconds]
npouillard has joined #ocaml
mjonsson has joined #ocaml
jakedouglas has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
_unK has quit [Remote host closed the connection]
Yoric has joined #ocaml
joewilliams is now known as joewilliams_away
jakedouglas has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
LionMadeOfLions has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
_y_ has joined #ocaml
<_y_> can anyone point me to a reference regarding embedding an OCaml REPL inside of some other application? in particular there's a graphical machine-code disassembler for Windows called IDA, and I would like to embed a custom toplevel (that calls into my C++ code) inside of it
mjonsson has quit [Remote host closed the connection]
mjonsson has joined #ocaml
mjonsson has quit [Remote host closed the connection]
_y_ has quit [Ping timeout: 240 seconds]
ikaros has joined #ocaml
_y_ has joined #ocaml
yezariaely has joined #ocaml
<yezariaely> I want to transform a string list into a string where the elements are seperated by blanks. I tried:
<yezariaely> # let sl = ["x";"y";"z"];;
<yezariaely> val sl : string list = ["x"; "y"; "z"]
<yezariaely> # List.fold_left (fun x -> x ^ " ") "" sl;;
<yezariaely> Error: This expression has type string but an expression was expected of type
<yezariaely> 'a -> string
Amorphous has quit [Ping timeout: 276 seconds]
<yezariaely> which is clear for me why it does not work, however I do not know a solution for that. anyone can give me a hint, please?
ikaros has quit [Quit: Leave the magic to Houdini]
DimitryKakadu has joined #ocaml
init1 has joined #ocaml
Amorphous has joined #ocaml
<julm> yezariaely: # String.concat " " sl;;
<julm> - : string = "x y z"
<yezariaely> julm: some things are soooo simple -_- thx
<julm> List.fold_left (fun acc stg -> match acc with "" -> stg | _ -> acc ^ " " ^ stg) "" sl;;
<julm> - : string = "x y z"
<yezariaely> eh sure, i forgot the acc in my function!
<julm> but String.concat is better because it first computes the final length of the string which avoids useless intermediate string allocations
_y_ has quit [Ping timeout: 240 seconds]
DimitryKakadu has quit [Ping timeout: 255 seconds]
Snark has joined #ocaml
DimitryKakadu has joined #ocaml
DimitryKakadu has quit [Client Quit]
DimitryKakadu has joined #ocaml
ygrek has joined #ocaml
<yezariaely> julm: ah fine. is there any way I can see the implementation details for builtin functions such as String.concat ?
<adrien> you can look at the ocaml sources
<adrien> stdlib/string.ml
lpereira has joined #ocaml
<yezariaely> adrien: you know a good online explanation on how to structure ocaml code the "good" way ?
<adrien> not really, I think the usual advice is to read already-existing ocaml code, the standard library being a good read
<flux> the standard library doesn't quite resemble a normal application though. perhaps unison or mldonkey?
<flux> though atleast the latter has quite big internal depedencies.. (I tried to extract its torrent reading code from it one day)
<adrien> but it's made up of rather short functions (usually), I'd advise against mldonkey because it's really big, I don't know about unison
<flux> unison might not be that great either, because it uses lwt, which might not be the best introductory code
<flux> but what is a good example of an ocaml application?
<adrien> but maybe I misunderstood: yezariaely, were you looking for only the high-level structure of applications or libraries or did you want to look at the organization _inside_ functions?
<yezariaely> adrien: thanks for asking again, I was looking at the highlevel structure
<yezariaely> at = for
<adrien> argh, so, indeed, mldonkey can be a good project to look at
<adrien> I wouldn't necessarily copy its structure but it can give goog ideas
<adrien> good*
munga has joined #ocaml
<yezariaely> wow crazy, I did not know that this thing is written in OCaml ...
_y_ has joined #ocaml
boscop has joined #ocaml
munga has quit [Ping timeout: 245 seconds]
fraggle_ has quit [Read error: Connection reset by peer]
fraggle_ has joined #ocaml
pikachuyann has joined #ocaml
munga has joined #ocaml
Edward_ has joined #ocaml
Edward_ has quit [Ping timeout: 264 seconds]
Edward_ has joined #ocaml
<yezariaely> adrien: I saw a some ocaml code 'til now, and the rate of comments really was low. I think that is quiet weird because I think that the more dense an idea can be expressed the more necessary it is to comment your ideas. do you agree?
<yezariaely> -a
<yezariaely> so then there is the obvious question ...
<yezariaely> are good ocaml programmers good enough to extract the idea behind the code that good?
<yezariaely> yeah 3 times "good" in one sentence ...
<adrien> I agree it can be quite low but it's even better if you can make the code self-explicit :P
<adrien> I haven't had much troubles reading code usually
<yezariaely> ok
<adrien> but I'm also wondering: do you have any problematic code?
<yezariaely> adrien: no I haven't, but I will soon implement a larger project in ocaml and I don't want to end up in problems because I structured things badly
<yezariaely> or did not comment ... or something else ;)
<yezariaely> I am still looking for the common ocaml pitfalls to come ;)
DimitryKakadu has quit [Read error: Operation timed out]
DimitryKakadu has joined #ocaml
_unK has joined #ocaml
mjonsson has joined #ocaml
ikaros has joined #ocaml
yezariaely has left #ocaml []
yezariaely has joined #ocaml
lpereira has quit [Quit: Leaving.]
oriba has joined #ocaml
oriba has quit [Client Quit]
DimitryKakadu has quit [Ping timeout: 240 seconds]
DimitryKakadu has joined #ocaml
schmrkc has quit [Ping timeout: 245 seconds]
schmrkc has joined #ocaml
schmrkc has quit [Changing host]
schmrkc has joined #ocaml
<yezariaely> ocamlyacc: can I give some optional tokens in the rules ? e.g. | KEYWORD TEST?
<yezariaely> TEST would be optional?
<yezariaely> or simply adding two rules?
sepp2k has joined #ocaml
DimitryKakadu has quit [Read error: Connection reset by peer]
DimitryKakadu has joined #ocaml
<thelema> yezariaely: two rules
<yezariaely> thelema: thx. and for languages which do have case-insensitive keywords is there any way to configure the parser?!
<yezariaely> sorry ... lexer
ftrvxmtrx has quit [Ping timeout: 265 seconds]
boscop has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
<yezariaely> I found that just now, too ;) thx!
boscop has joined #ocaml
DimitryKakadu has quit [Quit: Konversation terminated!]
DimitryKakadu has joined #ocaml
Edward_ has quit []
Tianon has quit [Quit: moving, ugh]
DimitryKakadu has quit [Ping timeout: 255 seconds]
sepp2k has quit [Quit: sepp2k]
pikachuyann has quit [Ping timeout: 240 seconds]
monra has joined #ocaml
monra has left #ocaml []
DimitryKakadu has joined #ocaml
nejimban has quit [Read error: No route to host]
yezariaely has left #ocaml []
mjonsson has quit [Remote host closed the connection]
<thelema> Map.modify_def: 'a -> key -> ('a -> 'a) -> 'a t -> 'a t
DimitryKakadu has quit [Read error: Connection reset by peer]
DimitryKakadu has joined #ocaml
jakedouglas has joined #ocaml
<flux> so, apparently, this isn't supposed to work: http://modeemi.fi/~flux/lwttest.ml
<flux> bacause it outputs "X\nX\n" instead of "X\nY\n\X\n\Y\n"
<flux> how should I use LWT instead to make that pattern work?
<thelema> sorry, I'd expect XYXY
<flux> hmph
<flux> so I have three options: A) write an module ala CML that makes use of LWT to do its magic B) dig into lwt source and figure if it even tries to do what I expect C) wait a bit longer for other suggestions :-)
<flux> perhaps I'll try option B first while doing option C concurrently
<adrien> you're implementing C with cooperative threading? /o\ 
<flux> ..
jakedouglas has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 245 seconds]
DimitryKakadu has quit [Ping timeout: 276 seconds]
<flux> well, I updated the lwttest.ml and the behavior seems _strange_
<flux> the core of the change is that the other function outputs to mvars a, b, b, a, b, b, a, b, b .. n times
<flux> and the output is X Y Y Y Y Y Y Y..
<flux> lwt_mvar.ml itself seems solid at face-value
<flux> (quite short module that, thankfully)
<flux> aha, I found my solution:
<flux> val pick : 'a t list -> 'a t
<flux> (** [pick l] is the same as {!choose}, except that it cancels all
<flux> sleeping threads when one terminates. *)
<flux> (and after changing choose->pick everything works just dandy)
<flux> I'm tempted to write a module nevertheles, just to get a more coherent vocabulary..
joewilliams_away is now known as joewilliams
<thelema> nonstandard vocab? better to adjust all Lwt users to wierd terminology than to have everyone make up their own terminology
ztfw has joined #ocaml
<flux> well, in lwt everything is made of 'threads' and almost the same thing in CML/Event would be events
<flux> in lwt to start a new thread you actually 'ignore result' of a thread
<flux> I'm not very certain the vocabulary chosen is that coherent or logical, but perhaps I just haven't used it enough :)
DimitryKakadu has joined #ocaml
DimitryKakadu has quit [Ping timeout: 265 seconds]
init1 has quit [Quit: Quitte]
Snark has quit [Quit: Ex-Chat]
fraggle_ has quit [Ping timeout: 240 seconds]
DimitryKakadu has joined #ocaml
fraggle_ has joined #ocaml
munga has quit [Ping timeout: 276 seconds]
despa has quit [Ping timeout: 265 seconds]
joewilliams is now known as joewilliams_away
<flux> hmm.. apparently Unix doesn't know about O_NDELAY open mode. hopefully O_NONBLOCK will do for this case.
DimitryKakadu has quit [Ping timeout: 252 seconds]
caligula_ has joined #ocaml
caligula__ has quit [Ping timeout: 240 seconds]
srcerer_ has joined #ocaml
caligula_ has quit [Read error: Operation timed out]
srcerer has quit [Ping timeout: 240 seconds]
caligula_ has joined #ocaml
srcerer has joined #ocaml
srcerer_ has quit [Ping timeout: 276 seconds]
srcerer_ has joined #ocaml
caligula_ has quit [Remote host closed the connection]
caligula_ has joined #ocaml
srcerer has quit [Ping timeout: 264 seconds]
srcerer__ has joined #ocaml
srcerer_ has quit [Ping timeout: 240 seconds]
caligula_ has quit [Remote host closed the connection]
caligula_ has joined #ocaml
tautologico has joined #ocaml
srcerer has joined #ocaml
caligula__ has joined #ocaml
srcerer__ has quit [Ping timeout: 252 seconds]
srcerer_ has joined #ocaml
caligula_ has quit [Ping timeout: 272 seconds]
srcerer__ has joined #ocaml
srcerer has quit [Ping timeout: 276 seconds]
srcerer_ has quit [Ping timeout: 240 seconds]
srcerer has joined #ocaml
sepp2k has joined #ocaml
srcerer__ has quit [Ping timeout: 240 seconds]
jakedouglas has joined #ocaml
<_y_> sorry; asked this question last night but was disconnected a few times in the process
<_y_> can anyone point me to a reference regarding embedding an OCaml REPL inside of some other application? in particular there's a graphical machine-code disassembler for Windows called IDA, and I would like to embed a custom toplevel (that calls into my C++ code) inside of it
jakedouglas has quit [Ping timeout: 252 seconds]
<thelema> _y_: look at the embedding ocaml in C section in the reference manual and embed the function Toploop.loop from the toplevel code
jakedouglas has joined #ocaml
jakedouglas has quit [Ping timeout: 276 seconds]
jakedouglas has joined #ocaml
<_y_> sorry, thelema, are you talking about the OCaml book, http://caml.inria.fr/pub/docs/oreilly-book/, or the OCaml reference manual, http://caml.inria.fr/pub/docs/manual-ocaml/ ?
<thelema> the second
jakedouglas has quit [Ping timeout: 276 seconds]
Yoric has quit [Quit: Yoric]
<tautologico> anyone has successfully compiled pfff?
<adrien> any error message?
<tautologico> apparently it's trying to compile a local copy of ocamlbdb (even though I have installed it through godi)
<tautologico> ocamlc -c bdb.ml
<tautologico> File "bdb.ml", line 255, characters 19-30:
<tautologico> Error: Unbound constructor DB_NOTFOUND
<adrien> gah, it also bundles a lablgtk afaict
<tautologico> yes
<tautologico> it bundles all its dependencies
<adrien> I guess it makes sense for everyone but us
<tautologico> yes, considering it's targeted mainly at people doing analysis on php code
<tautologico> any simple examples using gtk + cairo in ocaml?
jakedouglas has joined #ocaml
munga has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
ulfdoz_ has quit [Quit: Reconnecting]
ulfdoz has joined #ocaml
seafood has joined #ocaml
sepp2k has quit [Quit: sepp2k]
munga has quit [Ping timeout: 276 seconds]
ztfw has quit [Remote host closed the connection]
_y_ has quit [Ping timeout: 240 seconds]
seafood has quit [Quit: seafood]
jakedouglas has quit [Quit: Leaving.]
Modius has quit [Quit: I'm big in Japan]