mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
TychoBrahe has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
bzzbzz has joined #ocaml
jdrake has joined #ocaml
mfp has quit [Read error: 104 (Connection reset by peer)]
delamarche has joined #ocaml
m3ga has joined #ocaml
mfp has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
thermoplyae has joined #ocaml
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
jlouis has joined #ocaml
jdrake has quit ["Ex-Chat"]
love-pingoo has quit ["zu"]
m3ga has quit ["disappearing into the sunset"]
delamarche has quit []
smimou has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
robozni has joined #ocaml
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has joined #ocaml
thermoplyae has quit ["daddy's in space"]
ruiboon has joined #ocaml
ruiboon_ has joined #ocaml
Snark has joined #ocaml
ygrek has joined #ocaml
zzoneh has joined #ocaml
<zzoneh> Hello, is there a site that indexes ocaml code?
<zzoneh> I'm looking for something similar to "Koders"
Tetsuo has joined #ocaml
<pango_> google code search?
love-pingoo has joined #ocaml
Linktim has joined #ocaml
hkBst has joined #ocaml
kelaouchi has joined #ocaml
bluestorm has joined #ocaml
Linktim has quit [Read error: 104 (Connection reset by peer)]
filp has joined #ocaml
filp has quit [Client Quit]
johnnowak has joined #ocaml
<ruiboon_> hi. can anyone point me to a document on Some? cant seems to find it
<kig> let f v = match v with Some x -> x | None -> 0 in (f (Some 10), f None);;
<bluestorm> hmm
<bluestorm> type 'a option = None | Some of 'a
<bluestorm> i think that's the most useful documentation :)
<ruiboon_> kig, bluestorm : ah. that i what i need. thanks
Linktim has joined #ocaml
ChristopheT has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones_ has quit [Client Quit]
seafood_ has joined #ocaml
seafood_ has quit [Client Quit]
ChristopheT has left #ocaml []
blAckEn3d has joined #ocaml
<blAckEn3d> hi
<blAckEn3d> i have an embarrassing problem: i am using ocaml 3.10 built from sources and it doesn't seem to have the option module
<blAckEn3d> do i have to pass any options while configuring ocaml to have the module built?
<blAckEn3d> or how can i find use it?
<fremo> there is no module for that
<fremo> (or Pervasives)
<blAckEn3d> oh, then how can i get the value out of an option except using pattern matching?
<flux> you can't :)
<blAckEn3d> :)
<fremo> :)
<blAckEn3d> thanks
<flux> unless you use ExtLib or similar project; or write your own function to do that and then use that
<blAckEn3d> that was embarrassing
<blAckEn3d> thanks again
<fremo> no, easy
<flux> of course, most of the time it's preferable to avoid that, so you can handle the other case immediately
<fremo> let value o = match o with Some v -> v
<blAckEn3d> i'll do that
<fremo> let value o = match o with Some v -> v | None -> raise Not_found
<blAckEn3d> another thing: is the array element access constant time?
<pango_> fremo: better not raise a standard exception, that can come from so many different places already
<pango_> blAckEn3d: it's a standard implementation of arrays, so yes
seafood_ has joined #ocaml
<fremo> pango_: hum, yes, good idea
<fremo> but with the backtrace...
<fremo> or a try
<bluestorm> let refutable Some x = your_option :--'
<blAckEn3d> what does refutable do (i'm new to ocaml, as if that was not obvious)
<blAckEn3d> ?
<bluestorm> refutable actually doesn't exists
<bluestorm> -s
<pango_> imho, if you find yourself deconstructing option values many times knowning that it has to be Some x, there's a good probability that your datastructures are not optimal
<bluestorm> it a syntax extension of mine (useful when you want it, but if you're a beginner you should go the soft way and use bare ocaml i think)
<blAckEn3d> i'm not deconstructing options often..
<bluestorm> blAckEn3d: you should code the obvious (and simple) way, ie. with pattern matching
<bluestorm> then, if you end up having redudancies in your code, you can think of auxiliary functions
<blAckEn3d> what i am trying to do is to find the index of an element in a sublist
<bluestorm> "index" + "list" doesn't sound good
<blAckEn3d> e.g: [[1; 2]; [3; 4]] --> index 1 l -> 0, 0
<bluestorm> are you sure you don't want arrays ?
<blAckEn3d> i think i can use arrays too
<blAckEn3d> thanks
<bluestorm> (beware : each time you use List.nth, a lisp machine kills a kitten)
<blAckEn3d> ( :) is this a bad time to say that i like lisp? )
l_a_m has joined #ocaml
<bluestorm> of course not, lists are a very sane and neat thing of lisp, and i hope you use the proper data structure in lisp too
<blAckEn3d> well, i'll just use arrays
Yoric[DT] has joined #ocaml
<ruiboon_> hi. can someone enlighten me why this function always gives an assert failure? http://pastebin.com/d7b422bcd Thanks
<Yoric[DT]> hi
<Yoric[DT]> Did you call supplyFileInUnisonDirFn ?
<ruiboon_> Yoric[DT]: i dont think so. that extract was from unison source. trying to change the default logfile location
<ruiboon_> Yoric[DT]: where do u suggest that i call it ?
<Yoric[DT]> I don't know, but as long as it hasn't been called, fileInUnisonDirFn is bound to refer to None.
<ruiboon_> Yoric[DT]: in fact, that seems to be the only location fileInUnisonDirFn is seen
<Yoric[DT]> Sorry, can't help you further.
<ruiboon_> Yoric[DT]: missed out on 1 file. fileInUnisonDirFn is called in main. supplyFileInUnisonDirFn \n (fun n -> Fspath.toString (Os.fileInUnisonDir(n)));
<ruiboon_> Yoric[DT]: thanks for the pointer. will see what i can do next.
johnnowak has quit []
Snark has quit [Read error: 113 (No route to host)]
tsuyoshi has joined #ocaml
zzoneh has quit ["Leaving"]
love-pingoo has left #ocaml []
kelaouchi has quit [Read error: 110 (Connection timed out)]
blAckEn3d has quit ["Leaving"]
Linktim_ has joined #ocaml
Linktim_ has quit [Remote closed the connection]
Linktim has quit [Read error: 110 (Connection timed out)]
TychoBrahe has quit [Remote closed the connection]
LordMetroid has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
kelaouchi has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
kelaouchi has quit [Read error: 113 (No route to host)]
Linktim has quit [Read error: 110 (Connection timed out)]
marmottine has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
RobertFischer has joined #ocaml
<Yoric[DT]> mmmmhhhh....
<Yoric[DT]> Seems that ExtLib's printf doesn't play very nicely with channels.
* Yoric[DT] wonders if it's time to get to work on his semi-functional unparser.
LordMetroid has quit ["Leaving"]
ruiboon has quit [SendQ exceeded]
marmottine has quit ["Quitte"]
kelaouchi has joined #ocaml
Linktim has joined #ocaml
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
<bluestorm> Yoric[DT]: any idea why there was no response to my extlib patch attempt ?
<Yoric[DT]> Nope.
<Yoric[DT]> I haven't received any answer either.
<bluestorm> (I mean, I'm not sending rude .tar.gz or big patches, *I*'m a nice guy :-' )
<Yoric[DT]> :)
Linktim has quit [Read error: 104 (Connection reset by peer)]
pango_ has quit [Remote closed the connection]
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
Linktim has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
pango_ has joined #ocaml
<hcarty> seafood_: If you are still interested in using C libraries/code from OCaml, http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php is a good tutorial
<hcarty> seafood_: And the OCaml manual does a decent job of describing the more complex parts
<hcarty> seafood_: camlidl is a decent, if somewhat limited, tool for automating C-code binding generation
<hcarty> seafood_: http://caml.inria.fr/pub/old_caml_site/camlidl/ is the URL for camlidl
Linktim_ has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
kelaouchi has quit ["leaving"]
kelaouchi has joined #ocaml
<ulfdoz> i'm looking for a fast way, to preprocess an input_channel. I simply have to replace some character-sequences on it.
Linktim_ has quit [Remote closed the connection]
<bluestorm> Stream.of_channel ?
<bluestorm> ulfdoz: then you get a stream, wich is not bad
<bluestorm> the problem is that you don't get an input_channel back, so it's not composable as-is, but streams are
<bluestorm> hmm
<bluestorm> on the other hand, Buffer seems to have an appropriate function, add_substitue
<bluestorm> +t
<ulfdoz> I'd like to avoid any extra buffers, because, I must expect huge sets of data.
ruiboon_ has quit ["Leaving"]
<bluestorm> ulfdoz: stream seems fine then
<bluestorm> because it's lazy
ofaurax has joined #ocaml
Linktim has joined #ocaml
TaXules has quit [Remote closed the connection]
<Yoric[DT]> If you can use ExtLib, enumerations are nice for that.
<Yoric[DT]> (and I *guess* they're faster than streams)
<bluestorm> hmm, i have never looked at the stream implementation but this is strange
<bluestorm> given that enumerations are to support an actually wider API than stream (ie. they're not destructive), how could a decent implementation of both have noticeably faster enums ?
TaXules has joined #ocaml
optikal has joined #ocaml
jeremiah has joined #ocaml
Linktim_ has joined #ocaml
Linktim has quit [Connection timed out]
<Yoric[DT]> bluestorm: enumerations are destructive.
<Yoric[DT]> In addition to which the implementation of streams is very weird.
<Yoric[DT]> Mmmmhhhh....
<Yoric[DT]> I have a prolem with CIL.
<Yoric[DT]> s/prolem/problem/
<Yoric[DT]> How does it locate .h files ?
kig has left #ocaml []
Axioplase has joined #ocaml
l_a_m has quit [Remote closed the connection]
kelaouchi has quit [Remote closed the connection]
kelaouchi has joined #ocaml
ygrek has quit [Remote closed the connection]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has joined #ocaml
kelaouchi has quit [Client Quit]
kelaouchi has joined #ocaml
<Yoric[DT]> Mmmhhh.... I may have solved my problem.
<Yoric[DT]> I'll call this a night.
<Yoric[DT]> Cheers everyone.
Yoric[DT] has quit ["Ex-Chat"]
Axioplase has quit ["leaving"]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
Linktim_ has quit [Remote closed the connection]
TychoBrahe has joined #ocaml
vixey has joined #ocaml
<vixey> Is this incorrect "It is known for its use of the Hindley-Milner type inference algorithm, which can automatically infer the types of most values without requiring explicit type annotations."?
optikal has quit []
<vixey> I think Hindley-Milner type inference can always infer everything
<ulfdoz> afaik HM is able to infer types of all values. However, practice imposes some restrictions, else it would have exponential complexity.
<ulfdoz> my preprocessing functions for input channels. Probably not the best solution. http://rafb.net/p/VgvgYT64.html
<ulfdoz> and there's an off-by-one bug.
<vixey> what does that code do?
<pango_> references are usually dereferenced using ! prefix operator rather than using contents field name
<ulfdoz> appends a dot to any sequence of <CRLF> "." (carriage return, line feed, dot).
<vixey> :(
<ulfdoz> pango_: I was frightened about confusing the reader with ! being boolean negation in many languages. :)
<pango_> and I feel uneasy about using == on unboxed values, even if it is allowed (and works)
<pango_> ulfdoz: readers that don't know ocaml won't read ocaml code anyway
<ulfdoz> pango_: What would be the alternativ to "=="?
<vixey> ulfdoz: Why doesn't it take <CRLF> "." as a parameter?
<pango_> you must use idioms of the language you're currently using
<pango_> ulfdoz: =
<ulfdoz> vixey: Unnecessary for this case. This method is only needed, when issuing the DATA command on an lmtp-socket.
<orbitz> ulfdoz: you use =. it has type 'a -> 'a -> bool
<pango_> the `let _ =' at lines 7 and 8 are not necessary. Same for parens around condition, and else (), at line 8
<pango_> you can replace let _ = with sequences there
<bluestorm> vixey: there are some very specific ocaml features that require type annotation
<bluestorm> (i'm thinking of higher-rank polymorphism you can use in objects (and records))
<bluestorm> so technically yes, there are some ocaml typing cases that can not be directly inferred by the type system
<bluestorm> (much less than in Haskell, though)
<orbitz> aything in a .mli file needs it
<bluestorm> but actually .mli can be inferred by the compiler
<bluestorm> (see ocamlc -i for example)
<orbitz> sure, but it still needs type annotation:)
<bluestorm> i don't think so
<bluestorm> modules get signatures even when you don't specify one
arquebus has joined #ocaml
<orbitz> but then you aren't talking abotu stuff in a .mli file are you?
<bluestorm> if you have a .ml without a .mli
<bluestorm> there is no .mli, and there is a module
<bluestorm> so the signature is inferred
<orbitz> right, but i specifically said in reference to .mli files
<bluestorm> hmm
<bluestorm> so you're saying that when we choose to add type annotations then yes, we need to add type annotations ?
<orbitz> when you choose to provide a signature, you need to add type annotations
<orbitz> i'm not saying it's a bad thing or anything
<orbitz> just pointing out that it is a specific case that requires type annotation
<bluestorm> hmm
<bluestorm> but a signature *is* a type annotation
<bluestorm> i don't really see were you make a difference between the act of providing a signature and the act of annotating your types
<bluestorm> you mean you'd like a way to say "i declare this value but you can give it the most generic type available" ?
<orbitz> i wouldn't like anything in particular. i was just adding it ot the list of things
<orbitz> i'm not sure someone new to the lagnuage would see signatures as type annotation
<orbitz> even though you are right, they are
<bluestorm> i wish i knew the ocaml compiler internals, that kind of thing should not be so difficult to hack up
<vixey> what is not so difficult?
arquebus has quit [Remote closed the connection]
<bluestorm> orbitz's idea of providing partially-inferred signatures
<orbitz> bluestorm: you mean you'd have a mli file that just defines names to export and then the compielr woudl figure out what type they should be?
<bluestorm> yes
<orbitz> that might get confusing though because you can start to have signatures without structures behind them right? really you have the signature before the structure, but it just so happens often people write teh structure first
<orbitz> otherwise how does it work when you specify your structure implements a certain signature, if the signature is being inferred form the structure?
bluestorm has quit ["Konversation terminated!"]
<vixey> this is impressive http://www.andrej.com/plzoo/
seafood_ has quit [Read error: 104 (Connection reset by peer)]
<pango_> ulfdoz: personally, I would have separated stream reading from stream transformation (so you can easily switch to a different source of data)
seafood_ has joined #ocaml
Tetsuo has quit ["Leaving"]
<vixey> is there a very efficient exact real arithmetic lib for ocaml?
<pango_> ulfdoz: then, with stream syntax extension, and encoding the state with different parsers, stream transformation can look like this: http://ocaml.pastewith.us/89 (I'm not sure if that's the most concise way with streams)
<ulfdoz> hm, I see that extension for the first time.
<pango_> ulfdoz: it's a standard extension of camlp4
<pango_> in fact, it even used to be a syntax supported directly by the compiler
<vixey> what would be a worthwhile thing to program in ocaml?
<Smerdyakov> vixey, anything!
<orbitz> vixey: a program that comes up with ideas for programs
<ulfdoz> nice, I will have uses for that.
hkBst has quit ["Konversation terminated!"]
Demitar has joined #ocaml