mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
alexyk has quit []
hsuh has joined #ocaml
yminsky has joined #ocaml
rogo has left #ocaml []
Morphous_ has quit ["shutdown"]
Amorphous has joined #ocaml
jlouis_ has joined #ocaml
jlouis_ has quit [Client Quit]
jlouis has quit [Read error: 110 (Connection timed out)]
<mwc> so I was thinking about how Ocaml doesn't seem to have a lot of libraries (compared to say Java, Perl, Python)
<mwc> which may be a reason why it's not more widely used
<mwc> this was discussed here a few nights ago or so
<mwc> is it maybe that the library structure of ocaml isn't amenable to extension? Would it be more useful if Ocaml 4.0 featured a new standard library that was more extensible
<mwc> say the IO classes used by Extlib/Netlib/Camomille
<mwc> thoughts?
<psnively> I hear that a lot, and honestly, I don't find it to be an issue.
<psnively> Having said that, it'd be nice to have something more closely approximating, e.g. SML's Standard Basis in its structure.
<psnively> But lack of libraries hasn't stopped me from using OCaml successfully for my purposes.
evn_ has joined #ocaml
m3ga has quit [Read error: 113 (No route to host)]
evn_ has quit []
psnively has quit []
goalieca has joined #ocaml
<Ramzi> yay. i just helped someone with ocaml. i'm paying it forward
<Ramzi> he's all like, I have m and n as ints, and I'm going to pass it to a function that uses the ^ operator on m and n. what's the deal.
<Ramzi> and i'm like. ocaml thinks m and n are strings, and he's like, but they're ints.
<thelema> Ramzi:good job.
<thelema> mwc:interested in helping me extend ocaml's stdlib?
ulfdoz has quit [brown.freenode.net irc.freenode.net]
yminsky has quit [brown.freenode.net irc.freenode.net]
bzzbzz has quit [brown.freenode.net irc.freenode.net]
szell has quit [brown.freenode.net irc.freenode.net]
netx has quit [brown.freenode.net irc.freenode.net]
seafood has quit [brown.freenode.net irc.freenode.net]
Dazhbog has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
TSC` has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
yminsky has joined #ocaml
bzzbzz has joined #ocaml
szell has joined #ocaml
netx has joined #ocaml
ulfdoz has joined #ocaml
seafood has joined #ocaml
Dazhbog has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
coucou747 has joined #ocaml
authentic has joined #ocaml
TSC` has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
<Ramzi> i know it's not ocaml, but http://codepad.org/vzxB2m8u
<Ramzi> that should give the number of primes less than 10,000 right?
<thelema> Ramzi: I think the problem was to find the 10,001th prime, no?
<Ramzi> nvm, i think i caught my mistake. i'm on 187
<Ramzi> it's easy but i wanted to do the whole problem in codepad without breaking out an ide
* thelema is working backwards from 188 too
<Ramzi> hah, yeah, right. that's what i'm doing...
<Ramzi> wanna do 187 together?
<thelema> 187 seems pretty straightforward - for each int 1--10^8, factor it, and count the factors
<Ramzi> no no no no that's terrible
<thelema> generating numbers by multiplying pairs of factors seems a poor way of doing things.
<Ramzi> factoring is an expensive process.
<thelema> well, maybe not...
<thelema> yeah, but 10^8 isn't that big. And factoring isn't that expensive on smaller numbers.
<Ramzi> so we can approximate the number of primes less than 10^8
<Ramzi> about 1085
<Ramzi> according to the prime counting function.
<thelema> alternate algorithm: for each prime <10^4 (sqrt 10^8), count all multiples of it, except for larger-prime mulitples.
<Ramzi> so now, the number of pairs you can check is... 1085/2 * (1085+1)
<Ramzi> Or about 500,000 pairs
<Ramzi> So 5*10^5 checks is a lot faster than 1*10^8 checks
<Ramzi> hmm...
<thelema> what are you checking?
<Ramzi> i'm reading your alternate algo
<Ramzi> but i just finished explaining why your first algo was bad
<Ramzi> this alternate algo was what i had in mind with the c code i pasted
<thelema> my first algorithm is inefficient, but don't forget how cheap CPU time is.
<Ramzi> you see that i already had 10^4 in mind
<Ramzi> i almost want you to code your first way to see how long it takes
* thelema can and will.
<Ramzi> wait, let's reason
<Ramzi> you're going to do 10^8 factorings.
<Ramzi> If factoring is constant, let's say it takes 1 microsecond.
<thelema> 100 seconds.
<Ramzi> So your code will take 10^2 seconds. hmm, eh
<Ramzi> i still suspect it'd take longer.
<Ramzi> i wonder what the average number of divisors from 2 to 10,000 is
<Ramzi> no, i mean, 10^8 is
<thelema> could be calculated pretty easily
<Ramzi> if it's like 5, then your 100 seconds turns into 500 seconds really fast.
<Ramzi> you can't calculate the average number of divisors without first doing factoring anyway! lol, we don't want to have to solve the problem in order to solve the problem.
<Ramzi> that is, it will take you as long to find the average number of divisors as it will to factor from 2 to 10^8 in the first place.
* thelema is just fine factoring every number 2--10^8
<Ramzi> alright. code it and tell me how long it takes
* thelema breaks stack with a non-tail-recursive generator for 1..n
* thelema realizes that a for loop works well.
<thelema> 1 min 7 seconds for ... 1.1 million factorizations. (including a bunch of file IO to write their factorizations to a file.)
<thelema> ick, and way too little buffering - flushing stdout each time I write a factor.
<thelema> (and this is bytecode even)
<thelema> still about the same - 55 sec for about 1.1 million factorizations
<Ramzi> why do the io stuff
palomer_ has joined #ocaml
<thelema> 1)because that's what my program did before, 2) so I can keep track of how far it got pretty easily.
<Ramzi> but it's not going to give you an accurate estimation of the time
<thelema> I can drop it, and just count, but if I'm going to do that, I might as well handicap the factorization by having it stop once it hits the second factor, and print something special if it's done.
<thelema> s/print something special/return true/
<Ramzi> i just coded a solution in ruby which gave me the same wrong answer as my c solution
<thelema> Ramzi: just counting primes 1..10000?
<Ramzi> no
<Ramzi> then taking each pair and checking if their product is less
<Ramzi> it gives the right answer for < 30, which is the one they use in the problem description
<Ramzi> do you know ruby?
<thelema> not well. it's not sufficient to count only those combinations - what about 2 * 10001?
<thelema> (assuming 100001 is prime)
<Ramzi> hmm...
<Ramzi> why did you propose 10^4 then, in your alternate algo?
<thelema> once both factors >10^4, you're done.
<Ramzi> yeah, but as you just mention, one factor can be > 10^4
<Ramzi> so you have to generate all primes less than (10^8)/2
<thelema> and then for the first p, count how many primes are less than 10^8/p
<thelema> and do so for each p up to 10^4
<thelema> how many primes between p and 10^8/p
<Ramzi> that doesn't have an elegant summing formula.
<Ramzi> and this is breaking my idea of doing the whole thing in codepad.
<thelema> Make an array with 10^8 elements, x -> # of primes less than x. then counting primes cones down to subtracting the values at two indices.
<thelema> err, 10^8/2
<Ramzi> what're you working on?
hsuh has quit [Remote closed the connection]
<thelema> stopping factorizing at 2 factors.
adu has joined #ocaml
palomer has quit [Read error: 110 (Connection timed out)]
<Ramzi> do you know mathematica?
<thelema> Iused to - it's been forever since I've used it.
<Ramzi> do you know how to make a list and push elements onto it?
<thelema> Ramzi: in mathematica? sorry.
<Ramzi> i've gone through C, ruby, and mathematica. i think it's time for java
<Ramzi> i really like the collections framework of java
<thelema> I admit it's well made.
<Ramzi> although mathematica had cool stuff like PrimeQ[] and Divisors[]
<Ramzi> I couldn't figure out how to make a damn array
<Ramzi> I feel if I learned mathematica it would be the best for a lot of these project euler problems.
<thelema> 1.1 million 2-composites counted
<thelema> 1.4 million in 2:36
<Ramzi> you know PE has a rule that code shouldn't take more than a minute to run
<thelema> yeah, I guess this is cheating a bit.
adu has left #ocaml []
<thelema> I'll get to work on the counting primes.
zkincaid has left #ocaml []
<Ramzi> alright, it's clear we need a better algo
<Ramzi> if you produce all the primes less than (10^8)/2, that's around 800k primes
<Ramzi> and then to check the pairs is the sum from 1 to 800k.
|Catch22| has quit []
<thelema> got it!
<thelema> with my counting primes algorithm.
<Ramzi> huh wha
<Ramzi> what was the algo again
<thelema> for each prime factor 1..10000, I even know how many 2-composites have that as a factor.
<thelema> step 1: sieve of erasthenes 1..10^8
<thelema> step 2: rewrite that array with counts of how many primes < i
<thelema> step 3: count prime combinations using that array.
<thelema> maybe the first two steps could get combined, but that'd only save iterating over the first 10,000 elements of the array - I imagine running the counts all the way out takes the most time.
<thelema> nope, 31 cpu seconds to sieve, 9.2 cpu seconds to gen the counts, and 0.024 seconds to count prime pairs.
TSC` is now known as TSC
<Ramzi> i'm sorry i'm being distracted by irl people
<thelema> if you poke them hard enough, they'll go away. :)
<Ramzi> sorry, i'm back.
<Ramzi> you do the sieve of erasthenes 10^8 times?
<thelema> I sieve all numbers 1..10^8
<Ramzi> oh, hmm... i did my sieve poorly
<thelema> I only have to check for factors up to 10^4
<Ramzi> i just used i as a divisor from i =1 to i = sqrt(p)
<thelema> me too it seems. Someone has used mathematica to solve it (using my basic insight - it's called PrimePi(x) in mathematica)
<Ramzi> question, do you create a list with 10^8 numbers in it before you sieve it?
<thelema> I create that array, yes
<thelema> and i only seed it with 1's
<Ramzi> so you have an array with 10^8 1's
<Ramzi> and for every multiple of every prime < 10,000
<thelema> the 1 becomes a 0
<Ramzi> every multiple, or every prime multiple?
<thelema> easiest to just do every multiple.
<thelema> actually, need to do every multiple
<Ramzi> so, like, 4*17 becomes a 0 in the array
<Ramzi> what does that 0 represent?
<thelema> composite
<Ramzi> But it's not a composite of 2 primes.
<Ramzi> It's a composite of 3, in this case
<thelema> I've not gotten to that part.
<Ramzi> okay
<Ramzi> so now we have a list of composites and primes
<Ramzi> generated relatively quickly
<thelema> next I run through that list turning it into a cumulative count
<thelema> (generating that list is the slowest part of my algo)
<Ramzi> so, all the numbers that are multiples of 2, of 3, of 5, of 7, of 11, etc?
<Ramzi> So 6 would have a count of 2, since 6 is a multiple of 2, and a multiple of 3?
<thelema> no, 3 would have a count of 2 because there's two primes <= 3
<Ramzi> so 5 would have a count of 3, and 6 will have a count of 3?
<thelema> yes
<Ramzi> okay. then what
<Ramzi> i guess i'm failing to see the value of a count of primes less than i
<thelema> for i = 2 to 10000 do j = 1E8/i; count += arr.(j) - arr.(i) + 1
<thelema> forgive the syntax
<Ramzi> so, let's say i was 117
<thelema> how many 2-composites are there with 2 as a factor?
<thelema> how many 2-composites with 117 as a factor?
postalchris has joined #ocaml
postalchris has quit [Client Quit]
<Ramzi> 117*2 is one. 117*3 is another. 117*5 is another... 113*117 is another.
jonafan_ has joined #ocaml
<Ramzi> oh i see
<thelema> up to... 1E8/117
<Ramzi> so that's how many compsites have 117 as a factor.
<Ramzi> sorry, 2composities
<thelema> 2-comps
<Ramzi> well, some of those numbers will overlap, i think
<thelema> nice, it runs in about 7 seconds when compiled natively
<Ramzi> right. like, the set of 2-comps with 3 as a factor overlaps with the set of 2-comps with 117 as a factor
<Ramzi> actually, the overlap is just the one element, 3*117
<thelema> my trick is to only include primes >117 in it's count.
<thelema> *its
<Ramzi> But the idea is, the set of 2-comps that have 117 as a factor share one element with every other prime
<Ramzi> still.
<thelema> easier to just count primes > 117 and < 1E8/117
<Ramzi> oh, btw 117 isn't prime
<Ramzi> but let's just pretend it is
<thelema> p: 127 d: 787401 count: 62981
<thelema> prime: 127
<thelema> dividend (w/ 1e8) = 787401
<thelema> i.e. 787401 * 127 ~= 1e8
<thelema> there's 62,981 primes between 787401 and 127 (including 127)
<Ramzi> so there are 62,981 primes between 127 and 787401
<Ramzi> i'm sorry, where did 62981 come from?
<thelema> well, I have made an array of counts of primes less than each number. I subtract to get the amount between two numbers.
<Ramzi> so in the 787401's array index, you know how many primes are less than that number
<Ramzi> oh i see
<Ramzi> right
<Ramzi> so the number of 2-comps is equal to the number of primes <=127 plus the number of primes <=62981
<Ramzi> hmm, let me try again
<thelema> number of 2-comps with 127 as factor = #primes <= 787401 - # primes < 127
<Ramzi> if there's x primes less than 127, and y primes between 127 and 62981, what does this mean about the 2-comps that have 127 in them?
<Ramzi> lol
<thelema> nothing.
<thelema> number of 2-comps with p as factor = #primes <= (1e8 / p) - # primes < p
<Ramzi> i'm failing to see why that's true
<thelema> to get a 2-comp with 127 as a factor, you can use any prime up to...
<Ramzi> 787401
<Ramzi> so you have 62981 choices
<thelema> if you exclude the ones already taken by pairing 2*127, 3*127, 5*127...
<Ramzi> that is, 2*127, 3*127, ..., k*127 is a list with 62981 elements
<Ramzi> well, you don't want to exclude them
<Ramzi> you can exclude them, but you should write #primes_not_counting_those_already_counted....
<Ramzi> lol
<thelema> I do want to exclude them, because I've already counted them with the 2-comps having factor 2, 3, 5, etc.
<Ramzi> right. you don't want to account for the same 2-comp twice.
<Ramzi> which is what i was saying earlier about the overlap.
<thelema> which is why I subtract arr.(127) (to not count combinations with smaller primes
<Ramzi> but i was confused because i thought you were literally saying, "The number of 2-comps with 127 as a factor is #<62981 - #<127"
<thelema> no, it's #<787401 - #<127 +1
<Ramzi> right,
<Ramzi> but still, it'd be wrong to say that's the total number of 2-comps with 127 as a factor
<thelema> oh, sorry yes...
<thelema> the number not already counted.
<Ramzi> that's a close number, with some excluded
<Ramzi> yeah
<Ramzi> okay
jonafan has quit [Read error: 110 (Connection timed out)]
<Ramzi> so then, the total number of 2-comps is the "number not already counted" for 2, plus the "number not already counted" for 3, + ...
<thelema> the number of ordered primes (p1,p2) such that p1*p2 <1e8, and p1 < p2
<thelema> for each p1, I calculate the number of possible p2's
<thelema> err, p1 <= p2
<Ramzi> for every prime number, you have a set, "2-comps that have the factor p." right?
<Ramzi> And for any other prime, say q, p intersect q is going to be 1 or 0.
<Ramzi> ohhh, I see. I was thinking, why not just subtract the sum of the number of primes.
<Ramzi> but you don't know how many overlaps there are without doing what you did.
<thelema> almost, I've put the set of 2-comps in 1-1 relation with pairs of primes, and count those pairs by the value of the first prime.
<Ramzi> how many primes were in the list, approx?
<thelema> 1233 lines - 4 lines debug = 1229 primes.
<Ramzi> so you sieve on 1E8, which does not take long. Then you count the number of primes <=i for all i. Wait a minute, doesn't the count take 10^8 operations?
<Ramzi> at least
<thelema> the sieve takes much more than 10^8 operations.
<Ramzi> that is, for 10^8 numbers, you need to count how many primes are less than it.
<Ramzi> so if "count()" is 1 unit of time, you have to do that 10^8 times
<Ramzi> that is, make 10^8 memory writes
<thelema> let c = ref 0 in
<thelema> for i = 2 to upto-1 do
<thelema> if arr.(i) != 0 then incr c;
<thelema> arr.(i) <- !c;
<thelema> done;
<Ramzi> how they hell can you do 10^8 memory writes in 7s?
<thelema> actually, my processor did 10^8 memory writes in .488 seconds - 7s was bytecode
<Ramzi> if you have an array of 10^8 integers, this is 100mb of RAM provided you used 1 byte ints
<thelema> no, these are standard ocaml ints - 64 bits = 8 bytes on my machine.
<Ramzi> do you have 800mb of RAM?
<thelema> I have 2GB
<thelema> and it seems ocaml is happy taking a big chunk of it.
<thelema> 7169 thelema 20 0 1382m 764m 528 T 0 38.1 0:05.78 euler187.native
<Ramzi> this isn't fair. i only have 512mb ram
<thelema> :P
<Ramzi> even with 4 byte ints, that's still 400mb
<thelema> well, you only have a 32-bit processor...
<thelema> you could get away with 1/2 the size of the array.
<thelema> the max index used by the counting bit is only 50000000
<thelema> only 4 indices > 10,000,000 get checked.
<Ramzi> hmm...
<Ramzi> so first, i know there are no primes greater than 10^8/2
<Ramzi> so this cuts my mem usage in half
<Ramzi> but how would i know that only 4 indices > 10,000 checked
<Ramzi> you meant 10,000, i assume
<Ramzi> or not.
<thelema> no, I meant 10 million - only 2, 3, 5, and 7 need to do lookups on values > 10 million
<thelema> p: 2 d: 50000000 count: 3001134
<thelema> p: 3 d: 33333333 count: 2050942
<thelema> p: 5 d: 20000000 count: 1270605
<thelema> p: 7 d: 14285714 count: 927429
<thelema> p: 11 d: 9090909 count: 608109
<Ramzi> so this is more of a "research solution"
<Ramzi> if i paid close attention, i'd realize i could cut the array by a factor of 10
<thelema> it's a fat-ram solution. I believe mathematica has some faster way of calculating # primes < p -- I don't know what that method is.
<Ramzi> if i had an array of only 10m
<Ramzi> how would I get the counts
<Ramzi> for 50000000, 3333333,
<thelema> that I don't know.
<Ramzi> how many 2-comps have 2 as a factor...
<Ramzi> counting again would take too long?
<Ramzi> i feel like there should be a simple way that i'm not seeing. but as it stands your solution requires 200mb ram
<Ramzi> and i'm really surprised you can do that many mem writes that fast
<thelema> 200 million writes/second @ 1.6GHz = 8 cycles per write. not bad.
<thelema> sustained.
<Ramzi> well, congratulations.
<thelema> yay ocaml. I'll take a look at the asm to see how it did it.
<Ramzi> i wonder if there's a better way
<Ramzi> thelema: my school has release tests for code
<Ramzi> i'm failing one of the test, and it could refer to any of 4 functions
<thelema> okay, what's the test?
<Ramzi> i'm pretty sure the 4 are right and i tested them exhaustively.
<Ramzi> i don't know. it doesn't say anything more than, "a test on one of the four functions failed"
<thelema> okay, paste the 4
<Ramzi> this is where Smerdyakov's proof checking would come in handy
<thelema> only if your program description could unambiguously be turned into an exact description of what's needed (which is usually equivalent to writing the program right)
<Ramzi> thelema: i'm actually a little uncomfortable posting full solutions in here. what if someone else from the class is here
<thelema> unlikely, but fair enough.
<Ramzi> this is why i asked if you had aim earlier
<Ramzi> sent
<thelema> itob 0 should be [false], no?
<Ramzi> (You may assume the argument to itob is positive.)
<Ramzi> you think that's it? lol. i can't check until tomorrow around 7:30ish
<thelema> that's the first thing I found.
<Ramzi> i bet you that's it.
<Ramzi> man, i remember thinking that too, as i was writing.
<thelema> you know you can do match x,y with (true::xt),(true,yt) -> blah
<Ramzi> i said, "i'll fix it later." then i forgot
<thelema> instead of testing the heads
<Ramzi> hmm
<Ramzi> yeah that'd clean up a bit
<Ramzi> i think the itob problem is it.
<Ramzi> thank you friend. it's quite late.
<thelema> 'nite
<Ramzi> i guess i'll talk to you tomorrow.
<Ramzi> goodnight.
evn_ has joined #ocaml
evn_ has quit []
alexyk has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
schme has joined #ocaml
Linktim has joined #ocaml
ygrek has joined #ocaml
goalieca has quit [Remote closed the connection]
<alexyk> is there a way in ocamlto repeat a string N times, a la "o"^(" la"*2) => "o la la" ?
thelema has quit [Read error: 110 (Connection timed out)]
<tsuyoshi> I think you'll have to write that function yourself
Morphous has joined #ocaml
<tsuyoshi> rwmjones: I figured out how to store zero-length arrays.. just sent a patch
<tsuyoshi> mmalloc is pretty crufty code.. I wonder if you could replace it with some other malloc
goalieca has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
<tsuyoshi> yeah.. could take this: http://g.oswego.edu/dl/html/malloc.html
<tsuyoshi> and adapt it so it uses mmap the same way it uses sbrk
evn_ has joined #ocaml
evn_ has quit [Remote closed the connection]
Snark has joined #ocaml
ikaros has joined #ocaml
alexyk has quit []
goalieca has quit ["Ex-Chat"]
Linktim_ has joined #ocaml
marmottine has joined #ocaml
hkBst has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
filp has joined #ocaml
thelema has joined #ocaml
filp has quit [Client Quit]
bongy has joined #ocaml
Yoric[DT] has joined #ocaml
bongy has quit ["Leaving"]
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
bluestorm has joined #ocaml
Tetsuo has joined #ocaml
ikaros has quit [Remote closed the connection]
LordMetroid has joined #ocaml
coucou747 has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
zmdkrbou has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
ita has joined #ocaml
ita has quit [Remote closed the connection]
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
<bluestorm> qwr: it's a shame that the reddit ocaml-related post getting comments are the least interesting ones :p
<bluestorm> (troll's appeal)
LordMetroid has quit ["Leaving"]
yminsky has quit []
fremo has quit [Connection timed out]
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
TSC has joined #ocaml
authentic has joined #ocaml
l_a_m has joined #ocaml
donny has joined #ocaml
shortcircuit has joined #ocaml
guyzmo has joined #ocaml
dwmw2_gone has joined #ocaml
Ugarte has joined #ocaml
svenl has joined #ocaml
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
Tetsuo has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
Tetsuo has quit [brown.freenode.net irc.freenode.net]
TSC has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
svenl has joined #ocaml
Ugarte has joined #ocaml
dwmw2_gone has joined #ocaml
guyzmo has joined #ocaml
shortcircuit has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
authentic has joined #ocaml
TSC has joined #ocaml
Tetsuo has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
gene9 has joined #ocaml
jlouis has joined #ocaml
Axioplase has joined #ocaml
seafood_ has joined #ocaml
gene9 has quit ["Leaving"]
<bluestorm> palomer_: now that you've rewritten your code, and that everybody (ie. reddit :-') is aware of it, do you intend to release it somewhat ?
Coin has joined #ocaml
<Coin> Hi everybody. I used to program a few years ago in caml-light and I am lost with ocaml; How do I include a source file (.ml) from the interpreter ?
<flux> #use
<flux> however, it will undoubtedly be useful to read the documentation ;)
<Coin> thks flux ! I try ....
seafood_ has quit []
<bluestorm> Coin: if you can read french, i've written a camlp4/ocaml syntax comparison on some forum
<Coin> bluestorm, yes I can. It would be useful to me. Where can I find it ?
<Coin> Meci ! I read it
<Coin> *Merci*
Axioplase has quit [Read error: 110 (Connection timed out)]
yminsky has joined #ocaml
jprieur has joined #ocaml
jprieur has quit [Connection reset by peer]
jprieur has joined #ocaml
Jedai has quit ["KVIrc 3.2.4 Anomalies http://www.kvirc.net/"]
Linktim- has joined #ocaml
Jedai has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Coin has quit [Remote closed the connection]
ikaros has joined #ocaml
ikaros has quit [Client Quit]
ikaros has joined #ocaml
robozni has joined #ocaml
jprieur_ has joined #ocaml
jprieur has quit [Read error: 110 (Connection timed out)]
Linktim- has quit [Read error: 113 (No route to host)]
Linktim has joined #ocaml
Tetsuo has quit [Remote closed the connection]
alexyk has joined #ocaml
ygrek has quit [Remote closed the connection]
alexyk has quit []
Tetsuo has joined #ocaml
dwmw2_gone has quit [Remote closed the connection]
gildor has joined #ocaml
Tetsuo has quit [Remote closed the connection]
alexyk has joined #ocaml
gene9 has joined #ocaml
<gene9> hello, quick question
<gene9> does anybody try to build ocsigen 1.0.0 server w/o problems?
<thelema> I assume its maintainers have - I haven't.
<gene9> thanks, anybody else? just curious why they call it 'release'
ygrek has joined #ocaml
<gene9> ok, I'll try to fix it, thank your for attention
gene9 has quit [Client Quit]
ttt-- has joined #ocaml
alexyk has quit []
Tetsuo has joined #ocaml
mfp_ is now known as mfp
bla has quit [Connection timed out]
bla has joined #ocaml
authentic has quit [Read error: 104 (Connection reset by peer)]
zkincaid has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
ikaros has quit [Remote closed the connection]
Snark has quit ["Ex-Chat"]
ttt-- has quit [Read error: 110 (Connection timed out)]
* Linktim /away
Linktim is now known as Linktimaw
Yoric[DT] has joined #ocaml
Linktimaw has quit [Remote closed the connection]
zkincaid has quit [Read error: 110 (Connection timed out)]
|Catch22| has joined #ocaml
mwc has quit [Remote closed the connection]
<flux> hmph, I always find writing little parser more difficult with streams than I expect..
jprieur_ is now known as jprieur
Morphous is now known as Amorphous
aminorex has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
<palomer_> bluestorm, definitely, it's my phd thesis
<bluestorm> :p
<palomer_> bluestorm, you in france?
<bluestorm> yes i am
<palomer_> paris?
<bluestorm> paris, and you ?
<palomer_> montreal
<palomer_> I've studied in paris though
<palomer_> under krivine and laurent (paris VII)
<bluestorm> hm
jprieur has quit ["Connection reset by beer"]
<bluestorm> seems lots and lots of different krivines have teached something in french universities
<palomer_> this is the caml krivine
<palomer_> which university you at?
<bluestorm> none
<palomer_> working?
<bluestorm> cpge
<palomer_> what's that?
<bluestorm> hm
<palomer_> oh yeah!
<palomer_> which school are you aiming for?
<bluestorm> that's a sensitive question right now :-'
<bluestorm> i'll have answers this summer :)
<Yoric[DT]> :)
goalieca has joined #ocaml
<Yoric[DT]> And good night everyone.
<palomer_> night!
Yoric[DT] has quit ["Ex-Chat"]
<palomer_> so, if I understand correctly, == is pretty useless
<thelema> palomer_: it's needed for doing things like finding cycles in a doubly-linked list.
<palomer_> oh my
<palomer_> or finding cycle in CFG definitions
<palomer_> does it work for function equality?
<thelema> yes, when dealing with cyclic data structures, = runs slowly.
<thelema> == does pointer comparison.
<thelema> whereas = does a structural comparison - checking if what the pointers point to is equal.
<palomer_> darn, doesn't work for functional values
<thelema> it's related to the difference between x == y and *x==*y in C.
<thelema> but much smarter in the case of *x == *y
<pango_> it does # let a = sin in a == a ;;
<pango_> - : bool = true
<pango_> but # sin == sin ;;
<pango_> - : bool = false
<pango_> (because you're really creating two different closures in the latter case)
<palomer_> # let foo = fun x -> x;;
<palomer_> val foo : 'a -> 'a = <fun>
<palomer_> # foo = foo;;
<palomer_> Exception: Invalid_argument "equal: functional value".
<palomer_> err, woops
<palomer_> ignore that
<palomer_> has anyone thought of having pattern matching "go through" references, like a := ref [1,2]; match a with ![1,2] -> ...
<thelema> palomer_:match !a with [1,2] ->
<palomer_> but if you have references sprinkled in your datastructure
<Smerdyakov> palomer_, already fully supported. Look at how [ref]s are implemented.
<palomer_> (reference equality is =, right?)
<palomer_> cool!
<Smerdyakov> What do you mean by "reference equality"?
<palomer_> pointer equality
<palomer_> disregarding what's inside the reference
<Smerdyakov> No. That would be (==).
<thelema> == computes constant speed fast, = depends on type, often slower (but does a more natural equality check on mutable values)
<palomer_> and I'm guessing that ocaml doesn't have equality types (like in sml), right?
<thelema> palomer_: if you want any other equality, you have to define it yourself.
<Smerdyakov> palomer_, yes. Also, read the manual.
<palomer_> okay!
ygrek has quit [Remote closed the connection]
<palomer_> anyone got a link to the ocaml manual?
<palomer_> found it
<palomer_> I don't see anything in the pattern chapter about references
<thelema> palomer_: ref 3 = { contents = 3 }
<thelema> references are records
<palomer_> whoa!
<palomer_> cool
<palomer_> records of what type?
<thelema> type 'a ref = {
<thelema> mutable contents : 'a;
<thelema> }
<Smerdyakov> palomer_, please consult this page with any further questions like this: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html
<palomer_> there's no way I could have guessed I had to go there to get my question answered!
<Smerdyakov> Well, now you know.
<Smerdyakov> Anything bound in the default environment you get in 'ocaml' is defined there or on its parent page.
<Smerdyakov> Actually, it should be "or on http://caml.inria.fr/pub/docs/manual-ocaml/manual033.html ".
* palomer_ will print both pages and read them dutifully
<palomer_> does ocaml have a hash_map?
<palomer_> or any other mapping container?
<thelema> palomer_: hashtbl?
<thelema> Map?
<palomer_> hashtbl will do nicely!
<palomer_> gotcha
<Smerdyakov> palomer_, time for you to read the summary of every module in the standard library.
jlouis has quit [Read error: 104 (Connection reset by peer)]
<bluestorm> hum
<palomer_> every module??!?
<thelema> palomer_: it's not that big. - not like java's stdlib
<palomer_> why not learn'em as I need'em? (I find I learn quicker and painlessler this way)
<palomer_> has anyone compiled a summary of every module in easily printable form?
<thelema> Smerdyakov gets bothered by questions easily answered by memorizing the manual.
<Smerdyakov> palomer_, because then you ask questions here that could be answered by developing some basic familiarity with OCaml ahead of time.
jlouis has joined #ocaml
Morphous has joined #ocaml
<palomer_> okok, I'll read the summaries
Amorphous has quit [Read error: 110 (Connection timed out)]
<palomer_> heck, I'll read the manual
schme has quit [Remote closed the connection]
jprieur has joined #ocaml
mikeX_ has joined #ocaml
bongy has joined #ocaml
mikeX has quit [Read error: 110 (Connection timed out)]
|Catch22| has quit []
jprieur has quit [Remote closed the connection]
bluestorm has quit ["Konversation terminated!"]
jprieur has joined #ocaml
marmottine has quit [Remote closed the connection]
bongy has quit ["Leaving"]
loud- has joined #ocaml
hkBst has quit ["Konversation terminated!"]
slowriot has joined #ocaml
authentic has joined #ocaml
jlouis has quit ["Leaving"]
* palomer_ is a big fan of autocompletion and otags
mwc has joined #ocaml
hsuh has joined #ocaml
Axioplase has joined #ocaml
pants1 has joined #ocaml
aminorex has left #ocaml []
<palomer_> if I annotate a term with type 'a, that 'a can still be refined later, right?
<thelema> if you insist that something is 'a, and it is more specific, I expect a type error.
<palomer_> let catRights : (('a,'b) either) list -> 'a list = fun lst -> map fromRight (filter isRight lst) <-- doesn't give me a type error
<palomer_> (yet, intuitively, it should)
loud- has quit ["."]
<palomer_> lemme prepare a test case and paste it in the pastebin
Tetsuo has quit ["Leaving"]
<palomer_> compiles fine
<palomer_> but clearly it's not the right type signature
<thelema> it's not?
<thelema> what should the sig be?
<thelema> -> 'b list?