Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
SirNick has quit []
jeanbon has quit ["EOF"]
Associat0r has quit []
Ched has quit [Read error: 60 (Operation timed out)]
Ched has joined #ocaml
verte has joined #ocaml
jeddhaberstro has joined #ocaml
lutter has quit ["Leaving."]
jeddhaberstro has quit []
seafood has quit [Read error: 60 (Operation timed out)]
seafood has joined #ocaml
seafood has quit [Connection timed out]
miyako has quit [Read error: 104 (Connection reset by peer)]
verte has quit [":("]
verte has joined #ocaml
Chaz has quit [Read error: 60 (Operation timed out)]
m3ga has joined #ocaml
m3ga has quit [Client Quit]
palomer has joined #ocaml
<palomer>
err
<palomer>
whatever happened to the jane street summer project awards being announced today?
<palomer>
guess I'll have to wait till tomorrow
<palomer>
night!
seafood has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
det has joined #ocaml
Snark has joined #ocaml
jackie has joined #ocaml
seafood has quit []
det has quit [Read error: 104 (Connection reset by peer)]
Alpounet has joined #ocaml
<Alpounet>
hi
* Alpounet
is still waiting...
<flux>
brendan, would something like: let first_nonequal a b = let rec loop at = if at < String.length a && at < String.length b && a = b then loop (at + 1) else at in loop 0 let longest_common xs = List.fold_left (fun longest x -> String.sub longest 0 (first_nonequal longest x)) (List.hd xs) (List.tl xs) work?
<flux>
apparently not :)
SirNick has joined #ocaml
<flux>
argh, there is a bug in first_nonequal: the ..a = b.. should be a.[at] = b.[at]
<flux>
also, it's not as efficient as it could be. it should not do substringing all the time.
SirNick has quit []
<olegfink>
Alpounet: have you written them?
<Alpounet>
yesterday morning, yeah, to know if announcements were to be made yesterday or not.
Associat0r has joined #ocaml
jamii has joined #ocaml
CoryDambach has quit [Read error: 104 (Connection reset by peer)]
CoryDambach has joined #ocaml
CoryDambach has quit [Client Quit]
jeanbon has joined #ocaml
komar_ has joined #ocaml
Alpounet has quit [Remote closed the connection]
bluestorm has joined #ocaml
_zack has joined #ocaml
Alpounet has joined #ocaml
_zack has quit ["Leaving."]
mlbot has joined #ocaml
spilman has joined #ocaml
jzmer has joined #ocaml
<jzmer>
anyone knows what "Unbound module" is?
<jzmer>
just made a search in refman.pdf and nothing found
Camarade_Tux has joined #ocaml
<bluestorm>
jzmer: means OCaml doesn't know the module you're referring to
<jzmer>
bluestorm: but isnt that the standard path for modules is /usr/lib/ocaml ?
<Alpounet>
it may also be /usr/lib/ocaml/<your ocaml version, e.g 3.11>/
<jzmer>
got, it looks like i have set the path then
<jzmer>
*/to/*
<bluestorm>
jzmer: what module are you trying to use ?
<bluestorm>
most modules of the stdlib are automatically linked (List, Array...)
<bluestorm>
but some aren't ( Unix, Graphics ...), so with a naïve compilation command you'll get that kind of errors
<jzmer>
bluestorm: its lacaml currently located at /usr/lib/ocaml/lacaml , nvm i will run the script on another machine . . .
<mrvn>
But I am a specific user as opposed to the random user. :)
<mrvn>
ups
jeremiah has quit [Read error: 104 (Connection reset by peer)]
jonathanturner has joined #ocaml
<Alpounet>
jzmer, have you findlib installed ?
spilman has quit ["Quitte"]
deech has quit [Read error: 104 (Connection reset by peer)]
deech has joined #ocaml
ztfw has joined #ocaml
jeremiah has joined #ocaml
jonathanturner has quit [Read error: 104 (Connection reset by peer)]
jonathanturner_ has joined #ocaml
jonathanturner_ has left #ocaml []
Yoric[DT] has joined #ocaml
jzmer has quit ["Lost terminal"]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
Hi
jeremiah has joined #ocaml
_zack has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
pants2 has quit [Remote closed the connection]
Ched has quit [Read error: 104 (Connection reset by peer)]
jeremiah has joined #ocaml
steg has quit ["brb"]
<thelema>
does anyone else get intermittent failures with the "testing from source file" battery testcase?
steg has joined #ocaml
maskd has joined #ocaml
Ched has joined #ocaml
rwmjones_ has quit [Read error: 60 (Operation timed out)]
ztfw has quit [Remote closed the connection]
ztfw has joined #ocaml
rwmjones has quit [Read error: 113 (No route to host)]
seafood has joined #ocaml
seafood has quit [Client Quit]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
jeremiah has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<bluestorm>
that's a real code sample, sorry if it's not "short"
<bluestorm>
(not so real code, more like proof-of-concept)
<bluestorm>
the problem is with the "parse" definition
<bluestorm>
I quite often run into the problem where inside a mutual recursive definitions I want to do something like
<bluestorm>
and parse_sums = left_assoc_parser ["+"; "-"]
<bluestorm>
wich the compiler won't accept
<bluestorm>
in general it suffices to eta-expand
<bluestorm>
and parse_sums s = left_assoc_parser ["+"; "-"] s
<mrvn>
are you sure the problem isn't cause by passing the stuff through an extra module?
<bluestorm>
what do you mean ?
<Yoric[DT]>
Yeah, it's easy to encounter this limitation on recursivity when writing parsers.
<bluestorm>
mrvn: the extra module is meaningful because
<bluestorm>
in that case, the value type (even if it's an abstraction under the hood) is abstract
<bluestorm>
so I can't eta-expand without breaking the abstraction
<bluestorm>
a solution would be to add "lazy" and Lazy.force in appropriate places
<bluestorm>
(or a dummy unit parameter, wich is equivalent)
<bluestorm>
btw, do you know of a nice polymorph implementation of the State monad in OCaml ?
<mrvn>
It usualy is a problem of using a value before it is done constructing.
<bluestorm>
this is a limited implementation (monomorphic in the state type), and i've tried with second-order polymorphism but got stuck (not tried too hard though)
<bluestorm>
mrvn: well except in case it isn't but the compiler doesn't know it
<mrvn>
bluestorm: why don't you use haskel?
<mrvn>
bluestorm: doesn't or can't?
<bluestorm>
depends
<bluestorm>
but the restriction on recursive definitions is of syntaxic nature
<bluestorm>
so there will inevitably be cases where it doesn't suit the semantic anyway
<bluestorm>
(the advantage of syntaxic restrictions being that they're easy to understand)
<mrvn>
worstcase one needs to add an unit paramter, right?
<bluestorm>
well i'm not sure this is always possible
<bluestorm>
i mean the re-evaluation could raise side-effect or performance issues
<bluestorm>
but that problem can generally be worked around, yes
<mrvn>
bluestorm: But you are reevaluating anyway or the compiler is right that it isn't allowed.
<bluestorm>
well let rec f = (fun x -> ...), (fun x -> ...) doesn't get reevaluated
<mrvn>
it does for every x you pass to f
<bluestorm>
yes the body ... is reevaluated, but not the function declaration
<bluestorm>
in my example, (get >>= ...) is a functional value
<bluestorm>
it shouldn't need to be reevaluated for the definition to be meaningful
<bluestorm>
when you work-around by writing "let rec parse () = get >>= ... and .. = parse () ... " , (get >>= ...) get re-evaluated while it doesn't need to
<bluestorm>
in that case that's not a big performance problem, but i suppose it could be
<mrvn>
bluestorm: problem is I think that you are applying the value to a function and the type system does not have any notion of wether that will be used already or only after more arguments.
<bluestorm>
let rec fib = memoize (function 0 -> 1 | n -> fib (n - 1) + fib (n - 2)) wouldn't work
<bluestorm>
while "memoize ..." is a know function to the type system (type (int -> int))
<bluestorm>
known
<mrvn>
# let memoize x = let _ = x (Obj.magic 0) in fun y -> x y;;
<mrvn>
val memoize : ('a -> 'b) -> 'a -> 'b = <fun>
<mrvn>
bluestorm: That would already use the value
<bluestorm>
hm
<bluestorm>
I see what you mean
<mrvn>
I don't quite see why it is actualy a problem for functions but thats what I figure.
<mrvn>
An obvious example would be let rec x = { v = x.v; }
<bluestorm>
(btw, it's an interesting exercise for students to write fix_memoize such that let rec fib = memoize (fun fib -> function 0 | 1 -> 1 | n -> fib (n - 1) + fib (n - 2)) does the right thing)
<bluestorm>
# let rec x = { v = x.v };;
<bluestorm>
This kind of expression is not allowed as right-hand side of `let rec'
<mrvn>
bluestorm: obviously. It would use an uninitialized value to initialize said value.
<bluestorm>
the nice thing is that the compiler hint that by a syntaxic check only
<bluestorm>
(sometimes I want to say to the compiler : "You're very clever, young man, very clever")
<mrvn>
In case ob classes it sucks though: class read_vec = object val size = read_int () val v = Array.init size (fun _ -> read_float ()) end;;
monadic_kid has joined #ocaml
Ariens_Hyperion has joined #ocaml
kaustuv has quit [Read error: 60 (Operation timed out)]
kaustuv has joined #ocaml
fremo has quit [Remote closed the connection]
fremo has joined #ocaml
fremo is now known as Guest851
slash_ has joined #ocaml
Smerdyakov has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
jeremiah has joined #ocaml
Guest851 is now known as fremo
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<palomer>
ive always wondered...instead of giving a type error, why doesn't ocaml just try the cast?
<bluestorm>
because that would fail at runtime ?
<bluestorm>
in static language, typing disciplines are designed to detect errors earlier (at compile-time)
jeremiah has joined #ocaml
bluestorm has quit [Remote closed the connection]
<palomer>
err, I meant a :> cast
<thelema>
because the type system doesn't produce any code
<thelema>
the design insulates the type system from code generation
<palomer>
err, I meant that type errors that can be fixed with a quick :>
<palomer>
like "expected foo, given bar" when bar is clearly a subtype of foo
Smerdyakov has quit ["Leaving"]
<palomer>
my code is getting rather cast heavy
<thelema>
your own fault for over-engineering your objects
purple_ has joined #ocaml
bindreturn has quit [Read error: 110 (Connection timed out)]
Ori_B_ is now known as Ori_B
<palomer>
No implementations provided for the following modules: <--how do I fix this error? do I add the .cmx file to the pack? the cmxa file? the .a file? change the META?
<thelema>
cmx or cmxa
<thelema>
it could be cause by META
<palomer>
my META mentions the .cmx and .cmxa files
<palomer>
fixed it
<palomer>
by including everything:P
<palomer>
actually, failed:/
BiDOrD has joined #ocaml
jeddhaberstro has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Snark has quit [Read error: 113 (No route to host)]
jeremiah has joined #ocaml
itewsh has joined #ocaml
komar_ has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
seafood has joined #ocaml
<ReinH>
Hmm, I just installed the caml-ounit port (macports) but cannot open OUnit and don't have the caml-ounit bin
<ReinH>
should I install from source?
<dartelin>
can anyone tell me how to detect end of file while reading lines ?
<dartelin>
i need to "iterate" through all lines in a text file
<dartelin>
but i cant figure out how to detect EOF
<palomer>
is it possible to ask ocamlfind if pack X is installed?
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<hcarty>
dartelin: Catch the thrown exception (End_of_file if you are using the stdlib functions)
<dartelin>
ok, thanks
<dartelin>
now i have another problem
<dartelin>
i need to count the occurence of a string in a file
<dartelin>
how many times does it appear in a file
<dartelin>
and i don't know how to solve it...
monadic_kid has quit ["Leaving"]
seafood has quit []
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<palomer>
dartelin, check out the Str module (maybe)
<palomer>
ExtString.find could probably also help
<palomer>
it's in ext-lib
<dartelin>
hcarty, i have problem with catching, becase the last line throws the excception