Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
joewilliams has quit [Remote closed the connection]
_unK has quit [Remote closed the connection]
ikaros_ has quit ["Leave the magic to Houdini"]
Associat0r has quit []
EliasAmaral has quit [Remote closed the connection]
tmaeda is now known as tmaedaZ
<palomer> no more netsplits!
rwmjones has quit [farmer.freenode.net irc.freenode.net]
jlouis has quit [Read error: 60 (Operation timed out)]
rwmjones has joined #ocaml
Dodek has quit [Read error: 60 (Operation timed out)]
Dodek has joined #ocaml
EliasAmaral has joined #ocaml
tmaedaZ is now known as tmaeda
tmaeda is now known as tmaedaZ
Pepe_ has quit [Remote closed the connection]
M| has quit [Remote closed the connection]
Pepe_ has joined #ocaml
M| has joined #ocaml
prigaux has quit [Remote closed the connection]
bogen has joined #ocaml
prigaux has joined #ocaml
my007ms has quit [Read error: 110 (Connection timed out)]
my007ms has joined #ocaml
jlouis has joined #ocaml
bogen1 has joined #ocaml
<palomer> cool, never noticed that ocaml has partial application of infix operators
<palomer> I guess it's because ocaml programmers don't use it as much as haskell programmers
bogen has quit [Nick collision from services.]
bogen1 is now known as bogen
* palomer wish he understood camlp4 better
BlackRockFailed has left #ocaml []
tmaedaZ is now known as tmaeda
mangloid has joined #ocaml
<EliasAmaral> palomer, :) me too
thrasibule has joined #ocaml
joewilliams has joined #ocaml
pad has quit [Read error: 104 (Connection reset by peer)]
Dodek has quit [Read error: 60 (Operation timed out)]
Dodek has joined #ocaml
my007ms has quit [Read error: 60 (Operation timed out)]
my007ms has joined #ocaml
ski_ has quit ["Lost terminal"]
joewilliams has quit ["Leaving..."]
ulfdoz has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
joewilliams has joined #ocaml
valross has quit ["Ex-Chat"]
ygrek has joined #ocaml
Yoric[DT] has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
zhijie1 has quit [Read error: 54 (Connection reset by peer)]
zhijie has joined #ocaml
zhijie has quit [Read error: 60 (Operation timed out)]
ttamttam has joined #ocaml
Submarine has joined #ocaml
ttamttam has quit ["Leaving."]
Submarine has quit [Client Quit]
Submarine has joined #ocaml
joewilliams has quit [Remote closed the connection]
hyperboreean has quit [Client Quit]
hyperboreean has joined #ocaml
ttamttam has joined #ocaml
fx_ has joined #ocaml
flx_ is now known as flux
nimred_ has quit [Client Quit]
nimred has joined #ocaml
<bogen> I can access libraries in /usr/lib/ocaml. how can I access libraries in /usr/lib/ocaml/site-lib/ ?
Yoric[DT] has quit ["Ex-Chat"]
<EliasAmaral> bogen, there is a compiler switcher..
<EliasAmaral> and/or interpreter
<EliasAmaral> okay, it's -I directory
<EliasAmaral> -I +site-lib
<EliasAmaral> + will means "on the standard directory"
<EliasAmaral> http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html (it's more or less the man page for ocaml command, see the other commands on this same document by going up)
<EliasAmaral> it's actually pretty much the same thing on C (there is -L too with C)
<bogen> ok
<bogen> thanks
Associat0r has joined #ocaml
<bogen> ok, so I gather that toplevel #directives don't work in a source file I'm compiling.
<EliasAmaral> yeah
<EliasAmaral> they will maybe become compile switchers
<EliasAmaral> if all you use is #use will should get rid of it
<EliasAmaral> and use open instead (or better, use nothing, most of time you will want to write Module.function)
<EliasAmaral> in both cases you must pass the other file to the compiler (just like c)
<EliasAmaral> files are included implicity
<EliasAmaral> open will just open a already loaded module into the plain namespace
<EliasAmaral> when you load file.ml it will become the module File, so
<EliasAmaral> ocamlc -o test file.ml file2.ml and I have function test on file.ml then i will use File.test on file2.ml
_zack has joined #ocaml
jlouis has quit [Remote closed the connection]
jlouis has joined #ocaml
<gildor> bogen: #directive are toplevel only, you cannot use them with ocamlc/ocamlopt
<gildor> bogen: i.e. this is for script/interactive only
<gildor> bogen: I think library from site-lib, even if they can be accessed through +site-lib, are ocamlfind enabled library
<bogen> EliasAmaral: thanks, I figured it out.
<gildor> bogen: in this case compile with ocamlfind ocamlc|ocamlopt -package the-package-you-need
<bogen> EliasAmaral: (with your help)
<bogen> gildor: yeah, I think I understand that now
Submarine has quit [Read error: 110 (Connection timed out)]
jonafan_ has joined #ocaml
tarbo2_ has joined #ocaml
bacam_ has joined #ocaml
haelix_ has joined #ocaml
jlouis_ has joined #ocaml
hyperbor1ean has joined #ocaml
maskd has quit [farmer.freenode.net irc.freenode.net]
jlouis has quit [farmer.freenode.net irc.freenode.net]
hyperboreean has quit [farmer.freenode.net irc.freenode.net]
Pepe_ has quit [farmer.freenode.net irc.freenode.net]
mangloid has quit [farmer.freenode.net irc.freenode.net]
patronus has quit [farmer.freenode.net irc.freenode.net]
peddie_ has quit [farmer.freenode.net irc.freenode.net]
gildor has quit [farmer.freenode.net irc.freenode.net]
tab_ has quit [farmer.freenode.net irc.freenode.net]
bacam has quit [farmer.freenode.net irc.freenode.net]
haelix has quit [farmer.freenode.net irc.freenode.net]
jonafan has quit [farmer.freenode.net irc.freenode.net]
Deformative has quit [farmer.freenode.net irc.freenode.net]
bzzbzz has quit [farmer.freenode.net irc.freenode.net]
Jedai has quit [farmer.freenode.net irc.freenode.net]
svenl has quit [farmer.freenode.net irc.freenode.net]
BigJ has quit [farmer.freenode.net irc.freenode.net]
demitar has quit [farmer.freenode.net irc.freenode.net]
r0bby has quit [farmer.freenode.net irc.freenode.net]
tarbo2 has quit [farmer.freenode.net irc.freenode.net]
diginux_ has quit [farmer.freenode.net irc.freenode.net]
peddie has joined #ocaml
<bogen> The files /usr/lib/ocaml/site-lib/netstring/netstring.cma and /usr/lib/ocaml/pcre-ocaml/pcre.cma disagree over interface Pcre
Pepe_ has joined #ocaml
<bogen> this is going to take a while to figure out :)
gildor has joined #ocaml
mangloid has joined #ocaml
<rwmjones> bogen, is this debian?
<rwmjones> try doing:
<rwmjones> ocamlobjinfo /usr/lib/ocaml/site-lib/netstring/netstring.cma | grep Pcre
<bogen> rwmjones: no, archlinux
<rwmjones> well, it's a packaging bug anyway ... they need to encode the ocaml dependencies into the archlinux package dependencies, as we did in Fedora (and Debian are now doing). See:
Deformative has joined #ocaml
demitar has joined #ocaml
<bogen> ok, well, I can repackage
diginux has joined #ocaml
BigJ has joined #ocaml
maskd has joined #ocaml
tab_ has joined #ocaml
r0bby has joined #ocaml
bzzbzz has joined #ocaml
<bogen> ocamlobjinfo hmm... ok... need to find the download site for that so I can package it
Yoric has joined #ocaml
patronus has joined #ocaml
<bogen> ok, if it is a versioning thing with Pcre
<bogen> than I broke that
<bogen> :)
dmentre has joined #ocaml
<bogen> it was out of date, people were complaining, so I adopted the package...
<bogen> (And updated it)
Jedai has joined #ocaml
svenl has joined #ocaml
Narrenschiff has joined #ocaml
<EliasAmaral> gildor, never figured how to work with ocamlfind, didn't thought it was so easy
<EliasAmaral> it would made my homegrown makefiles more maintainable
<rwmjones> bogen, ocamlobjinfo isn't an official part of the ocaml distribution, but it's a program that debian & fedora both build and distribute (in the original ocaml sources it's called "objinfo")
<rwmjones> EliasAmaral, ocamlfind rocks
<rwmjones> bogen, you should map ocaml md5 hashes to dependencies, to make it impossible for people to install incompatible versions ... for example in fedora:
<EliasAmaral> yeah
<rwmjones> $ rpm -q --provides ocaml-pcre | grep Pcre
<rwmjones> ocaml(Pcre) = 6d801a6ce79c77dcc4e1d5b1f5fff620
<rwmjones> ok bad example
<rwmjones> $ rpm -q --provides ocaml-runtime | grep Array
<rwmjones> ocaml(Array) = 9c9fa5f11e2d6992c427dde4d1168489
<rwmjones> $ rpm -q --whatrequires 'ocaml(Array)'
<rwmjones> ocaml-fileutils-0.3.0-11.fc12.x86_64
<rwmjones> ocaml-3.11.1-0.rc1.2.fc12.1.x86_64
<rwmjones> ocaml-ocamldoc-3.11.1-0.rc1.2.fc12.1.x86_64
<rwmjones> ocaml-camlp4-3.11.1-0.rc1.2.fc12.1.x86_64
<rwmjones> ocaml-pcre-6.0.0-2.fc12.x86_64
<rwmjones> [etc]
<rwmjones> $ rpm -q --requires ocaml-pcre | grep Array
<rwmjones> ocaml(Array) = 9c9fa5f11e2d6992c427dde4d1168489
<rwmjones> because the MD5 hashes have to match up, that stops incompatible packages from being installed
<bogen> rwmjones: you mean to have rpm prevent it? Arches package deps are just based on versions
<bogen> rpm is not used
<rwmjones> bogen, those are rpm "versions" too, but rpm lets us use anything for a version number, so we use MD5 hashes
<bogen> ok, yeah, that is partially possible
<bogen> but the version is used for the download url in the source package
<bogen> it is needed when building the source package
<olegfink> that'd be pretty much against archlinux policies
<bogen> olegfink: to you hashes? yeah, I would think that
<olegfink> I think most people just maintain a set of simple scripts to update the packages (texlive, perl, haskell etc.)
<rwmjones> you might also want to read _zack's paper: http://upsilon.cc/~zack/stuff/ocaml-debian-deps.pdf
<bogen> rwmjones: I'm got some reading to do.... but I need to take off
<bogen> rwmjones: thanks a lot for your help
<_zack> rwmjones, bogen: BTW, we've an updated version now http://upsilon.cc/~zack/research/publications/jfla10-dh-ocaml.pdf
<_zack> rwmjones: and thanks, I'll update that link which is out of date now :)
ygrek has quit [Remote closed the connection]
<olegfink> rwmjones: may I ask a completely non-ocaml question while it's quiet in here? I have a solution for bounds checking using mprotect(2) looking for a problem. I have large arrays, and for iterating them I use PROT_NONE pages on sides instead of bound checking on each iteration.
<olegfink> Of course this doesn't get me any speedup because memory is slow beyond all such "optimization"
<olegfink> however, I wonder is there an application in which such behaviour would be meaningful?
dark_light has joined #ocaml
bacam_ is now known as bacam
EliasAmaral has quit [Nick collision from services.]
dark_light is now known as EliasAmaral
<rwmjones> olegfink, sounds like electricfence
<olegfink> indeed, thanks, but they use it for debugging, and I wondered if I can save some cpu time with it... probably no.
ikaros has joined #ocaml
munga has joined #ocaml
<fx_> olegfink, why there is no speed up?
<fx_> btw, it is not completely safe cause it will prevent only small bounds overrun
<fx_> not doing 2 comparisons at each access should be noticeable I believe
<olegfink> measurements tell otherwise.
<olegfink> memory is too slow
<olegfink> actually for a 400M array and gcc -O2 mprotect version is ~100ms slower (probably because of longjmp)
<olegfink> without -O2 it's ~100ms faster
<olegfink> ok, efence does exactly what I do, but it's used for debugging. only if there was a machine with lightning-fast memory....
<olegfink> fx_: I actually only care about off-by-one errors, and even more specifically I want to write for(i=0;i<n;i++) as for(i=0;;i++)
<olegfink> (because my task is not to "enchance" or "harden" generic C code but rather speed up my own)
<fx_> ah, I thought about bounds-checking each access, not the iteration at a whole
<fx_> considered using simd instructions?
<olegfink> well, each iteration is one-two accesses
<olegfink> with simd I'd still need to check the bounds, 4 times less or so
Pimm has joined #ocaml
<mrvn> Is gcc smart enough to see that a loop over an array only needs to check the first and last access for bounds?
<olegfink> how would it know which access is the last? ;-)
middayc has joined #ocaml
<mrvn> olegfink: for (i=0;i<n;i++) { a[i]; }
<mrvn> Shouldn't be much different from loop unrolling.
<olegfink> but anyway it compiles this into something like "if i<n, access a[i], increment i, jump to beginning"?
<olegfink> it should check if i is in bounds anyway on each iteration
<mrvn> olegfink: or access a[i], access a[i+1],access a[i+2],access a[i+3], i += 4;
<mrvn> Deciding when it can unroll a loop should be the same as deciding when it can skip bound check
<olegfink> well, of course gcc doesn't bound check four times on each iteration in vectorized code
Narrenschiff has quit []
ikaros has quit ["Leave the magic to Houdini"]
munga has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
tmaeda is now known as tmaedaZ
_zack has quit ["Leaving."]
_andre has joined #ocaml
ygrek has quit [Remote closed the connection]
tmaedaZ is now known as tmaeda
bogen has left #ocaml []
Dodek has quit [Read error: 60 (Operation timed out)]
Dodek has joined #ocaml
thrasibule has joined #ocaml
Narrenschiff has joined #ocaml
_zack has joined #ocaml
shr3kst3r has quit [Read error: 60 (Operation timed out)]
<_zack> is libasmrun.a "generally compatible" with libcamlrun.a?
<_zack> I've a C wrapper around an ocaml lib, and use the "cp + ar" trick on libcamlrun.a to link in the caml runtime
<_zack> I wonder whether I can simply replace it with libasrum.a to use native code from C ....
rwmjones has quit [farmer.freenode.net irc.freenode.net]
shr3kst3r has joined #ocaml
rwmjones has joined #ocaml
ygrek has joined #ocaml
_unK has joined #ocaml
<_zack> (no they are not)
ikaros has joined #ocaml
aklt has joined #ocaml
<aklt> Hi
<aklt> How do I go about adding a patch to a godi package,... would I have to re-create the package or can I add the patch somewhere else?
<aklt> I am running into the known problem of an error in Pcre when compiling ocsigen...
<aklt> Ah great, that is the solution!
smimou has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
ygrek has quit [Remote closed the connection]
_andre has quit ["leaving"]
middayc_ has joined #ocaml
middayc has quit [Read error: 60 (Operation timed out)]
middayc_ is now known as middayc
tmaeda is now known as tmaedaZ
aklt has quit ["Have a good christmas!"]
rlarson`` has quit ["Coyote finally caught me"]
Narrenschiff has quit []
fx_ has quit [Read error: 110 (Connection timed out)]
dmentre has quit ["Leaving."]
middayc has quit ["ChatZilla 0.9.86 [Firefox 3.5.6/20091201220228]"]
ttamttam has quit ["Leaving."]
joewilliams has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
jonafan_ is now known as jonafan
jlouis_ is now known as jlouis
ikaros has quit ["Leave the magic to Houdini"]
pimm_ has joined #ocaml
Pimm has quit [Read error: 104 (Connection reset by peer)]
pimm_ has quit [Client Quit]
Pimm has joined #ocaml
Yoric has quit []
Pimm has quit [Read error: 110 (Connection timed out)]
seanmcl has joined #ocaml
ygrek has joined #ocaml
ttamttam has joined #ocaml
ofaurax has joined #ocaml
pad has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
seanmcl has quit []
seanmcl has joined #ocaml
Submarine has joined #ocaml
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb has joined #ocaml
rhar has joined #ocaml
rwmjones has quit [Read error: 104 (Connection reset by peer)]
rwmjones has joined #ocaml
chupish has joined #ocaml
aklt has joined #ocaml
ski_ has joined #ocaml
chupish has quit ["Page closed"]
rhar has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
ttamttam has quit ["Leaving."]
ulfdoz has joined #ocaml
rhar has joined #ocaml
ygrek has quit [Remote closed the connection]
rhar has quit ["Leaving"]
slash_ has joined #ocaml
Pimm has joined #ocaml
ikaros_ has joined #ocaml
thrasibule has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
_zack has quit ["Leaving."]
* palomer wishes ocaml had existentials
<palomer> universals were introduced so that methods could have a polymorphic type, right?
thelema_ has joined #ocaml
<mrvn> palomer: you can do them with records
valross has joined #ocaml
<palomer> existentials?
<mrvn> yes
<palomer> do you mean the old {x : forall a. (t -> b) -> b} trick for exists a. t?
<mrvn> or objects
<mrvn> palomer: yes
<palomer> cps for types!
<palomer> mrvn, it's not the same though, forces you to write your code in cps
<mrvn> not really. Just need an accessor function
thelema has quit [Read error: 104 (Connection reset by peer)]
<palomer> instead of writing E[x] (the expression with x plucked in), you need to write a function (fun y -> E[y]), make sure it's polymorphic then apply the record field to it, no?
<mrvn> iirc you actualy need a second record with another `a. type.
<palomer> right
<palomer> still forces you to factor every expression E[x] into (fun y -> E[y])
<mrvn> yes. But that isn't writing your code in cps
<palomer> isn't it a similar idea?
joewilliams has quit ["Leaving..."]
<mrvn> writing your code in cps is a lot more change
<palomer> I always thought both processes were similar
<palomer> for a variable x, x becomes fun k -> k x
joewilliams has joined #ocaml
<palomer> (in cps)
<palomer> our process turns it into F (fun y -> y)
<palomer> I guess you're right
<mrvn> No, in cps every function gets another argument, the continuation, and no function ever returns but always calls the continuation
<mrvn> cps doesn't change your variables.
<palomer> got a reference?
<palomer> the wikipedia article is no fun
<palomer> (by not fun I mean not instructive)
<mrvn> would have pointed you there too
<palomer> it doesn't give the explicit transformation
<mfp> palomer: btw., you can encode existential types directly using first-class modules in 3.12
<palomer> what operations will we be able to perform on first class modules?
<palomer> is it going to be yet another product type?
<palomer> how will the modules be typed?
<mfp> palomer: you pack modules as first-class values, then unpack and use them with let module = ...
<mfp> their types correspond to erm module types
<palomer> erm?
<palomer> so let a = pack E (* a has type module *) ?
<mfp> erm as in uh
<mfp> let a = (module E)
<mfp> 1 sec
tmaedaZ is now known as tmaeda
<mfp> no actually it was let a = (module E : S)
<mfp> S being a module type
<mfp> the type is (module S)
<mfp> # module type S = sig type t val f : t -> int end;;
<mfp> module type S = sig type t val f : t -> int end
<mfp> # let x = (module struct type t = int let f x = x end : S);;
<mfp> val x : (module S) = <module>
<palomer> is there an equivalence among signatures?
tmaeda is now known as tmaedaZ
<palomer> what if you do module type T = S
<palomer> can you then do (a :> module T) ?
* mfp tries
middayc has joined #ocaml
<mfp> nope, it uses nominal typing
<mfp> # (y :> (module S));;
<mfp> Error: Type (module S2) is not a subtype of (module S)
<mfp> with module type S2 = S;; let y = (module struct type t = float let f = truncate end : S2);;
<mfp> oh
<mfp> you can unpack and repack, that works
<mfp> # (let module K = (val y : S2) in (module K : S));;
<mfp> - : (module S) = <module>
<palomer> what's the main purpose of this?
<mfp> modules stop being only a "compile-time thing", giving more flexibility
<palomer> no killer example?
<mfp> e.g. in some code of mine I want to pick a module at runtime depending on the configuration
<mfp> w/o first-class modules, I have to add an extra level of indirection inside the module to be able to choose an implementation dynamically
<mfp> w/ first-class modules, I could have module Foo = match read_config bar with ... -> (val (module Bar : S) : S)
<mfp> uh actually module Foo = (val (match ... -> (module Bar : S) | ... -> ...) : S)
<palomer> if they were encoded as objects in the first place, this wouldn't be an issue
<mfp> yes, but objects don't carry types :-|
<mfp> in fact, I used objects _inside_ the module to pick an implementation at runtime
<palomer> I guess carrying types is a nice advantage
slash_ has quit [Client Quit]
seanmcl has quit []
joewilliams has quit [Remote closed the connection]
* palomer is using super voodoo
<palomer> I'm encoding my types as values using camlp4 and then using (=) on these values for coercion
<palomer> my god this is ugly!
<palomer> I even have type void = {void_value:'a . 'a}
Yoric has joined #ocaml
Yoric has quit [Client Quit]
ulfdoz has quit [Read error: 110 (Connection timed out)]
<thieusoai> if I have a type atype = (int*string) . Then I have a varible of type atype as let a_var = (5,"hi") . How do I change number 5 in a_var to say 10 ?
<thieusoai> I can do something like this let a_var = ref (5,"hi") in a_var := (10,"hi") ; !a_var;;
<thieusoai> but that requires me to have to retype "hi" in (10,"hi") , I just want to change the first field
<aklt> thieusoai: How about let a = (ref 10, "hi)?
ofaurax has quit ["Leaving"]
<olegfink> aklt: you may want to use records instead
<olegfink> e.g.
<olegfink> type atype = { n : int; s : string; } ;; let a_var = {n = 10; s = "hi"} ;; {a_var with n = 5} (* -> {n = 5; s = "hi"} *)
<olegfink> (and of course if you really want refs, use mutable fields)
Pimm has quit [Read error: 110 (Connection timed out)]
joewilliams has joined #ocaml
Yoric has joined #ocaml
ikaros_ has quit ["Leave the magic to Houdini"]