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
tmaeda is now known as tmaedaZ
ikaros has quit ["Leave the magic to Houdini"]
verte has joined #ocaml
onigiri has quit []
ulfdoz_ has joined #ocaml
NYNix has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
tmaedaZ is now known as tmaeda
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
caligula_ has quit [Read error: 104 (Connection reset by peer)]
caligula_ has joined #ocaml
bzzbzz has quit ["leaving"]
NYNix has quit [Read error: 113 (No route to host)]
thrasibule has quit [Read error: 110 (Connection timed out)]
jonrafkind has joined #ocaml
<jonrafkind> in a function definition whats the difference between (cb:(param:'a -> unit)) and (cb:('a -> unit))
<jonrafkind> basically with and without the `param' ?
<thelema_> named arguments?
<thelema_> # let foo ~x = 3;;
<thelema_> val foo : x:'a -> int = <fun>
<thelema_> # let bar f = f ~x:3 + 1;;
<thelema_> val bar : (x:int -> int) -> int = <fun>
<jonrafkind> so how do I call it
<jonrafkind> foo x:2 ?
<thelema_> ~param:5
<thelema_> maybe ~cb:(fun ~param -> ())
<jonrafkind> ah i had to name my function with ~param
<jonrafkind> i have to use let for the function because its polymorphic, right?
<jonrafkind> oh hrm, apparently not. maybe ocaml can figure it out in this one case
animist has quit ["leaving"]
animist has joined #ocaml
<orbitz> you use let for everything
bohanlon has joined #ocaml
bohanlon_ has joined #ocaml
bohanlon_ has quit [Remote closed the connection]
mjonsson has quit [Read error: 110 (Connection timed out)]
ztfw has quit [Remote closed the connection]
valross has quit ["Ex-Chat"]
mjonsson has joined #ocaml
f[x] has joined #ocaml
ttamttam has joined #ocaml
jonrafkind has quit [Read error: 110 (Connection timed out)]
ski_ has joined #ocaml
ttamttam has quit ["Leaving."]
kaustuv_ has quit [Read error: 60 (Operation timed out)]
kaustuv_ has joined #ocaml
mgee has joined #ocaml
<mgee> hi, i checked out the latest ocaml source-code from cvs. then i compiled and installed it. now i want to compile unison, but i always get the error "ld: library not found for -lstr". but inside my ocaml/lib folder is a str.a. Does anybody have an idea about this? :)
<flux> mgee, what does ocamlc -where say?
<mgee> flux: /opt/ocaml/lib/ocaml
<flux> mgee, and does str.a exist in that directory?
<mgee> yeap
<flux> hm
<flux> how about libstr.a?
<mgee> the other libraries it want to link against are also there and found by the linker. only the str.a is not recognized... really strange
<mgee> libstr.a is not there
<mgee> but the program also links against -lbigarray and there is only a bigarray.a and it works.
<flux> hm
<flux> I think -l would not work if the filename isn't libXXX.(so|a)
<flux> (I have libbigarray.a also)
<mgee> flux: mhh, one sec
<flux> but perhaps it's a different setup
<mgee> flux: ok you are right. the items it want to link against exists in lib*.a. (i also have libbigarray.a but i overlooked it. sorry)
f[x] has quit [Read error: 110 (Connection timed out)]
<mgee> flux: I think -lstr is not -lcamlstr. it was renamed (or something)
<flux> mgee, any particular reason you went for the CVS version btw?-)
<mgee> i am using os x snow leopard. ocaml 3.11.1 didn't work for me :-/
<flux> oh :/
<flux> but the fixes for it are in the CVS then I suppose?
<mgee> yeap they are. ocaml from cvs works. is there a trunk and a 3.11 bugfix branch in cvs?
<flux> no idea
jimt has joined #ocaml
jimt has quit [Remote closed the connection]
<mgee> i think i can now make everything work :) thanks for your help flux
<flux> mgee, happy unisoning then :)
<mgee> ;)
jimt has joined #ocaml
mgee has quit ["Everybody be cool. YOU - be cool."]
f[x] has joined #ocaml
_zack has joined #ocaml
f[x] has quit [Read error: 145 (Connection timed out)]
Yoric[DT] has joined #ocaml
ikaros has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Read error: 113 (No route to host)]
petchema_ has joined #ocaml
petchema has quit [Read error: 110 (Connection timed out)]
tmaeda is now known as tmaedaZ
f[x] has joined #ocaml
Jedai has joined #ocaml
kattla has quit [Read error: 60 (Operation timed out)]
_andre has joined #ocaml
kattla has joined #ocaml
f[x] has quit [Read error: 145 (Connection timed out)]
thrasibule has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
verte has quit ["~~~ Crash in JIT!"]
willb has joined #ocaml
tmaedaZ is now known as tmaeda
<rwmjones> gildor, hey, ping ... I've got a problem with virt-top related to ocaml-gettext
<rwmjones> basically, any use of the f_ macro causes a segfault if LANG=ja_JP.UTF-8 is set (without LANG, it's all fine)
<rwmjones> so I'm wondering if there is any more recent version of ocaml-gettext (> 0.3.2) that I could try, before I dive in to debug this
komar_ has joined #ocaml
komar_ has quit ["leaving"]
mjonsson has quit [Read error: 110 (Connection timed out)]
<gildor> rwmjones: pong, I am working on gettext, to adapt to latest ocaml-fileutils + various other thing
<rwmjones> gildor, I looked into this a bit further and it seems like the glibc dcgettext() function is returning ""
<gildor> rwmjones: but this problem is probably related to a problem is % -> % translation
<rwmjones> which not surprisingly causes heartache because we cast that directly into a format_string, which OCaml was expecting to contain a %s
<rwmjones> but I don't understand what dcgettext is up to
<rwmjones> maybe the mo file is wrong
<gildor> possible
<gildor> you gettext to convert it
<gildor> use gettext to convert it
<gildor> (not ocaml-gettext utils)
<rwmjones> ok so the mo file is corrupt, makes sense
<gildor> rwmjones: you generate the .mo file using gettext and it works ?
<rwmjones> gildor, just a sec ... (I'm using msgfmt)
<rwmjones> gildor, yes using msgfmt seems to work
<gildor> ok, so we have a bug there ;-)
<gildor> can you submit .po/corrupted .mo and sane .mo ?
<gildor> in a bug
ttamttam has joined #ocaml
<rwmjones> gildor, this is the fix I added:
<rwmjones> gildor, to see the corrupt *.mo file is very easy, just use msgunfmt foo.mo and it will show empty translations, like this:
<rwmjones> msgid "warning: unexpected message contents of Found signal"
<rwmjones> msgstr ""
<rwmjones> whereas if the mo file is generated correctly, empty translations are removed
<gildor> humm, you mean that ocaml-gettext don't remove empty translation ?
<rwmjones> gildor, I think that's what was happening, yes
<rwmjones> is there any advantage to having a special tool? why don't we always use msgfmt?
<gildor> you can perfectly use msgfmt
<gildor> the tool is a proof of concept, to check that everything was working fine
<rwmjones> gildor, here's an example of a file that was broken: http://annexia.org/tmp/virt-top.mo
<gildor> and to help certain people who don't want to use gettext, to still use ocaml-gettext
<gildor> (read people running windows)
<rwmjones> so if you do msgunfmt on the file ^^^ then you'll see empty translations, but not in the equivalent file I just generated using msgfmt
<gildor> make sense
<rwmjones> gildor, on the wider issue here, isn't ocaml-gettext supposed to be checking the format strings it gets back to make sure they contain the correct number of %xxx patterns?
<gildor> but I suppose the initial .po translation is also empty ?
<gildor> ocaml-gettext using camomile will check it
<rwmjones> gildor, yes some of them are empty - msgfmt removes them from the mo file
<gildor> ocaml-gettext with the stub to libgettext, doesn't do the check
<gildor> as I see the problem, i think the fix is quite simple
<rwmjones> ouch really ... I thought the native version was doing the checking :-(
<gildor> nope, I was relying on libgettext to do it ;-)
<gildor> (i.e. why libgettext don't do it ?)
<rwmjones> heh, well libgettext ain't doing it ... in any case, C format strings aren't quite compatible with OCaml ones, eg. %S
<rwmjones> %n
<gildor> true
<gildor> not very complicated to add
<rwmjones> +1
<gildor> submit two separated bugs, I will correct both for next version
chupish has joined #ocaml
tmaeda is now known as tmaedaZ
tmaedaZ is now known as tmaeda
albacker has joined #ocaml
eni_ has joined #ocaml
eni_ has quit [Client Quit]
f[x] has joined #ocaml
tmaeda is now known as tmaedaZ
ttamttam has quit ["Leaving."]
Alpounet has joined #ocaml
ski_ has quit ["Lost terminal"]
jonrafkind has joined #ocaml
smimou has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
jonrafkind has left #ocaml []
julm_ has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
<albacker> how come we can use pattern matching without needing match..with ?
<albacker> like for example. let rec size x = match x with
<albacker> [] → 0
<albacker> | _::tail x → 1 + (size tail x) ; ;
<thelema_> how come?
<thelema_> or how can?
<thelema_> let rec size = function [] -> 0 | _ :: t -> 1 + size t
<albacker> i thought the only way to use a -> do_something was using matching patterns.
<thelema_> "function" == "fun x -> match x with"
_zack has quit ["Leaving."]
<albacker> wat if we declare let rec size list = .. can we use the pattern matching without adding 'match with'
<albacker> what*
<kaustuv_> what have you got against match anyhow?
<albacker> nothing i'm just trying to understand how everything works :)
<orbitz> albacker: let rec size = function ...
<orbitz> oh, thelema_ already said that
thelema_ is now known as thelema
<thelema> albacker: [let foo x = ...] is the same as [let foo = fun x -> ...], ok?
<albacker> yes
<thelema> [let foo = function ...] is the same as [let foo = fun x -> match x with ...] (except there's no x to refer to)
lutter has joined #ocaml
<kaustuv_> let boo [] = 0
<kaustuv_> let hiss (_ :: l) = l
<kaustuv_> let rec size l = try boo l with Match_failure _ -> 1 + size (hiss l) ;;
<thelema> kaustuv_: that's inventive.
<kaustuv_> (if you write code like this, I will personally murdalize you)
<albacker> thelema, those are the same here http://pastebin.com/m6dfcc9f5 ?
<albacker> well the case [] -> [] isn't really possible i think..
<thelema> not the same.
<thelema> almost the same, except for the [] case
<thelema> you'll get a match failure if you pass [] into el_dup
<thelema> and the case [] is required - how else will the recursion end?
<albacker> i could make it a::[]
<thelema> "a::[]" == "[a]"
<albacker> [a] then :)
kaustuv_` has joined #ocaml
<thelema> but then you wouldn't be able to do el_dup []
<albacker> you were talking about el_dup not the first one.
<thelema> yes. The first one seems correct
<albacker> this would work
<albacker> let el_dup =
<albacker> function
<albacker> []-> []
<albacker> [a] -> [a]
<albacker> a::b::rest -> if (a=b) then el_dup b::rest else a::(el_dup b::rest)
<albacker> ;;
<thelema> yes, looks good.
<albacker> with | before
<thelema> of course
<kaustuv_`> function application binds stronger than ::
<albacker> ?
<kaustuv_`> el_dup b::rest is parsed as (el_dup b) :: rest
<Alpounet> function application has priority over ::
kaustuv_` is now known as kaustuv
<albacker> oh
<albacker> i'd have to (el_dup (b::rest)) then
<kaustuv> the outer parens are unnecessary. Same with (a=b)
<thelema> yes, there's some priority fixes and optimizations to do
<thelema> parens are kinda wierd in ocaml, not being needed for function application.
<albacker> ok, it looks nice. doing this with match with would have been longer i think (as a code)
<kaustuv> parens are purely for disambiguation, which some see as a plus point
kaustuv_ has quit [Read error: 110 (Connection timed out)]
<albacker> in fact this doesn't work.
<albacker> let rec el my_list =
<albacker> match my_list with
<albacker> []->[]
<albacker> |[a]->[a]
<albacker> |a::b::rest -> if (a=b) then el (b::rest) else a::el (b::rest)
<albacker> in [1;2;2;2;3];;
Smerdyakov has joined #ocaml
<c0m> let rec gencut(n, xs) = if n = 0 then ([], xs) else let ns, zs = gencut(n - 1, List.tl xs) in (List.hd xs::ns, zs);;
<c0m> can someone help me read that
<c0m> after the else statement
<orbitz> albacker: you never call el
<c0m> and what the in keyword does?
<orbitz> c0m: it starts the block where your let bindigns wil lbe applied
<orbitz> it' slike {
<orbitz> in Java
<c0m> orbitz: that's what in does?
<kaustuv> It's very much NOT like { in Java. In Java you put the variables after {, unlike in.
<Smerdyakov> c0m, what source are you using to learn OCaml?
<orbitz> c0m: spanning that ove rmultiple liens and properly indentingit would probably go a long way in helping you understand tha tblock
<c0m> Smerdyakov: it is F#
<Smerdyakov> c0m, what source are you using to learn F#?
<albacker> orbitz, a::b::rest -> there are calls of el for if and else.. :/
<c0m> some class notes from this teacher
<c0m> which aren't very descriptive :\
<orbitz> albacker: you never call it after 'in' though
<albacker> orbitz, oh
<Smerdyakov> c0m, get a book. There's a good one with the main language designer as co-author.
<albacker> stupid
<c0m> i understand how to program
<Smerdyakov> c0m, but you clearly don't understand the syntax of F#, which is understandable. A book will help that.
<c0m> ok
* c0m has been looking at msdn
<kaustuv> let rec gencut(n, xs) = (if (n = 0) then ([], xs) else (let (ns, zs) =
<kaustuv> gencut(n - 1, List.tl xs) in (List.hd xs::ns, zs))) ;; (* all grouping made explicit with parens *)
<orbitz> even worse to read
<orbitz> juse throw it up on codepad with proper idnentation
<c0m> i understand the else block
<kaustuv> It's just for clarification for c0m, not an example of good style
<c0m> meaning which part is under else
<c0m> but the in syntax
<c0m> i understand the cons operator, binding, etc
<Smerdyakov> c0m, never try to learn anything from class notes. A good written document is indispensable.
<orbitz> kaustuv: yeah, i just thik that irc is a horribel medium for deisplayign code
<c0m> Smerdyakov: i agree
<c0m> but teacher was like don't use anything not used in the notes
onigiri has joined #ocaml
<Smerdyakov> c0m, if that's his literal wording, then I'd say it's OK to use a book to learn from; you just need to be careful about using language constructs not found in the notes
<kaustuv> c0m: I think you should blatantly IGNORE your instructor's ridiculous instruction not to read outside his notes
<Smerdyakov> kaustuv, if the paraphrase is accurate, it's not clear if it means that.
<c0m> right now, as i type this .. he is talking about how no F# programmers should ever use List.hd
<c0m> and use pattern matching
<c0m> in all cases
<Smerdyakov> c0m, good advice.
<infoe> c0m: which school are you at?
<c0m> florida international university
<infoe> and they provide computer science classes with a focus on F#?
Snark has joined #ocaml
eni_ has joined #ocaml
<c0m> no
<c0m> this is a princples of programming languages
<c0m> a senior level class
<c0m> where we learn about context free grammars
<c0m> now we're going through f#, its syntax, and recursion
albacker has quit [Nick collision from services.]
eni_ is now known as albacker
ttamttam has joined #ocaml
animist has quit [Read error: 111 (Connection refused)]
chupish has left #ocaml []
Smerdyakov has quit ["Leaving"]
<albacker> could i duplicate all the elements of the list using one of List functions ? I've already done it using a recursive way. (i'm just exercising :) )
<Camarade_Tux> albacker: why do you want to duplicate? and you want it to immediately take twice the memory?
<albacker> Camarade_Tux, just some exercises i found online.. trying to practice and solve them using different methods.
<Camarade_Tux> I don't think there is such a function because there is no need for it (although, List.map (fun x -> x) lst), should fdo it
<Camarade_Tux> s/fdo/do/
<albacker> i wasn't asking if there is one func. that does it, but more like if i could acheive it by using one of list funcs. (map/fold_left..)
<Camarade_Tux> well, as I mentionned, map/rev_map can do it
<flux> plain fould ought to be able to do it
<flux> camarade_tux, I think he means: [1; 2; 3] -> [1; 1; 2; 2; 3; 3]
<flux> or map and concat
<albacker> yes
<Camarade_Tux> flux: argh, yes, makes more sense /P
<albacker> flux, i was thinking to use map and concat
<Camarade_Tux> ^^
* Camarade_Tux hides
<kaustuv> List.fold_right (fun x l -> x :: x :: l) [1 ; 2 ; 3] [] ;;
<kaustuv> note: not tail-rec unless you use extlib
ttamttam has quit ["Leaving."]
_andre has quit ["leaving"]
bohanlon has quit [Remote closed the connection]
willb has quit [Remote closed the connection]
willb has joined #ocaml
Snark has quit [Read error: 113 (No route to host)]
_zack has joined #ocaml
_zack has quit ["Leaving."]
albacker has quit ["Leaving"]
f[x] has quit [Read error: 145 (Connection timed out)]
SlothSpot has joined #ocaml
phira has joined #ocaml
<phira> http://spreadsheets.google.com/viewform?formkey=dDExMVFOWmYwSGhIbDhIWVJZRFhqb0E6MA <- Please answer very short survey on favorite aspects of programming languages (for private ad-hoc research, non-commercial, anonymous).
jonafan has quit [Read error: 110 (Connection timed out)]
valross has joined #ocaml
Alpounet has quit ["Leaving"]
SlothSpot has quit ["Leaving"]
tmaedaZ is now known as tmaeda