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 - Answer OCaml Meeting 2010 poll https://forge.ocamlcore.org/survey/survey.php?group_id=77&survey_id=1
delamarche has joined #ocaml
Proteus has joined #ocaml
delamarche has quit []
tmaeda is now known as tmaedaZ
valross has joined #ocaml
delamarche has joined #ocaml
delamarche has quit [Remote closed the connection]
_unK has quit [Remote closed the connection]
munga_ has quit [Read error: 113 (No route to host)]
ikaros has quit ["Leave the magic to Houdini"]
ulfdoz_ has joined #ocaml
nnyby has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
seanmcl has quit []
Associat0r has quit []
valross has quit [Read error: 104 (Connection reset by peer)]
valross has joined #ocaml
tiz has quit [Read error: 145 (Connection timed out)]
lutter has joined #ocaml
lutter has quit [Client Quit]
caligula__ has joined #ocaml
caligula_ has quit [Read error: 110 (Connection timed out)]
seanmcl has joined #ocaml
seanmcl has quit []
seanmcl has joined #ocaml
seanmcl has quit [Client Quit]
seanmcl has joined #ocaml
thrasibule has joined #ocaml
ski_ has quit ["Lost terminal"]
tmaedaZ is now known as tmaeda
ski_ has joined #ocaml
seanmcl has quit []
Proteus has quit ["Leaving"]
Alpounet has quit [Read error: 110 (Connection timed out)]
ski_ has quit ["Lost terminal"]
ulfdoz has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
Associat0r has joined #ocaml
ttamttam has quit ["Leaving."]
thrasibule has quit [Read error: 110 (Connection timed out)]
albacker has joined #ocaml
Snark has joined #ocaml
mee has left #ocaml []
ttamttam has joined #ocaml
ski_ has joined #ocaml
munga_ has joined #ocaml
ikaros has joined #ocaml
Yoric has joined #ocaml
Pimm has joined #ocaml
Pimm has quit ["Ik ga weg"]
ikaros has quit ["Leave the magic to Houdini"]
_andre has joined #ocaml
_zack has joined #ocaml
valross has quit ["Ex-Chat"]
tmaeda is now known as tmaedaZ
Associat0r has quit []
Snark has quit ["Ex-Chat"]
subito has joined #ocaml
_unK has joined #ocaml
munga_ has quit [Read error: 113 (No route to host)]
ski_ has quit ["Lost terminal"]
schme is now known as schmx
ua has joined #ocaml
fraggle_ has joined #ocaml
ski_ has joined #ocaml
dmentre has joined #ocaml
Associat0r has joined #ocaml
lutter has joined #ocaml
csmrfx has left #ocaml []
_unK has quit [Remote closed the connection]
seanmcl has joined #ocaml
Narrenschiff has joined #ocaml
willb has quit [Read error: 60 (Operation timed out)]
fraggle_laptop has joined #ocaml
seanmcl has quit []
<Leonidas> how can I create a type with multiple parameters? type 'a 'b name = ... is invalid syntax.
<flux> type ('a, 'b) a
<mattiase> I do sympathise with Leonidas here though - it does seem natural to curry type parameters.
<mrvn> # type ('a, 'b) name = ('a * 'b);;
<mrvn> type ('a, 'b) name = 'a * 'b
<mattiase> ... especially since the ('a, 'b) construct doesn't even exist in free form - there is no "type tuple" in the language
<Yoric> Well, the revised syntax did allow currification of type arguments.
<mrvn> mattiase: sure there is. the () are just mostly optional.
<Leonidas> flux: thank you. Didn't think of that.
<Leonidas> and didn't find a good name to google for
willb has joined #ocaml
<Leonidas> thelema_: why?
<thelema_> to help the next person with the same question - SO questions find their way into google quickly
<mrvn> then do answere it yourself.
Alpounet has joined #ocaml
<Leonidas> ah, as kind-of-wiki/faq
<mrvn> thelema_: All you need to answere your question is look at Hashtbl.
<thelema_> heh, pascal cuoq answered it 33 seconds before me.
<mrvn> Most people answering on that site have no clue and can't even read: http://stackoverflow.com/questions/1826414/whats-the-value-of-i-i
ikaros has joined #ocaml
<thelema_> and the bad answers get downvoted, no?
<Leonidas> mrvn: well, the discussion is not bad, actually.
* Leonidas tries to match a,b, but somehow I don't know what the actual syntax is
<thelema_> match foo with (a,b) -> f a b
<Leonidas> http://paste.pocoo.org/show/154129/ <- what should it actually be?
<Leonidas> thelema_: yep, but I got a function with two arguments and want to match them both
<mrvn> Leonidas: the right answere is given, multiple times and still people add wrong ones.
<thelema_> mrvn: and the right thing to do is comment and downvote wrong answers.
<Leonidas> mrvn: what do you expect for a site run by atwood and spolsky? This is not LtU :)
<thelema_> what's the problem with people trying to add more to an answer?
<thelema_> Leonidas: what's wrong with your paste? it looks syntactically correct to me.
<mrvn> thelema_: That they should read the given answeres before adding yet another repeat of the wrong one.
<thelema_> thelema_: they should. And the only punishment they can get is loss of rep.
thelema_ is now known as thelema
<thelema> Yes, it's not LtU. The content is mostly generated by mortals.
<Leonidas> thelema: File "ha6.ml", line 6, characters 16-17: Syntax Error
<mrvn> thelema: Their rep hasn't plumeted yet. So now the site still sucks in that regard. :)
<mrvn> Leonidas: s/:/=/?
<thelema> Leonidas: oh, the problem is record matching. {order=ao; root=ar;children=ac}
<Leonidas> oh, right.
<mrvn> Leonidas: and I would not write it like that. Use match a with {order = ao; root = ar; children = ac} when b = 3 -> or something.
<Leonidas> that worked.
<Leonidas> mrvn: b is not a number, b is of the same type as a.
<mrvn> No need to allocate a useless tuple.
<Leonidas> just in this example
<mrvn> Leonidas: ok, then nm.
<mrvn> thelema: I might have gone with while [ $# -gt 0 ]; do echo "$1"; shift; done
tmaedaZ is now known as tmaeda
<mrvn> thelema: usefull for the more general case where you need to use them in pairs or the like.
<mrvn> thelema: or to first consume all args starting with -
<thelema> mrvn: You're welcome to add that third answer, although the first answer was exactly what I was looking for, and the second explained me a ton on what was going on
* Leonidas likes the bash wiki, actually.
<Leonidas> answers 99% of all questions
<thelema> As long as it's googlable, I'm happy
ikaros has quit ["Leave the magic to Houdini"]
<Leonidas> ist there somewhere a list of standard ocaml exeptions?
<mrvn> thelema: I should ask that site how to create a ('a, 'a -> unit) list so that the 'a for individual elements of the list can be anything.
<thelema> mrvn: you may get an answer
<mrvn> I got one from the ML but it is pretty tricky to do.
<flux> leonidas, maybe the manual has a list? if not, you can get some idea with: grep '^exception' `ocamlc -where`/*.mli
<mrvn> file:///usr/share/doc/ocaml/docs/ocaml.html/libref/index_exceptions.html
<flux> 404 ;(
<mrvn> well, install ocaml-doc or use the online manual.
<Leonidas> Illegal_argument is not listed...
<Leonidas> Invalid_argument I mean
<julm> it's a builtin exception IIRC
<julm> like Out_of_memory, Match_failure, Stack_overflow, Not_found, Undefined_recursive_module, Failure, Assert_failure
<mrvn> that sucks. they should be listed anyway
Yoric_ has joined #ocaml
<ski_> (mrvn : hm, does OCaml have support for existentials ?)
<mrvn> ski_: in records
<mrvn> and objects
ekontsevoy has quit [Remote closed the connection]
<mrvn> ski_: In records you can have 'a. 'a -> unit
<ski_> i thought 'a. 'a -> unit would be a universal
<mrvn> whatever the name is it lets you make a [(1, print_int); ("foo", print_string)] kind of list
<ski_> at least "3.11 Polymorphic methods" mention
<mrvn> And then you can List.iter (fun (x, f) -> f x) that
<ski_> method fold : 'a. ('a -> int -> 'a) -> 'a -> 'a = ...
<ski_> mrvn : yes, that's existential quantification
<ski_> i'm not sure how it is denoted, but it's basically of type (some 'a. 'a * ('a -> unit)) list
<mrvn> What I actualy wanted was more like type 'a foo = { mutable x : 'a; on_read : 'a foo -> unit; on_write : 'a foo -> unit }
<mrvn> A record of unspecified type with a bunch of callbacks and then you have a list or queue or hashtbl or whatever of them.
<ski_> and then you wanted to hide the type 'a ?
<mrvn> exactly.
<Leonidas> Reference to undefined global `Ha6'
<Leonidas> When I Open Ha6 in my test_ha6.ml file.
<Leonidas> I guess I need some compilation option.
<ski_> can you write type foo = { ... 'a ... } ?
<Leonidas> or du I need to write an mli file?
<ski_> (istr HBC used that for baking an existential into a new datatype)
<mrvn> The simplest solution is something like let make x on_read on_write = let x = ref x in { on_read = on_read x; on_write = on_write x; } but then you create lots of closure.
<mrvn> The better (as in no closures) solution is too long for me to remember now.
<ski_> is it in the manual, somewhere ?
Yoric has quit [Read error: 110 (Connection timed out)]
Yoric_ is now known as Yoric
<mrvn> ski_: if you can derive it from the grammar :)
<Leonidas> any idea what I need to add to my OMakefile to make test_ha6.ml find ha6.ml?
<mrvn> ski_: For extra homework write an universal container type where you can iterate over elements matching a type.
<mrvn> ski_: i.e. in [(1, print_int); ("foo", print_string)] iterator over only the ints.
Associat0r has quit []
ua has quit [Read error: 113 (No route to host)]
<ski_> that sounds evil
<mrvn> perfectly typesafe
<ski_> what if i export a type `foo' abstractly, that is currently represented as `int' ?
<ski_> should the (aFoo, print_foo) pair be invoked ?
<mrvn> ski_: then you are exporting type `foo abstractly, that is currently represented as `int'
<mrvn> ski_: That depends on how you write your code
<mrvn> ski_: But with an abstract type you should not be able to tell that it is an int in the type system.
<ski_> exactly
<ski_> (and i would expect to not be able to tell at run-time, either (possibly modulo debugging tools))
Narrenschiff has quit [Read error: 60 (Operation timed out)]
<mrvn> ski_: each item in the container could have a "is_type : type_t -> bool" method. If is_type `Int gives true for your foo then it would be called.
<mrvn> ski_: That would be runtime checking though.
<ski_> `Int just being a polymorphic variant constructor ?
<mrvn> ski_: sure
<mrvn> just an example
<ski_> (so `type_t' doesn't magically contain all types, then ..)
<ski_> *nod*
<mrvn> ski_: if you get it to work magically you get extra points. :)
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
_unK has joined #ocaml
jimmyb2187 has left #ocaml []
ikaros has joined #ocaml
Yoric has quit [Remote closed the connection]
tmaeda is now known as tmaedaZ
Yoric has joined #ocaml
dmentre has quit ["Leaving."]
middayc has joined #ocaml
jimmyb2187 has joined #ocaml
ttamttam has quit ["Leaving."]
_zack has quit ["Leaving."]
det has quit [Remote closed the connection]
det has joined #ocaml
<Camarade_Tux> I used git stash, anyone know how I can see the corresponding changes now? (without applying the stash)?
<thelema> gitk --all
<thelema> I run this command *all* *the* *time*
Yoric has quit []
<Camarade_Tux> helps you see how dirty your branches are :P
<thelema> it shows me the repo. I don't think I could use git effectively without it.
<Camarade_Tux> ok, thanks, I think I'll apply the stash and commit selectively a few things from this which are fixes
<Camarade_Tux> I'll see if I can get poppler-glib bindings out of ocaml-gir ;-)
<Camarade_Tux> gotta, be back later :)
lutter1 has joined #ocaml
lutter has quit ["Leaving."]
<mfp> Camarade_Tux: git stash show -u
<thelema> mfp: I figured there was a better way. I just didn't know what it was.
smimram has quit ["bli"]
Submarine has joined #ocaml
ua has joined #ocaml
smimou has joined #ocaml
ttamttam has joined #ocaml
ulfdoz has joined #ocaml
Amorphous has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
Submarine has quit [Read error: 54 (Connection reset by peer)]
Submarine has joined #ocaml
middayc has quit ["ChatZilla 0.9.85 [Firefox 3.5.5/20091102152451]"]
Smerdyakov has joined #ocaml
Snark has joined #ocaml
<mfp> good afternoon gentlemen
_andre has quit ["*grabs*"]
<thelema> hi mfp
<mfp> here's the initial version of the OCaml dynamic loader I've hacked over the last 2 days > http://github.com/mfp/ld.ocaml
<thelema> I've been stuck in C++ land over the last few hours. I wanna escape!
_JusSx_ has joined #ocaml
<mrvn> thelema: condolences
<thelema> thank you.
<thelema> I'm trying to figure out ld.ocaml - how does it get invoked when a library needs to be loaded?
<mfp> you compile the program with shared, and then do ld_ocaml foo.cmxs
<mfp> ld_ocaml looks for all the .cmxs in the sys and loads those needed by foo.cmxs
<thelema> your compiled program is foo.cmxs?
<mfp> yes
<thelema> ok, that makes more sense.
<mfp> instead of doing e.g. ocamlfind ocamlopt -package aaa -o foo foo.ml -linkpkg you do ocamlfind ocamlopt -package aaa -o foo.cmxs foo.ml
<thelema> How is it done automatically in C - does the compiler put in the calls to ld?
<mfp> no -linkpkg in the latter, -package is only needed to let the compiler see the .cmis
<mfp> in C the program is loaded by ld.so
<mfp> it's exactly the same as ld.ocaml, hence the name
<mfp> "ld.so loads the shared libraries needed by a program, prepares the program to run, and then runs it. Unless explicitly specified via the -static option to ld during compilation, all Linux programs are incomplete and require further linking at run time."
<thelema> so bash automatically runs ld.so for you for C programs?
<mfp> I guess it's the kernel
<mfp> when you try to run an ELF file
<thelema> interesting. Gotta go.
<mfp> so could associate ld_ocaml to the .cmxs extension, or maybe use some magic
Smerdyakov has quit ["Leaving"]
slash_ has joined #ocaml
tensorpudding has quit [Read error: 104 (Connection reset by peer)]
tensorpudding has joined #ocaml
<mfp> yay Loading: hello.cmxs Will load these libraries: ./camomile.cmxs /usr/lib/ocaml/nums.cmxs ./aaa.cmxs Hello, world!
tensorpudding has quit [Read error: 104 (Connection reset by peer)]
Waleee has joined #ocaml
<mfp> wc -c hello.cmxs -> 13330 hello.cmxs libs inferred automatically & loaded as needed
tensorpudding has joined #ocaml
<flux> mfp, hmm.. so that's basically shared libraries for ocaml then?
<mfp> yes
<flux> mfp, pretty nifty!
<flux> would it work with .cmo-files?
<flux> (the approach you've taken)
<mfp> yes
<flux> that might be useful too, because one thing that can prevent using ocaml in embedded platforms is the size of binaries
<mfp> would use ocamlobjinfo (or the code the latter uses) to extract info about the imported .cmi and .cmo files
<flux> ..and you might not be able to compile natively for such
munga_ has joined #ocaml
<mfp> the dep resolution mechanism is generic, could easily be functorized over a module with ~ 3 functions to 1) look for libs 2) extract info from an object 3) load an object
Snark has quit ["Ex-Chat"]
Associat0r has joined #ocaml
_JusSx_ has quit ["leaving"]
<Camarade_Tux> mfp: good to know, thanks :)
sramsay has joined #ocaml
Waleee has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit [Read error: 60 (Operation timed out)]
ski_ has quit ["Lost terminal"]
ikaros_ has joined #ocaml
davidL has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
davidL has left #ocaml []
ttamttam has quit ["Leaving."]
tmaedaZ is now known as tmaeda
Submarine has quit ["Leaving"]
det has quit [Remote closed the connection]
Yoric has joined #ocaml
albacker has quit [")"]
lutter1 has quit ["Leaving."]
lutter has joined #ocaml
subito has quit [Read error: 113 (No route to host)]
ikaros_ has quit ["Leave the magic to Houdini"]
lutter has quit ["Leaving."]
sramsay has quit [Read error: 110 (Connection timed out)]