Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
mattam has joined #ocaml
mattam_ has quit [Read error: 110 (Connection timed out)]
lus|wazze has joined #ocaml
lus|wazze has quit ["The Ogre philosopher Gnerdel believed the purpose of life was to live as high on the food chain as possible. She refused to e]
brwill_zzz is now known as brwill
lus|wazze has joined #ocaml
mrvn has joined #ocaml
mrvn_ has quit [Read error: 110 (Connection timed out)]
polin8__ has joined #ocaml
polin8_ has quit [Read error: 104 (Connection reset by peer)]
polin8__ has quit [Read error: 104 (Connection reset by peer)]
polin8 has quit [Read error: 104 (Connection reset by peer)]
mrvn has quit [Read error: 60 (Operation timed out)]
polin8 has joined #ocaml
polin8 has quit ["Now _that's_ a good cup of coffee."]
lus|wazze has quit ["The Ogre philosopher Gnerdel believed the purpose of life was to live as high on the food chain as possible. She refused to ea"]
jdrake has quit ["Oops. This machine just fell asleep"]
__buggs is now known as buggs
mattam_ has joined #ocaml
wax has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mattam_ is now known as mattam
jdmarshall has joined #ocaml
two-face has joined #ocaml
jdmarshall has quit [Remote closed the connection]
mellum has joined #ocaml
<mellum>
Is there something equivalent to #include? I.e. just paste the contents of a text file?
<two-face>
open
<two-face>
:)
<two-face>
why the need for #include?
<mellum>
I want to quickly change an implementation by #including something different
<two-face>
use functors
<mellum>
Hmm. They seem complicated. I've never really used them. Do they incur any performance penalty?
<two-face>
they don't
<two-face>
they are made for what you want
<two-face>
and they are a cleaner way to do it
<mellum>
Then I'll try it... the program runs for approximately 9 days, so it has to be fast :)
<two-face>
no problem
<teratorn>
9 days to do what?
<mellum>
Prove upper bounds on the running time of certain search tree algorithms.
<mellum>
Is there a constant for the maximal string length?
<teratorn>
i believe so
<two-face>
I'm not sure
<two-face>
there may be a reallocation when needed
<mellum>
but there is an upper limit, like 4M on 32-bit systems I think, since each string is a single GC block
two-face_ has joined #ocaml
systems has joined #ocaml
two-face has quit [Read error: 110 (Connection timed out)]
systems has quit ["Client Exiting"]
<mellum>
Hm. Another module question. If I do "include Foo" in an .ml file, it works, but not in a .mli file. Is that supposed to be the case?
<mellum>
I get Unbound module type Foo
<mellum>
even though there's a Foo.cmi
<two-face_>
you need a similar declaration in the .mli
<mellum>
similar?
<two-face_>
what do you mean with "include Foo" ?
<mellum>
Uhm, what's unclear there? I type those letters into the file
<mellum>
it should include the contents of the interface Foo
<mellum>
and that works with a .ml without .mli where the .cmi is generated implicitely
<mellum>
but now I want a .mli to remove stuff from the interface
<two-face_>
sorry, I didn't know about this "include" keyword
<mellum>
I see, I think it is a recent addition... It would be useful because another file contains some auto-generated "extern" declarations
<mellum>
"external" I mean
clam has joined #ocaml
clam has quit ["no reason"]
Kinners has joined #ocaml
<mellum>
Anybody knows a clever idiom to get a list of all choices of n items from a list?
<mellum>
where order is relevant...
karryall has joined #ocaml
<two-face_>
salut karryall
<karryall>
salut two-face_ !
<karryall>
ça roule ?
<two-face_>
ça peut aller et toi ?
<karryall>
on fait aller ...
<two-face_>
tu es a jussieu, tu y fais quoi ?
<karryall>
une thèse
<Kinners>
mellum: mine attempt is, let pow l = let rec pow acc = function [] -> acc | x :: xs -> pow ([x] :: List.rev_append acc (List.rev_map (fun y -> x :: y) acc)) xs in pow [] l
<Kinners>
err. my attempt :)
<two-face_>
karryall: sur quoi ?
<karryall>
two-face_: de la génétique, de l'analyse de séquences. En pratique, c'est des stats et de l'info
<mellum>
Kinners: Hmm, does not quite do what I want, but interesting :)
<Kinners>
mellum: yeah, it ignores the order
<two-face_>
karryall: ok
<karryall>
two-face_: normalement je finis courant 2004 ...
<two-face_>
karryall: et après ?
lus|wazze has joined #ocaml
<Kinners>
mellum: you want all the combinations, like the possible combinations of numbers in a lottery?
<karryall>
two-face_: arf, après ... le marché du travail !
<two-face_>
karryall: et quel type de travail ?
<karryall>
two-face_: bioinformatique si je trouve, informatique tout court sinon
<two-face_>
karryall: ok
<karryall>
two-face_: tu bricoles toujours avec la Xlib ?
<two-face_>
karryall: pas en ce moment
croesus has joined #ocaml
<karryall>
tu connais XCB ?
<two-face_>
vaguement
<two-face_>
Il y a aussi des projets intéressants tels Cairo
<karryall>
ça me paraissait pas mal comme technique. T'as pas essayé de transposer ça en caml ?
<two-face_>
je suis pas motivé en ce moment :P
<smkl>
let rec select = function [a] -> [a, []] | a::tl -> (a,tl) :: ( select tl >>= fun (x,lst) -> [x,(a::lst)]);;
<smkl>
let rec select_n n lst = if n = 0 then [[], lst] else ( select_n (n-1) lst >>= fun (x,rest) -> select rest >>= fun (y,rest) -> [(y::x),rest] );;
clam has joined #ocaml
<mellum>
smkl: do you ever answe any question without using >>=? ;)
<smkl>
i think >>= is useful for "combinatorics"
<smkl>
mellum: does that do what you wanted?
<lus|wazze>
what does >>= do?
<lus|wazze>
that operator is new to me
<smkl>
it's teh monad operator ... let (>>=) f g = List.flatten (List.map g f);; for lists
<lus|wazze>
ic
<mellum>
smkl: nearly, I don't need the rest
<mellum>
Oh, and multiples are allowed.
<smkl>
let rec select_n n lst = if n = 0 then [[]] else ( select_n (n-1) lst >>= fun x -> lst >>= fun y -> [y::x] );;
<mellum>
smkl: that looks pretty much like it. Thanks.
<smkl>
np
<mellum>
Do you also have something nice for all permutations of a list?
<mellum>
All my attemts for that were pretty longish.
<mellum>
Uh, does >>= associate left or right?
Kinners has left #ocaml []
harsha123 has joined #ocaml
harsha123 has left #ocaml []
jdrake has joined #ocaml
<smkl>
let rec insert a = function [] -> [[a]] | x::tl -> (a::x::tl) :: (insert a tl >>= fun l -> [x::l]);;
<smkl>
let rec perm = function [] -> [[]] | a::tl -> perm tl >>= fun l -> insert a l;;
<smkl>
a >>= fun x -> b >>= fun y -> c = a >>= (fun x -> b >>= (fun y -> c));;
<clam>
welcome to IOOCC
<smkl>
this all should be pretty clear if you understand the intuitive meaning of >>= (combining non-deterministic computations)
<clam>
not it would not, its pure example of obfuscation for no real reason, other than to show authors ueber elitness
<smkl>
bah
jdrake has quit ["Oops. This machine just fell asleep"]
<mellum>
Actually, it's probably easier to understand than what I came up with for permutations, spread over 3 functions.
<clam>
mellum: it only shows that you suck, and should probably drop an idea to be a programmer, nothing else
<two-face_>
hmmm
<smkl>
you can easily inline >>= to map/flatten if you think that is clearer ... i just find it easier to think with >>=
<two-face_>
these are harsh words
<mellum>
clam: please show me a good permutation function, then
<clam>
fun gen [] = [[]]
<clam>
| gen (x::xs) = let val l = gen xs in
<clam>
List.append l (map (fn xs => x :: xs) l) end
<mellum>
Is that SML or something?
<clam>
why do people always come to me with permutation problems? (this one was made for not so good student in .no)
<clam>
yes
<clam>
me gone to watch Simpsons... but ill be ther to spank asses later
clam has quit ["no reason"]
<two-face_>
this guy is really harsh
<mellum>
Hm, either I translated it to Ocaml badly, or it doesn't give permutations.
<mellum>
let rec gen = function [] -> [[]] | x::xs -> let l = gen xs in List.append l (List.map (fun xs -> x :: xs) l);;
<mellum>
# gen [1; 2; 3];;
<mellum>
- : int list list = [[]; [3]; [2]; [2; 3]; [1]; [1; 3]; [1; 2]; [1; 2; 3]]
<smkl>
it gives subsets
<mellum>
That's not quite the same as permutations.
* mellum
wonders why it's List.append but not List.map in SML
two-face_ has quit ["Client exiting"]
<smkl>
let rec gen = function [] -> [[]] | x::xs -> let y = gen xs in List.append y (y >>= fun l -> [x :: l]);; -- don't show this to malc
lus|wazze has quit ["The Ogre philosopher Gnerdel believed the purpose of life was to live as high on the food chain as possible. She refused to ea"]
karryall has quit ["ERC vVersion 3.0 $Revision: 1.328 $ (IRC client for Emacs)"]
lus|wazze has joined #ocaml
lus|wazze has quit [Client Quit]
clam has joined #ocaml
<clam>
smkl: why not?
<smkl>
because "its pure example of obfuscation for no real reason, other than to show authors ueber elitness"
<clam>
aha
<clam>
good thing you subscribe to my point of view
<mellum>
clam: where's your nice readable permutation function, by the way?
<clam>
mellum: was given to you by smkl
<mellum>
clam: nah, that's obfuscated, it uses >>=
<clam>
mellum: gee, how terrible.. let me fix that
lus|wazze has joined #ocaml
lus|wazze has quit [Client Quit]
<smkl>
here is a version of malc's function without >>=: List.fold_left (s (s (k s) (s (k (s (k (@)))) (s (k (s (s (k List.map) (s (k cons) i)))) (s (k k) i)))) (s (k k) i)) [[]]
<mellum>
Unbound value s
buggs is now known as buggs|afk
<Riastradh>
let s f g x = f x (g x) let k x _ = x
<smkl>
let i x = x
<Riastradh>
Bah!
<Riastradh>
let i = s k k
<smkl>
or that ... let cons x y = x::y
<mellum>
(::) should really work IMHO
<Riastradh>
It's stupid that it doesn't.
<mellum>
(,) should work too, of course :)
jdrake has joined #ocaml
Maddas has left #ocaml []
mattam_ has joined #ocaml
jdrake has quit ["Oops. This machine just fell asleep"]
mattam__ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mattam_ has quit [Read error: 110 (Connection timed out)]
jdrake has joined #ocaml
dbagnell has joined #ocaml
croesus has quit ["adios"]
Maddas has joined #ocaml
__buggs has joined #ocaml
buggs|afk has quit [Read error: 110 (Connection timed out)]