gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml Meeting 2011 http://bit.ly/eaZi1C | OCaml 3.12.0 http://bit.ly/aNZBUp
fraggle_ has quit [Quit: -ENOBRAIN]
fraggle_ has joined #ocaml
mnabil has quit [Quit: Leaving]
wagle has joined #ocaml
andreas1 has joined #ocaml
andreas has quit [Ping timeout: 246 seconds]
astory has joined #ocaml
<astory> is there a good way to StrSet.fold in the opposite direction?
<astory> sorry, that's Set.fold
ecc has quit [Ping timeout: 240 seconds]
eikke has quit [Ping timeout: 246 seconds]
myzt has quit [Ping timeout: 276 seconds]
ymasory has joined #ocaml
astory has left #ocaml []
boscop has quit [Ping timeout: 246 seconds]
arubin has joined #ocaml
boscop has joined #ocaml
joewilliams is now known as joewilliams_away
boscop_ has joined #ocaml
dnolen has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
eye-scuzzy has joined #ocaml
ymasory has quit [Quit: Leaving]
ymasory has joined #ocaml
rien has quit [Ping timeout: 264 seconds]
rien has joined #ocaml
joewilliams_away is now known as joewilliams
Cyanure has joined #ocaml
rien has quit [Ping timeout: 240 seconds]
rien has joined #ocaml
jonafan_ has joined #ocaml
jonafan has quit [Ping timeout: 246 seconds]
rien_ has joined #ocaml
myu2_ has joined #ocaml
rien has quit [*.net *.split]
myu2 has quit [*.net *.split]
joewilliams is now known as joewilliams_away
ymasory has quit [Quit: Leaving]
rien_ has quit [Ping timeout: 252 seconds]
rien has joined #ocaml
ulfdoz has joined #ocaml
larhat has joined #ocaml
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz has joined #ocaml
rien has quit [Ping timeout: 258 seconds]
rien has joined #ocaml
hcarty has quit [Remote host closed the connection]
arubin has quit [Quit: arubin]
Yoric has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
dnolen has quit [Quit: dnolen]
Cyanure has quit [Ping timeout: 276 seconds]
myu2_ has quit [Remote host closed the connection]
philtor has joined #ocaml
ikaros has joined #ocaml
vivanov has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Quit: Leaving]
ygrek has joined #ocaml
Yoric has quit [Quit: Yoric]
yezariaely has joined #ocaml
vivanov has joined #ocaml
philtor has quit [Ping timeout: 258 seconds]
vivanov has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
vivanov has joined #ocaml
Associat0r has quit [Quit: Associat0r]
jderque has joined #ocaml
Yoric has joined #ocaml
Tobu_ has quit [Remote host closed the connection]
Tobu has joined #ocaml
rossberg has joined #ocaml
chegibari has joined #ocaml
<chegibari> Hello
<chegibari> Is there a difference between the ocaml compiler's and the ocaml REPL's syntax?
ygrek has quit [Ping timeout: 246 seconds]
<chegibari> I'm going crazy trying to compile some relatively simple code
<flux> no other than the # directives, that belong to the repl
<flux> chegibari, example?
<flux> I shall make this claim :) : if a file does not refer to #-directives, both 'ocaml' and 'ocamlc' should work on the same file
<flux> maybe someone can point out a difference :)
rien has quit [Ping timeout: 276 seconds]
eikke has joined #ocaml
rien has joined #ocaml
<chegibari> I'll paste the code
<flux> note that a pastebin is preferred by many ;)
<flux> well, I'm pretty sure repl doesn't handle that either
<chegibari> O.O
<flux> because the amount of whitespace isn't significant
<chegibari> I typed both of them
<flux> but I bet you used ;;
<chegibari> yes
rossberg has quit [Remote host closed the connection]
<flux> chegibari, delete newlines and think about lines 18-21
<chegibari> what's wrong?
<chegibari> 18-21 in both?
rossberg has joined #ocaml
<chegibari> no, in the first
* chegibari is thinking
<flux> chegibari, think about this line: let b2 = IntMap.is_empty n Printf.printf "%B\n" b1 Printf.printf "%B\n" b2
<flux> chegibari, how should ocaml interpret that?
<chegibari> yes, I can't check that but I guess the error was there
<chegibari> should I use "in"?
<flux> chegibari, do you know what is the difference between a statement and an expression?
<chegibari> to introduce the body?
<chegibari> I program fluently in F#
<chegibari> but I'm missing something basic here, I guess
<chegibari> :)
<flux> chegibari, ok, in that case here is a rule: a file consists of blocks. a block consists of either a list of statements or exactly one expression. blocks are separated with ;;.
<flux> chegibari, the trick here is to make your last two expression statements
<flux> and that can be done for example by prefixing then with "let _ = "
<flux> alternatively, you can append ;;-sequences between the blocks
<flux> (I prefer not using ;;)
<chegibari> ah, I guess I understand
<chegibari> the ocaml book I read used a lot of interactive code
<chegibari> so I probably never faced this thing
<flux> I wonder why that simple rule doesn't seem to be written down anywhere..
<chegibari> ocaml books, actually
<chegibari> thanks for the explanation
<flux> which ocaml books, btw?
<chegibari> 1 sec
<flux> chegibari, btw, I typically finish my ocaml programs like: let main () = insert; code; here and then let _ = main ()
rien has quit [Ping timeout: 246 seconds]
<chegibari> "Developing Applications With Objective Caml", "Introduction to Objective Caml"
<flux> I understand those are decent material
<flux> there is this one that has been heavily recommended against, but I cannot recall its name..
<chegibari> "Using, Understanding, and Unraveling The OCaml Language"
rien has joined #ocaml
vivanov has quit [Ping timeout: 260 seconds]
<chegibari> mostly they make you use the REPL
<chegibari> and I read them mostly in random order, so probably that's written somewhere
<chegibari> but I missed it
<chegibari> in f# the program main starts with a "do ..." in the last file of the project
<flux> ah, the adviced-against-book is "Practical O'Caml"
<chegibari> so it's something similar
<chegibari> but i didn't think of that
<chegibari> thanks again
vivanov has joined #ocaml
<flux> chegibari, good luck with your ocaml programs :)
<chegibari> thanks. I think i'll love it more than F#
<chegibari> F# didn't click much for me
<flux> chegibari, I haven't done any F#. what do you feel is the largest difference at this point?
<larhat> F# doesn't have modules, afaik — this is HUGE mistake in design
<chegibari> first, despite F# is marketed as "largely source code compatible with ocaml" there is the "slight" different that the .NET type system is not structural but nominal (is that the word?)
<chegibari> second, F# has modules but nothing close to ocaml modules
<chegibari> F# modules are the .NET static classes
<chegibari> no functors
<chegibari> they are simply like namespace but you can also put values in them
<flux> modules are indeed pretty nice in o'caml
<chegibari> yes
<flux> especially now that they are first-class
<chegibari> it's what make a "balanced" language
<chegibari> you can't just "forget" a feature in a language and pretent it's almost the same
<chegibari> another thing that I don't like is that the syntax is supposed to be almost equal to the ocaml's (and it is, for large extents) but that's not always the best choice
<chegibari> I think that nemerle is a much more elegant functional language for .NET
<chegibari> it doesn't want to be catch for people coming from ocaml and it has a powerful macro system
<chegibari> catchy
<f[x]> thelema, what's wrong with batteries tests on windows? Is that for real or something wrong with build machine?
andreas1 has quit [Quit: Leaving.]
mnabil has joined #ocaml
lopex has joined #ocaml
chegibari has quit []
andreas has joined #ocaml
Cyanure has joined #ocaml
vivanov has quit [Ping timeout: 252 seconds]
vivanov has joined #ocaml
npouillard has quit [Read error: Operation timed out]
avsm has joined #ocaml
npouillard has joined #ocaml
jamii has joined #ocaml
_andre has joined #ocaml
Cyanure has quit [Quit: Quitte]
yezariaely has quit [Read error: Connection reset by peer]
ygrek has joined #ocaml
iris1 has quit [Read error: Connection reset by peer]
iris1 has joined #ocaml
iris1 has quit [Client Quit]
ygrek has quit [Ping timeout: 246 seconds]
yezariaely has joined #ocaml
Cyanure has joined #ocaml
yezariaely has quit [Ping timeout: 260 seconds]
edwin has joined #ocaml
<vivanov> in batteries, what to add to _tags to avoid writing "open Batteries" at the beginning of each file?
yezariaely has joined #ocaml
<larhat> vivanov: https://github.com/ocaml-batteries-team/batteries-included/wiki/Getting-started —> "Tell ocamlbuild to use batteries through a _tags file: <*>: pkg_batteries,pkg_threads"
<flux> I don't think that makes it happen, though
<larhat> oh, nevermind, i misunderstood the question :-(
<flux> I just use 'open Batteries', or actually something like 'open Common' and have common.ml with 'include Batteries' and some other project-specific module aliases
<vivanov> after adding what larhat mentioned to _tags i still need to put open Batteries at the beginning
<flux> batteries used to come with a syntax extension that sticks 'open Batteries' in front of the file, but I'm not sure if it still does
<vivanov> flux: it doesnt any more
<vivanov> i submitted a bug about that coz documentation says it does
boscop_ has quit [Ping timeout: 240 seconds]
<vivanov> flux: that makes sense what you suggest -- ill stick to open Common
ftrvxmtrx has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
ftrvxmtrx has joined #ocaml
boscop has quit [Ping timeout: 258 seconds]
Associat0r has joined #ocaml
jderque has quit [Quit: Leaving.]
joelr has joined #ocaml
<joelr> Good day
<joelr> Suppose I'm testing an insert of a row into a database. Using OUnit.
<joelr> Would it be correct to say that the actual insert goes into test setup and the body of the test is all assertions?
<joelr> Is it proper to mix at will?
joelr has quit [Quit: joelr]
ymasory has joined #ocaml
rien has quit [Ping timeout: 248 seconds]
ymasory has quit [Quit: Leaving]
andreas has quit [Ping timeout: 240 seconds]
rien has joined #ocaml
boscop has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
yezariaely has left #ocaml []
boscop has joined #ocaml
jamii has quit [Ping timeout: 240 seconds]
boscop has quit [Ping timeout: 246 seconds]
andreas has joined #ocaml
impy has quit [Ping timeout: 246 seconds]
hcarty has joined #ocaml
wolverian has quit [Quit: brb]
ecc has joined #ocaml
wolverian has joined #ocaml
Cyanure has quit [Read error: Operation timed out]
lopex has quit []
ymasory has joined #ocaml
wolverian has quit [Quit: brb]
wolverian has joined #ocaml
Kakadu has joined #ocaml
wolverian has quit [Quit: WeeChat 0.3.2]
lamawithonel has joined #ocaml
wolverian has joined #ocaml
Snark has joined #ocaml
ygrek has joined #ocaml
_andre has quit [Read error: Operation timed out]
andreas has quit [Ping timeout: 240 seconds]
_andre has joined #ocaml
philtor has joined #ocaml
lopex has joined #ocaml
jamii has joined #ocaml
joewilliams_away is now known as joewilliams
jonafan_ is now known as jonafan
jamii has quit [Ping timeout: 260 seconds]
Associat0r has quit [Quit: Associat0r]
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
joelr has joined #ocaml
boscop has joined #ocaml
<joelr> Any OUnit users here?
Associat0r has joined #ocaml
<f[x]> re
Associat0r has quit [Client Quit]
Associat0r has joined #ocaml
chegibari has joined #ocaml
<chegibari> F#'s "do" is actually syntactic sugar for "let _ ="
jamii has joined #ocaml
lopex has quit []
munga has joined #ocaml
jamii has quit [Read error: Connection reset by peer]
philtor has quit [Ping timeout: 276 seconds]
<joelr> f[x]: do you get stack traces showing the line of code in your test file?
<f[x]> no
<f[x]> why?
<joelr> f[x]: Because it's silly to see a stack trace that goes all the way to down Pervasives but stops one level before your test file.
<f[x]> I don't understand what you say
jamii has joined #ocaml
<f[x]> why should I see any stacktraces for the test file?
<f[x]> all exceptions are caught by ounit
<joelr> Not very helpful
<f[x]> did you compile all modules with debug info?
<f[x]> also use assert_equal ~printer:Std.dump at least
<joelr> f[x]: all my modules are compiled with debug info by oasis
<f[x]> and all used libraries?
<joelr> f[x]: thanks for the printer tip but it really clutters the code
<joelr> I think used libraries were compiled with -g but I can't vouch for it. My understanding is that if they weren't then you don't get a stack trace at all
<joelr> I think that ~printer:Std.dump should be the default
<joelr> f[x]: do you agree on the default printer, though?
Cyanure has joined #ocaml
<f[x]> it can't be the default unless oUnit depends on extlib
<joelr> darn
eikke has quit [Read error: Operation timed out]
<f[x]> but you can easily let assert_equal ?(printer=Std.dump) = assert_equal ~printer at the top of unittests
<joelr> right
ftrvxmtrx has quit [Quit: Leaving]
chegibari has quit []
avsm has quit [Quit: Leaving.]
undecidable has joined #ocaml
lamawithonel has quit [Ping timeout: 246 seconds]
lamawithonel has joined #ocaml
sepp2k has joined #ocaml
<vivanov> when i caompile a project sometimes i get error: type cannot be generelized ... (int, '_a -> unit) Dict.t -- but the type can be infered from other modules. i always explicitly specified types to fix that error -- is there another workaround ?
munga has quit [Quit: Ex-Chat]
larhat has quit [Quit: Leaving.]
<thelema> vivanov: yes, don't use polymorphic non-functions as toplevel values.
<vivanov> thelema: :) ok thx
Kakadu has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 246 seconds]
jderque has joined #ocaml
mnabil has quit [Read error: Operation timed out]
ftrvxmtrx has joined #ocaml
eikke has joined #ocaml
ymasory has quit [Quit: Leaving]
Snark has quit [Quit: Ex-Chat]
Yoric has quit [Quit: Yoric]
joelr has quit [Ping timeout: 264 seconds]
ymasory has joined #ocaml
Modius has quit [Quit: "Object-oriented design" is an oxymoron]
Oejet has joined #ocaml
sheets1 has joined #ocaml
<sheets1> Is it possible to define a functor that takes as argument a module with an open polymorphic variant type? I am getting "type variable unbound" errors for the open type.
<sheets1> I should say the actual parameter modules will be closed but the functor only requires a subset of poly variant constructors.
joelr has joined #ocaml
andreas1 has joined #ocaml
impy has joined #ocaml
rien has quit [Ping timeout: 258 seconds]
rien has joined #ocaml
<thelema> sheets1: maybe the "type 'a constraint 'a = [> `Foo]" syntax will help you?
<thelema> err, type x = 'a constraint ...
philtor has joined #ocaml
Yoric has joined #ocaml
jamii has quit [Quit: Leaving]
arubin has joined #ocaml
lamawithonel has quit [Ping timeout: 246 seconds]
<sheets1> thelema: looking for documentation on that… "type t = 'a constraint [> `Effect of obj ]" doesn't seem to work and ocamlc says "'end' expected"
<thelema> type t = 'a constraint 'a = [> `Effect of obj ]
<thelema> don't forget the second 'a =
<sheets1> aha silly me
<sheets1> that syntax makes much more sense ;-)
lamawithonel has joined #ocaml
ymasory has quit [Quit: Leaving]
jderque has quit [Quit: leaving]
boscop_ has joined #ocaml
<sheets1> thelema: it looks like i can do "type 'a t = [> `Foo ] as 'a" and this gets expanded to the type constraint clause. To unify in the functor then, I need to have "type 'a t = … as 'a" in my argument module.
boscop has quit [Ping timeout: 246 seconds]
boscop_ is now known as boscop
<sheets1> however, in the toplevel, doing this still causes unification to fail between [> `Effect ] and [ `Effect | `Foo ]
<thelema> if all else fails, email garrigue - he's amazingly approchable
<sheets1> hmm ok, thanks for the help
<sheets1> thelema: do you know about row polymorphism? I currently have type 'a model = { field1 : foo; field2 : foo; box : 'a } for extensible records but would like the polymorphic row types to collapse over an arbitrary depth without manual wrapping and unwrapping. Can I achieve this with classes? My biggest issue is loss of the record constructors { field1=…; field2=…; box=… } and { model with box=… }. Can I use classes but still
thelema_ has joined #ocaml
Modius has joined #ocaml
thelema has quit [Ping timeout: 258 seconds]
edwin has quit [Remote host closed the connection]
<hcarty> sheets1: Objects can do have a similar syntax
_andre has quit [Quit: leaving]
<sheets1> hcarty: don't I have to wrap everything in methods, though? I no longer get "setter constructors" for free?
<thelema_> classes have a syntax to construct a new object from an old one, modifying a few fields
<sheets1> hmm i just must be bad at reading the manual :-P
<hcarty> sheets1: Possibly - it's been a while since I've used OCaml's object system heavily
<hcarty> sheets1: {< ... >} or something similar
<sheets1> hcarty: aha yes, you are correct 3.13 Functional objects in the manual
<hcarty> sheets1: That's the one
ymasory has joined #ocaml
<hcarty> sheets1: You can use object method x = 1 end to (or method x = ref 1) to avoid manually creating getters and setters
Cyanure has quit [Ping timeout: 246 seconds]
boscop has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
ymasory has left #ocaml []
undecidable has quit [Quit: Leaving]
ymasory has joined #ocaml
sepp2k has quit [Quit: Leaving.]
lopex has joined #ocaml
joelr has quit [Quit: joelr]
boscop has joined #ocaml
Yoric has quit [Quit: Yoric]
avsm has quit [Quit: Leaving.]
Amorphous has quit [Ping timeout: 240 seconds]
joewilliams is now known as joewilliams_away
ulfdoz has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
Amorphous has joined #ocaml
Associat0r has quit [Quit: Associat0r]
eikke has quit [Ping timeout: 260 seconds]
lopex has quit []