mfp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Inscription for OCaml Meeting 2010 is opened http://wiki.cocan.org/events/europe/ocamlmeetingparis2010
mehdid has quit [Ping timeout: 248 seconds]
patronus_ has quit [Ping timeout: 248 seconds]
mehdid has joined #ocaml
patronus has joined #ocaml
enthymeme has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
eb4890 has joined #ocaml
krankkatze has quit [Remote host closed the connection]
Associat0r has quit [Quit: Associat0r]
Associat0r has joined #ocaml
xcthulhu has joined #ocaml
SEcki has quit [Remote host closed the connection]
Amorphous has quit [Read error: Operation timed out]
struktured has quit [Quit: Laptop suspended.]
ikaros has quit [Quit: Leave the magic to Houdini]
struktured has joined #ocaml
derdon has quit [Quit: derdon]
xcthulhu has quit [Ping timeout: 246 seconds]
Amorphous has joined #ocaml
tmaedaZ has quit [Ping timeout: 240 seconds]
tmaedaZ has joined #ocaml
_unK has quit [Remote host closed the connection]
rwmjones has quit [Ping timeout: 260 seconds]
tmaedaZ has quit [Ping timeout: 258 seconds]
philtor has joined #ocaml
tmaedaZ has joined #ocaml
boscop has quit [Ping timeout: 258 seconds]
philtor has quit [Ping timeout: 258 seconds]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
boscop has joined #ocaml
maskd has quit [Quit: leaving]
CcSsNET has quit [Quit: User disconnected]
myu2 has joined #ocaml
rwmjones has joined #ocaml
struktured has quit [Read error: Connection reset by peer]
valross has quit [Ping timeout: 265 seconds]
valross has joined #ocaml
struktured has joined #ocaml
struktured has quit [Remote host closed the connection]
Shoggoth has joined #ocaml
philtor has joined #ocaml
struktured has joined #ocaml
linus5 has quit [Remote host closed the connection]
philtor has quit [Ping timeout: 265 seconds]
eb4890 has quit [Remote host closed the connection]
valross has quit [Remote host closed the connection]
philtor has joined #ocaml
asurai has joined #ocaml
bmp has quit [Ping timeout: 265 seconds]
asurai is now known as bmp
jeddhaberstro has quit [Read error: Connection reset by peer]
philtor has quit [Ping timeout: 252 seconds]
enthymeme has joined #ocaml
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
valross has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
silas has joined #ocaml
<silas> Hello all.
* silas started reading Practical OCaml, although I think the author suposes we don't need to know a lot of simple things...
<silas> He doesn't explain possible forms for the "let" keyword, for instance.
<silas> A better explanation for this case I found in the "Introduction to Objective Caml" draft book.
asurai has joined #ocaml
bmp has quit [Ping timeout: 260 seconds]
asurai is now known as bmp
ulfdoz has joined #ocaml
thrasibule has quit [Ping timeout: 265 seconds]
oc13 has joined #ocaml
Submarine has joined #ocaml
Associat0r has quit [Quit: Associat0r]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
ygrek has joined #ocaml
yakischloba has quit [Quit: Leaving.]
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
drk-sd has quit [Quit: cours]
ulfdoz has quit [Ping timeout: 276 seconds]
<flux> silas, the book hasn't exactly received praises from the ocaml community..
pcao has joined #ocaml
myu2 has joined #ocaml
ttamttam has joined #ocaml
Yoric has joined #ocaml
_zack has joined #ocaml
ftrvxmtrx has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
sepp2k has joined #ocaml
ikaros has joined #ocaml
rwmjones has joined #ocaml
Shoggoth has quit [Remote host closed the connection]
Shoggoth has joined #ocaml
avsm has joined #ocaml
yakischloba has joined #ocaml
sepp2k has quit [Quit: Leaving.]
_zack1 has joined #ocaml
_zack has quit [Ping timeout: 252 seconds]
pimmhogeling has joined #ocaml
jlouis has quit [Ping timeout: 276 seconds]
tmaedaZ has quit [Ping timeout: 246 seconds]
_zack has joined #ocaml
_zack1 has quit [Ping timeout: 268 seconds]
tmaedaZ has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
_zack has quit [Quit: Leaving.]
jlouis has joined #ocaml
ygrek has joined #ocaml
avsm has quit [Quit: Leaving.]
pimmhogeling has joined #ocaml
barismetin has joined #ocaml
barismetin has quit [Changing host]
barismetin has joined #ocaml
avsm has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
tmaedaZ has quit [Ping timeout: 240 seconds]
myu2 has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
tmaedaZ has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
_unK has joined #ocaml
Shoggoth has quit [Remote host closed the connection]
ttamttam has quit [Quit: Leaving.]
barismetin has quit [Remote host closed the connection]
barismetin has joined #ocaml
barismetin has quit [Changing host]
barismetin has joined #ocaml
gorgonite has joined #ocaml
_unK has quit [Ping timeout: 248 seconds]
avsm has joined #ocaml
tmaedaZ has quit [Ping timeout: 264 seconds]
_unK has joined #ocaml
oc131 has joined #ocaml
tmaedaZ has joined #ocaml
oc13 has quit [Ping timeout: 240 seconds]
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
_unK has quit [Remote host closed the connection]
_andre has joined #ocaml
derdon has joined #ocaml
valross has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
gorgonite has quit [Ping timeout: 252 seconds]
munga has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
avsm has quit [Quit: Leaving.]
<silas> flux: Practical Lisp, from Seibel, is great. I thought Practical Ocaml would follow the same success.
<silas> flux: Do you have any recommendation for a beginner?
<silas> (also, beginner in functional programming)
<silas> Anyone?
ttamttam has joined #ocaml
<Camarade_Tux> silas: maybe Jason Hickey's book which has a pretty good reputation ( http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf ) or the older o'reilly book ( http://caml.inria.fr/pub/docs/oreilly-book/ )
<Camarade_Tux> and we're always (very) happy to hear critics about tutorials and books
th5 has joined #ocaml
avsm has joined #ocaml
<flux> silas, whathesaid. also ocaml-tutorial.org has some links (including those)
avsm has quit [Quit: Leaving.]
thrasibule has joined #ocaml
linus5 has joined #ocaml
pimmhogeling has joined #ocaml
struktured has quit [Ping timeout: 258 seconds]
thrasibule has quit [Ping timeout: 240 seconds]
ikaros has quit [Read error: Connection reset by peer]
_unK has joined #ocaml
barismetin has quit [Quit: Leaving...]
barismetin has joined #ocaml
barismetin has quit [Changing host]
barismetin has joined #ocaml
barismetin has quit [Quit: Leaving...]
barismetin has joined #ocaml
barismetin has quit [Changing host]
barismetin has joined #ocaml
drk-sd has joined #ocaml
kaustuv has joined #ocaml
Yoric has quit [Ping timeout: 258 seconds]
Yoric has joined #ocaml
ninegrid has left #ocaml []
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
ikaros has joined #ocaml
bmp has quit [Quit: bmp]
drk-sd has quit [Quit: dodo]
sepp2k has joined #ocaml
ttamttam has quit [Quit: Leaving.]
joewilliams_away is now known as joewilliams
joewilliams is now known as joewilliams_away
<flux> hmm.. this may seem obvious.. but how does one seek an input channel in Batteries?-o
<thelema> flux: not so obvious. Batteries channels are sufficiently abstracted that you can't seek.
<flux> gaah
<flux> so basically if I need to, I need to use the standard streams?
<thelema> yup.
<thelema> They're available under Legacy.*
<flux> that seems quite a big hole in the io layer, although seeking is not quite often required
<thelema> It matches the semantics of other generic IO wrappers.
maskd has joined #ocaml
<flux> "Legacy" sounds like something that can be avoided altogether in new code, but apparently this isn't so
<thelema> If you have an idea how to fix this, I'm listening.
Associat0r has joined #ocaml
<flux> one approach would naturally just add the functions into all layers of IO. a big change.
<thelema> add seek & pos to all IO channels... ok, that's a bit heavy handed...
ikaros has quit [Ping timeout: 264 seconds]
ikaros has joined #ocaml
Associat0r has quit [Ping timeout: 265 seconds]
th5 has quit [Quit: th5]
<flux> uh oh.. how does one seek into offset 0xffff880034d92400 in /proc/kcore?
<flux> seems like it is a negative offset according to ocaml..
<thelema> even with 64-bit ints, you still need unsigned to seek that far...
<thelema> ah, kernel addresses are negative
<brendan> Unix.LargeFile.lseek doesn't work?
<flux> doesn't seem to
<mfp> flux, thelema: patches against old Batteries that (1) add capabilities to IO streams using phantom types (2) (line 3339) creates seekable streams when opening files http://ocaml.pastebin.com/z0rEfXTD
<flux> it raises Sys_error "Invalid argument"
<thelema> mfp: I'm confused - why the phantom types - aren't inputs always `Read?
<flux> ah
<flux> but it gets it from the lseek system call!
<flux> now I wonder how I perform the seek in general :)
<brendan> huh. ocaml not build with 64-bit off_t?
<brendan> seems strange though
<flux> it is
<thelema> can you try two smaller seeks that add up to that?
<flux> actually I may have some other issue, I'll do it in another way
<thelema> mfp: ah, you need the phantom types for keeping track of `seek
<flux> nope, the conversion from the 64-bit hex string into an integer seems to work fine as well
tmaedaZ has quit [Ping timeout: 258 seconds]
<thelema> any chance of merging input/output - `Read channel / `Write channel?
ikaros has quit [Quit: Leave the magic to Houdini]
tmaedaZ has joined #ocaml
f[x] has quit [Ping timeout: 240 seconds]
ftrvxmtrx has quit [Quit: Leaving]
krankkatze has joined #ocaml
tmaedaZ has quit [Ping timeout: 246 seconds]
tmaedaZ has joined #ocaml
_unK has quit [Remote host closed the connection]
ikaros has joined #ocaml
itewsh has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
<flux> hmh, again I'd like to have a consume-as-needed variant of bitstring.. but perhaps not enough to actually do it :)
slash_ has joined #ocaml
barismetin has quit [Quit: Leaving...]
itewsh has quit [Quit: There are only 10 kinds of people: those who understand binary and those who don't]
ulfdoz has joined #ocaml
munga has quit [Ping timeout: 248 seconds]
slash_ has quit [Quit: leaving]
Yoric has quit [Quit: Yoric]
ttamttam has joined #ocaml
SEcki has joined #ocaml
rwmjones has quit [Ping timeout: 260 seconds]
<kaustuv> OUnit users: do you write your tests inline with your modules or in separate modules? And, if you don't or can't use Camlp4, how do you disable compilation of tests?
ttamttam has quit [Read error: Connection reset by peer]
<derdon> kaustuv: I don't use OUnit yet, but I strongly recommend using seperate files for the tests!
<derdon> kaustuv: you have for example a module called foo.ml and foo.mli. then you have an extra directory for the tests called tests
<derdon> kaustuv: in the tests directory is a file called test_foo.ml
<derdon> kaustuv: this file uses the modules OUnit and Foo (and maybe some others too)
rwmjones has joined #ocaml
Associat0r has joined #ocaml
joewilliams_away is now known as joewilliams
nejimban has joined #ocaml
ttamttam has joined #ocaml
joewilliams is now known as joewilliams_away
<kaustuv> derdon: I'm not worried about the how, but about the why. What are the arguments in favour of keeping tests separate and why do they supercede the obvious benefits of keeping the tests close to the code they're testing?
<derdon> kaustuv: it is cleaner and much better style to seperate these tasks
<derdon> kaustuv: imagine you change the API of your code. if your tests are well-written, you don't have to rewrite them because only input and output are important
ftrvxmtrx has joined #ocaml
<flux> wouldn't simple unit tests also serve as examples on how to use the interface?
<derdon> flux: no, that's not their aim
<mrvn> If the tests still work after a change then you didn't (fundamentally) change the API.
<mrvn> And if you change the API other than extending it then you deserve to be shot anyway. :)
<derdon> mrvn: maybe I did some bad things and see that I have to change some part of a function
<flux> pft, interfaces can always get better ;)
<flux> too bad there is no way to describe the changes in a way that is automatically processible
<derdon> mrvn: unittests feed a function with some values and test its return value
<derdon> mrvn: they cannot test what happends "behind the scenes"
<derdon> *happens
<mrvn> And what else is an API? The API doesn't care how the implementation does it. Just what input gives what result.
<mrvn> flux: Then you extend it and carry along the old stuff with some compatibility layer.
<flux> mrvn, and end up with a mega-interface
<derdon> mrvn: API was the wrong word.
<mrvn> flux: Yes. so think about the Interface befor declaring it stable.
<flux> mrvn, how much success have you had with actually following doing things this way?
<mrvn> flux: A lot but not always. Sometimes it is better to start from scratch.
<flux> one of the nicest things about languages with static type systems is that you can infact change an interface and nothing will break silently. so you can do it.
<mrvn> flux: and all the people using your interface will curse you
<flux> simply don't upgrade ;)
<mrvn> Does ocaml have any notion of SOVERSION or versioned symbols?
knorr has joined #ocaml
ulfdoz has quit [Remote host closed the connection]
knorr has left #ocaml []
menace has joined #ocaml
<mrvn> flux: not upgrading isn't always an option. You might have sources that need the new one.
<kaustuv> Sorry for the delayed response, but I often write modules that have very narrow APIs, often just a function or two, but I would still like to state and test the invariants used in its implementation. Separating the tests forces me to maintain a public and a private API, or selectively compile the .mli files, neither of which is effortless
<mrvn> Upgrading seems to be one thing ocaml is verry bad at anyway. You always need to recompile everything when you upgrade ocaml itself for example.
<mrvn> kaustuv: unit tests are supposed to use the public api
<kaustuv> That's a pretty dogmatic statement about tests
<mrvn> kaustuv: A big drawback of putting the tests next to the real code is binary size.
<mrvn> kaustuv: No. that is how unit tests usualy work
<kaustuv> Well, then, suppose I don't call my tests "unit tests" but rather "invariant checking tests". People surely write such things!
<derdon> what are private APIs? APIs for closed source code?
<mrvn> How do you put your tests next to the code in ocaml? Doesn't that mean all your test functions become part of the API?
<mrvn> derdon: functions you don't list in the mli file
menace has left #ocaml []
ulfdoz has joined #ocaml
<derdon> mrvn: I see
<kaustuv> mrvn: well, obviously I don't include the functions used in test building in the interface. And if my tests are of the form:
<kaustuv> let () = let module Test = struct ... end in (), then the interface isn't polluted anyhow
<mrvn> kaustuv: so you put some form of #ifdef TEST around it?
<kaustuv> That would be ideal and easily doable with Camlp4MacroProcessor, but for difficult to explain reasons I would rather not use Camlp4
<mrvn> You must have some way to disable the tests or do you really want to test on every programm start?
<kaustuv> That was my initial question. I have since then figured out how to use gcc -E for this, but it's a fairly ugly hack.
<mrvn> ahh, didn't see your initial question, just dropped in in the middle.
<mrvn> gcc -E + #ifdef works fine. Just means some customization of the Makefiles.
<kaustuv> However, gcc -E puts #stuff in the file which I have to fiter out, and is a bit annoying about having #stuff appear at the starts of lines in the source. These are not huge problems (so far).
tmaedaZ has quit [Ping timeout: 268 seconds]
<derdon> what is the best way of testing whether a string is empty? pattern matching not an option because the else part has a long try-with construct
tmaedaZ has joined #ocaml
<derdon> I could test the length with ``if Str.length the_string = 0 then "empty string!" else "non-empty string!"``, but that looks like bad style to me
<kaustuv> String.length is O(1) so there is practically no reason to avoid it
<mrvn> let foo bar baz = function "" -> "empty" | s -> bar s baz
<mrvn> if the string is the last arg
<derdon> mrvn: and what is bar?
<mrvn> some other arg
<derdon> aha
<derdon> I use String.length :D
<mrvn> let foo = function "" -> "Empty | s -> fun bar baz -> bar s baz looks ugly imho but also works
<mrvn> s/"Empty/fun _ _ -> "Empty"/
<mrvn> I also like if Str.length the_string = 0 then raise Empty; <normal code>
<derdon> good
<mrvn> I prefer that to else because it indents less
_andre has quit [Quit: *puff*]
<derdon> yes, me too
<derdon> it depends a bit on the context
willb1 has quit [Ping timeout: 248 seconds]
ttamttam has quit [Quit: Leaving.]
<mrvn> obviously if you can't raise an exception in the then part then ...
willb1 has joined #ocaml
willb1 has quit [Ping timeout: 258 seconds]
eldragon has quit [Read error: Connection reset by peer]
eldragon has joined #ocaml
<derdon> mrvn: now I use pattern-matching
willb1 has joined #ocaml
<derdon> mrvn: I wrote a seperate function for the else part
<mrvn> works too
kaustuv has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
maskd has quit [Quit: leaving]
jimmyb2187 has left #ocaml []
linus5 has quit [Remote host closed the connection]
pimmhogeling has quit [Ping timeout: 265 seconds]
enthymeme has joined #ocaml
jeddhaberstro has joined #ocaml
<mrvn> let todo = ref [ "Get package from post office" ];;
maattd has joined #ocaml
maskd has joined #ocaml
Submarine has quit [Read error: Operation timed out]
slash_ has joined #ocaml
det has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
thrasibule has joined #ocaml
oc131 has quit [Ping timeout: 245 seconds]
thieusoai has quit [Remote host closed the connection]
ygrek has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
<derdon> can the module Str distinguish between greedy and non-greedy expressions?
maattd has quit [Remote host closed the connection]
<flux> I don't think so
<flux> I use PCRE almost always anyway
<flux> Str's non-threadsafety (even in the parts that look safe) has bitten me into butt once :)
thrasibule has quit [Read error: Operation timed out]
thieusoai has joined #ocaml
<derdon> flux: is PCRE possible when using the batteries?
<flux> sure
<flux> although I don't think batteries makes use of it
<flux> but you afaik can use any other library with batteries
<derdon> flux: what do you mean exactly by "I use PCRE almost always anyway" then?
<derdon> is there an ocaml library called pcre or what?
<flux> yes
<Camarade_Tux> it's worth mentionning mikmatch(-pcre) btw, it's really nice =)
<flux> what I meant was that whenever I find a problem I think regular expressions is worth using, I use the pcre bindings for ocaml..
<derdon> flux: ok, didn't hear of it before. thanks!
<flux> mikmatch is nice too. haven't used it for a while, though.
<flux> didn't know it had a pcre variant
<derdon> flux: named subpatterns are possible there, too?
<flux> appears to be. I haven't used that feature.
<derdon> I like it very much (am coming from Python)
<flux> maybe you would like to take a look at mikmatch
<Camarade_Tux> in mikmatch, yes
<flux> from the sound of it very much handles those kinds of needs
<flux> but I'll be off to sleep
<Camarade_Tux> mikmatch is the only time I'm using ocaml-pcre because I don't have to learn any API :P
bmp has joined #ocaml
bmp has quit [Client Quit]
bmp has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
rwmjones has joined #ocaml