gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Batteries 1.2.0 released http://batteries.forge.ocamlcore.org
sepp2k has quit [Quit: Leaving.]
travisbrady has quit [Quit: travisbrady]
ccasin has joined #ocaml
valross has quit [Ping timeout: 260 seconds]
elehack has joined #ocaml
valross has joined #ocaml
elehack has quit [Quit: Goodbye...]
leino has quit [Quit: leaving]
ccasin has quit [Quit: Leaving]
valross has quit [Ping timeout: 276 seconds]
valross has joined #ocaml
mbishop has quit [Ping timeout: 265 seconds]
travisbrady has joined #ocaml
caligula_ has quit [Read error: Operation timed out]
caligula_ has joined #ocaml
mbishop has joined #ocaml
ulfdoz has joined #ocaml
thrasibule has joined #ocaml
caligula__ has joined #ocaml
caligula_ has quit [Ping timeout: 245 seconds]
joewilliams is now known as joewilliams_away
travisbrady has quit [Quit: travisbrady]
Yoric has joined #ocaml
Yoric has quit [Quit: Yoric]
Amorphous has quit [Ping timeout: 248 seconds]
thrasibule has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
thrasibule has joined #ocaml
Submarine has joined #ocaml
Amorphous has joined #ocaml
thrasibule has quit [Ping timeout: 265 seconds]
ygrek has quit [Ping timeout: 245 seconds]
ttamttam has joined #ocaml
BigJ has quit [Remote host closed the connection]
BigJ has joined #ocaml
Yoric has joined #ocaml
thelema_ has joined #ocaml
thelema has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Quit: Leaving]
<sgnb> palomer: if they are not mutable, what's the problem?
<sgnb> (yes, there is a (known) issue with strings)
mbishop has quit [Remote host closed the connection]
<f[x]> actually manual sums it up clearly : On mutable structures, e1 == e2 is true if and only if physical modification of e1 also affects e2. On non-mutable structures, the behavior of (==) is implementation-dependent; however, it is guaranteed that e1 == e2 implies compare e1 e2 = 0.
mbishop has joined #ocaml
ftrvxmtrx has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
barismetin has joined #ocaml
ikaros has joined #ocaml
<f[x]> why doesn't ocamlbuild deduce use_xxx tags for final link given correct use_xxx annotations on .ml files in _tags ?
<f[x]> alternatively it could just bring in all the tags of dependencies at each step, given correct `flag` setups it should work fine, no?
sepp2k has joined #ocaml
avsm has joined #ocaml
valross has quit [Quit: Ex-Chat]
ttamttam has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
_unK has joined #ocaml
ttamttam has joined #ocaml
ygrek has joined #ocaml
boscop_ has left #ocaml []
boscop has joined #ocaml
avsm has quit [Quit: Leaving.]
_unK has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 245 seconds]
seafood has joined #ocaml
avsm has joined #ocaml
mrvn has quit [Quit: leaving]
sepp2k has quit [Quit: Leaving.]
ttamttam has quit [Quit: Leaving.]
derdon has joined #ocaml
leino has joined #ocaml
seafood has quit [Quit: seafood]
Submarine has quit [Ping timeout: 260 seconds]
Submarine has joined #ocaml
_andre has joined #ocaml
avsm has quit [Quit: Leaving.]
fraggle_laptop has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
thelema_ is now known as thelema
<thelema> f[x]: it depends on your myocamlbuild file to act on the tag properly. How did you write yours?
<f[x]> thelema, how can I write plugin so that setting tag on .ml file will influence .byte target?
<f[x]> afaik there is no other way then setting both <some.ml>: use_xxx and <some.byte>: use_xxx
<thelema> make sure that you set the correct argument for flag["ocaml";"link";"use_xxx"] & S[A"xxx.cmo"]
<thelema> <some.{ml,byte}>: use_xxx
<thelema> or <some.*>: use_xxx
<f[x]> that doesn't scale for big project with many files
<thelema> <*>: use_xxx
<thelema> or even <**/*>: use_xxx
<f[x]> or even write Makefile manually - thank you
<thelema> you can tag as much as you want. If you really want to hard-code the dependency, you can just give more arguments to flag["ocaml";"link"] and "compile"
<f[x]> this doesn't work because dependencies of some parts of the project are required to build any part of the project
<thelema> why doesn't <**/*> work?
ikaros has joined #ocaml
<f[x]> Consider: some test code in the project requires, say, deriving, while main project does not. On target server I don't have deriving and don't want to install it cause all I need is only main project
<thelema> <test/*>: pkg_deriving
Yoric has quit [Quit: Yoric]
<f[x]> this is not the only dependency - and different projects require different deps
<thelema> as long as you don't compile the test code, deriving won't be needed
<thelema> so use different tags files for different projects...
<f[x]> and different directories -> not convenient
<thelema> and multiple dependencies aren't a problem, I use global dependencies and local dependencies together, no problem.
<f[x]> these are workarounds, ocamlbuild has all information at hand to set use_xxx tags based on dependencies
fraggle_laptop has quit [Ping timeout: 258 seconds]
<thelema> I agree that ocamlbuild should be able to determine what ocamlfind packages (and other packages like unix, num, threads) are used in a file without any tags. It doesn't now.
<f[x]> no, this is not the point
<thelema> you think use_foo should inherit across dependencies?
<f[x]> yes
<thelema> ahhh.. that's a design decision that maybe nicholad pouillard made wrong.
<thelema> *nicholas
<f[x]> I think that probably almost all flags could be inherited across deps,
<thelema> not all tags should inherit
<thelema> but you're right, most flags should.
<thelema> I've just been very liberal in tagging - few of my projects have complex tagging requirements
<f[x]> I try to get off with 'true: ...' whenever I can
ftrvxmtrx has quit [Quit: Leaving]
<palomer> hrmph, == is undefined...
<palomer> bummer
<thelema> palomer: huh? where is == undefined
<palomer> I mean, implementation dependent
<palomer> I'm displaying an ast and I need to know which node I'm currently viewing
<thelema> yes, we can't actually mention pointer comparison in the manual...
<palomer> the easiest way is to simply have a pointer to that node...
<palomer> but that doesn't seem to work
<thelema> !r1 == !r2?
<palomer> what's r1 and r2?
<thelema> your two refs (pointers)
<palomer> well...I currently only have one pointer
<thelema> what are you going to == it with?
<palomer> do I need to do !(ref x) == !current ?
<palomer> I'm currently doing {x == !current}
<thelema> x == !current
<palomer> but that doesn't work
<thelema> that should do pointer comparison between your value and what's in the ref cell
<palomer> since (Foo Bar) == !(ref (Foo Bar))
<thelema> # (Foo Bar) == !(ref (Foo Bar));;
<thelema> - : bool = False
<thelema> all the leaves will compare the same
<palomer> create () == !(ref (create ()));;
<palomer> returns true
<thelema> # Bar == !(ref Bar);;
<thelema> - : bool = True
<thelema> but anything larger than a word has to be heap allocated, and you're doing proper pointer comparison
<thelema> ANNOUNCE: Batteries 1.2.0 is now in GODI - please test and report bugs
<f[x]> thelema, not so in let f () = Foo Bar
<palomer> type u = Bar ;; type t = Foo of bar ;; let create () = Foo Bar ;; create () == !(ref (create ()));
<thelema> f[x]: true, there's only one allocation.
<f[x]> palomer, use unique ids and be done with it
<palomer> what about f () = Foo "boom"
<thelema> palomer: nope
<palomer> f[x]: a la counter = ref 0;; ?
<f[x]> yes
<palomer> let create () = Foo "foo";;
<palomer> create () == !(ref (create ()));;
<palomer> returns true
<thelema> yes, there's only one allocation going on. I'm not sure how to trigger an allocation every time you call a function if you're returning a constant value... Oo.copy does this for objects
<palomer> oh, I thought your "nope" was referring to my Foo "boom"
<palomer> doesn't it need to allocate the string and allocate the Foo which points to the string?
<thelema> yes, but only once
<thelema> let create () = Foo (String.copy "foo")
ikaros_ has joined #ocaml
seanmcl has joined #ocaml
seanmcl has quit [Client Quit]
seanmcl has joined #ocaml
seanmcl has quit [Client Quit]
seanmcl has joined #ocaml
ccasin has joined #ocaml
joewilliams_away is now known as joewilliams
Yoric has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Quit: Leaving.]
ikaros_ has quit [Quit: Leave the magic to Houdini]
f[x] has quit [Ping timeout: 260 seconds]
seanmcl has quit [Quit: seanmcl]
robthebob has joined #ocaml
<robthebob> hi all, i'm trying to compile a simple program using the batteries string syntax extension from the command line using ocamlfind
<robthebob> specifically the test_printf.ml file included with batteries 1.2.0
<robthebob> however, despite reading the man page in some detail and googling extensively, i cannot seem to do this
<robthebob> i think this should work: ocamlfind ocamlc -syntax camlp4o,pa_strings.cma test_printf.ml
<robthebob> but i get: "ocamlfind: When using -syntax, the META variable 'preprocessor' must be set"
<robthebob> if i specify the preprocessor command directly: ocamlfind ocamlc -package batteries -pp 'camlp4o pa_strings.cma' test_printf.ml
<robthebob> i get: "Camlp4: Uncaught exception: DynLoader.Error ("pa_strings.cma", "file not found in path")"
<robthebob> the documentation provided with batteries seems to be out of date, so i would really appreciate some help on this one
barismetin has quit [Quit: Leaving...]
<mfp> robthebob: try this
<mfp> ocamlfind ocamlc -syntax camlp4o -package batteries,batteries.pa_string.syntax -o test_printf test_printf.ml -linkpkg
<mfp> or even batteries.syntax instead of batteries.pa_string.syntax (to enable the comprehension syntax extension)
<robthebob> ah so batteries.syntax includes all syntax extensions? (currently just string and comprehension)
<palomer> the enter key is wrong in curses
<palomer> :/
<palomer> should be 0o12
<mfp> robthebob: yup
travisbrady has joined #ocaml
<robthebob> ok great that is better now, but i still get "Reference to undefined global `Batteries'"
<mfp> I'm also getting that (with some 1.2.0pre build from the git repos)
<mfp> thelema: is that a bug? looks like the Batteries is not included in batteries_uni.cm(x)a
<mfp> robthebob: for the time being, add -thread to the above cmdline
<mfp> robthebob: maybe the Batteries module is not linked into batteries_uni.cma
<mfp> but it works fine if you enable threading (thus linking against batteries.cm(x)a)
<robthebob> mfp: ok, that's good thanks
<robthebob> but, what effect will that have?
<mfp> it just links against threads.cmxa
<mfp> (and pthread)
<robthebob> ok, i'll live then i guess, but it does sound like a bug
Yoric has quit [Quit: Yoric]
<mfp> yes, it seems the Batteries module is not included in the batteries_uni lib
<robthebob> well, thanks for your help mfp
<mfp> np
<mfp> robthebob: k, it's not a bug after all; you have to use open Batteries_uni (instead of open Batteries) if you're going to use the non-multithreaded batteries
<robthebob> ok great thanks
ikaros has quit [Ping timeout: 260 seconds]
ikaros has joined #ocaml
bluestorm has joined #ocaml
oriba has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
ftrvxmtrx has joined #ocaml
leino has quit [Quit: leaving]
neorab has quit [Quit: .]
det has quit [Remote host closed the connection]
neorab has joined #ocaml
murphe has joined #ocaml
<murphe> I'm kinda new to ocaml, so be easy on me. If i have a global function (let foo = ) and then a local variable (let bar = baz in X), how would i do a second local 'let' - do i have to nest two levels of 'in'?
<bluestorm> murphe: your question is kinda vague but if it means what I think then "yes"
<bluestorm> let bar = baz in (let foobar = foobaz in barbaz)
<bluestorm> (wich you can consider sequentally : two "let" and one expression : http://pastebin.com/RT341bap )
<murphe> ah
<murphe> mmkay
<murphe> i wasn't sure if i had to just keep nesting things
<murphe> i suppose it makes sense though
oriba has quit [Quit: Verlassend]
<murphe> i'm new to functional programming. it's kiinda making my head explode :)
rjsimmon has joined #ocaml
<murphe> Mmkay. I'm trying to do a map, then a fold_left. This works: let matched = map matches_a l in fold_left (+) 0 matched
<murphe> can i do that without 'matched' and just nest it?
<murphe> something like: fold_left (+) 0 (map matches_a l)
ccasin has quit [Quit: Leaving]
<jonafan> sure
<jonafan> what does matches_a do?
komar_ has joined #ocaml
komar_ has quit [Client Quit]
joewilliams is now known as joewilliams_away
<murphe> just checks if something matches a constant i was given earlier: let matches_a b = if a = b then 1 else 0 in
<murphe> overall, i'm trying to count how many instances of 'a' are in a list
<murphe> and figured i'd just map it to something that made the entries 0 or 1 then sum them with fold_left
<murphe> (mostly just wanted to write/use map and fold)
<jonafan> you could also use filter and length
seafood has joined #ocaml
ulfdoz has joined #ocaml
seafood has quit [Client Quit]
seafood has joined #ocaml
iratsu has quit [Ping timeout: 248 seconds]
iratsu has joined #ocaml
<jlouis> oh, the joys of Ocaml
<jlouis> always liked that language
iratsu has quit [Ping timeout: 240 seconds]
iratsu has joined #ocaml
<jonafan> i'd really like to use it for a big program someday
<jonafan> i've only used it for some text processing
jcaose-60603 has left #ocaml []
_andre has quit [Quit: Lost terminal]
joewilliams_away is now known as joewilliams
<jlouis> jonafan: in my opinion it is one of those tools which gets better with size
<murphe> Could someone explain "fun () -> print_string" in this: fold_left (fun () -> print_string) ()
<murphe> mostly how the -> is working
<murphe> i've used that in 'match'
<bluestorm> (fun x -> a) means the function that takes x and return a
<bluestorm> (fun x -> x) is the identity function
<murphe> ahh
<bluestorm> (fun x -> x+1) is the successor function
<murphe> i'm familiar with that whe the interpreter lists the types of functions
<bluestorm> (fun () -> print_string) takes the unit value (of type "unit") and returns print_string
<murphe> but you can use it to declare them too? i did not know that
<bluestorm> the type of (fun () -> print_string) is thus (unit -> string -> unit)
<bluestorm> yes you can
<murphe> thanks! :D
bluestorm has quit [Ping timeout: 264 seconds]
Submarine has quit [Remote host closed the connection]
ikaros has joined #ocaml
iratsu has quit [Read error: Operation timed out]
ulfdoz has quit [Ping timeout: 245 seconds]
derdon has quit [Ping timeout: 248 seconds]
<boscop> can someone please explain this to me (from wikipedia): "For some fixed value k, rank-k polymorphism is a system in which a quantifier may not appear to the left of more than k arrows (when the type is drawn as a tree)"
<boscop> (I've understood the explanation of the Rank-1 polymorphism)
<boscop> how is the type drawn as a tree?
<boscop> does that mean, a type variable can itself be a polymorphic type, but to get to an actual type through it needs at most k instantiations (or type substitutions)?
<sgnb> boscop: types can be drawn as binary trees with arrows on the nodes
<sgnb> A -> B is a node with A as left son and B as right son
<boscop> and what are the sons in this context?
<boscop> the type variables?
<sgnb> the lefs are atomic types (int, bool, string, 'a list, etc.)
<sgnb> the sons are the tree corresponding to A and B
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 264 seconds]
fabjan has quit [Ping timeout: 248 seconds]
murph has joined #ocaml
<murph> can i turn a list into a circular list?
iratsu has joined #ocaml
fabjan has joined #ocaml
rjsimmon has quit [Quit: Leaving.]
thrasibule has joined #ocaml
seafood has quit [Ping timeout: 252 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
neorab has quit [Quit: sleepy]
drk-sd has quit [Ping timeout: 240 seconds]
iratsu has quit [Ping timeout: 240 seconds]