mfurr changed the topic of #ocaml to: OCaml 3.08.2 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
monochrom has quit ["Few people understand "understanding"."]
mattam has quit ["zZz"]
smkl_ has joined #ocaml
<KrispyKringle> cabled?
humasect has quit [Read error: 104 (Connection reset by peer)]
humasect has joined #ocaml
humasect has quit [Read error: 54 (Connection reset by peer)]
humasect has joined #ocaml
Skal_ has quit ["Client exiting"]
cjohnson has quit ["banana"]
kuribas has quit ["ERC Version 5.0.1 $Revision: 1.726.2.3 $ (IRC client for Emacs)"]
smkl_ has quit [Read error: 110 (Connection timed out)]
vezenchio has joined #ocaml
Sonarman_ has joined #ocaml
smkl_ has joined #ocaml
Sonarman has quit [Read error: 110 (Connection timed out)]
monochrom has joined #ocaml
jeff2 has joined #ocaml
<jeff2> will ocaml optimize a recursive expoentation method that uses the fact that (in pseudocode) x^n=x*x^(n-1) into one that uses x^n=x^(n/2)*x^(n/2)?
<Riastradh> Doubtful. OCaml's compiler performs hardly any optimization.
<jeff2> Riastradh: thought so. thanks
smkl_ has quit [Read error: 110 (Connection timed out)]
Herrchen_ has joined #ocaml
<tsume> if you want optimised code, you must do it yourself
<Riastradh> If you want optimized code, don't use OCaml. Some optimizations can be applied as simple manual program transformations, but the really important ones, mostly regarding closure conversion, require compiler support.
Herrchen has quit [Read error: 110 (Connection timed out)]
<monochrom> Wow I would love to see a "compiler" that does the foregoing optimization!
<det> monochrom, What do you mean?
<monochrom> The one jeff2 describes.
smkl_ has joined #ocaml
m3ga has left #ocaml []
monochrom has quit ["Few people understand understanding."]
__DL__ has joined #ocaml
Sonarman_ has quit ["leaving"]
mlh has quit [Client Quit]
smkl_ has quit [Read error: 110 (Connection timed out)]
Msandin has joined #ocaml
Snark has joined #ocaml
smkl_ has joined #ocaml
gim has quit []
vincenz has joined #ocaml
skylan has quit [Read error: 60 (Operation timed out)]
smimou has joined #ocaml
pango has quit [Remote closed the connection]
zzorn has joined #ocaml
pango has joined #ocaml
solarwind has joined #ocaml
humasect has quit [Read error: 104 (Connection reset by peer)]
humasect has joined #ocaml
zzorn has quit ["They are coming to take me away, ha ha"]
smkl_ has quit [Read error: 60 (Operation timed out)]
grirgz_ has joined #ocaml
grirgz has quit [Nick collision from services.]
grirgz_ is now known as grirgz
smkl_ has joined #ocaml
<slashvar[lri]> Hi there
slashvar[lri] is now known as slashvar[ens]
<vodka-goo> yo
kinners has joined #ocaml
mattam has joined #ocaml
<slashvar[ens]> hi mattam ;)
<vincenz> hello
vodka-goo has quit ["hop"]
smimou has quit ["?"]
gim has joined #ocaml
smkl_ has quit [Read error: 60 (Operation timed out)]
kinners has quit ["leaving"]
Skal has joined #ocaml
smkl_ has joined #ocaml
zzorn has joined #ocaml
jourdechance has joined #ocaml
zzorn has quit [Read error: 104 (Connection reset by peer)]
withersoever has quit [Read error: 54 (Connection reset by peer)]
jourdechance has quit [Read error: 113 (No route to host)]
jourdechance has joined #ocaml
zzorn has joined #ocaml
<grirgz> bye
grirgz has left #ocaml []
palomer has joined #ocaml
CosmicRay has joined #ocaml
Msandin has quit [Read error: 110 (Connection timed out)]
Msandin has joined #ocaml
smkl_ has quit [Read error: 110 (Connection timed out)]
drewr has joined #ocaml
Godeke has joined #ocaml
solarwind has quit ["leaving"]
drewr has quit ["ERC Version 5.0 $Revision: 1.733 $ (IRC client for Emacs)"]
madroach has joined #ocaml
<madroach> Hi, is it possible to cross compile from Unix to Windows??
<Snark> doesn't ocamlc give portable bytecode?
<Smerdyakov> Snark, yes.
<Smerdyakov> madroach, who cares about Windows? :D
<vincenz> hello Smerdyakov
<madroach> You will need an interpreter on the target-machine, won't you?
<vincenz> if you use bytecode you need one anyways
<madroach> I thought of an ocamlc -custom using a windows runtime.
<humasect> madroach: since it [can] goes through gcc, you can have gcc mingw cross compile tools instead
<humasect> and it will generate native win32 ocaml exes
<Smerdyakov> That's ocamlopt, though.
<madroach> Smerdyakov: pupils who have to use windows in their lessons will care :(
<Smerdyakov> madroach, those dummies. Tell them to wise up.
<humasect> he never specified opt/c
<humasect> er.
<humasect> everyone's world is different. wise up.
<madroach> thanks so far.
<Smerdyakov> They can run an X server and run OCaml elsewhere. :D
<humasect> they can probably do lots of things which are distracting to their task at hand
<Smerdyakov> Yeah, like make sure they pay for Windows licenses.
<humasect> yeap =)
<Snark> yes, setup a single unix account somewhere with a ridiculous connection and a ridiculous quota, and let the fittest survive ;-)
<Smerdyakov> Snark, we had many such UNIX machines at my undergrad school, and it worked fine....
<Smerdyakov> I'm not just goofing around. X-from-Windows is how I did most of my work as an undergrad.
<Snark> oh...
<madroach> Another question: I wrote a function calculating every permutation of a given list. It works fine for lists smaller than 9 elements. Applied to more arguments it says Stack overflow, although it should only hav a recursion depth of not more than the list length.
<madroach> Shouldn't it say heap overflow or something like that?
<vincenz> madroach: apparently you do not
<Smerdyakov> madroach, it's probably an error in your function.
<madroach> Look here:
<vincenz> STOP
<madroach> he?
<mauke> HAMMER TIME!
<madroach> It's only 11 lines
<vincenz> I don't care
<madroach> hmm
<vincenz> code in irc is unreadable
<vincenz> use paste...it's there for that
<humasect> ...
<humasect> smerdyakov: i'm mostly in cygwin - thinking of going full X on this box
<humasect> 1) unsure about opengl 2) unsure about install
<madroach> ok, I pasted it
<vincenz> the link?
<vincenz> usually you get a link
_fab has quit [Remote closed the connection]
<madroach> hmmm...
<humasect> heh
<vincenz> usually once you click paste...it should be in the addressbar
<madroach> mauke: How do you know that???
<vincenz> madroach: euhm...shouldn't you pinch off one element and then keep going?
<vincenz> somehow that looks like endless loop...
<vincenz> but I have to admit, I'm befuddled by your code
<madroach> vincenz: List.filter does the job. It works as long as the list is shorter than 9 elements.
<madroach> out of [1;2;3] it calculates [[1; 2; 3]; [1; 3; 2]; [2; 1; 3]; [2; 3; 1]; [3; 1; 2]; [3; 2; 1]]
<vincenz> hmmm
<vincenz> not quite sure of what is in that begin end block
<vincenz> why even have the begin and end?
<vincenz> it makes no sense
<madroach> I was just wondering why it tells me of stack overflow although it only needs much mem for the lists. Recursion depth is only the length of the list.
<vincenz> you tried checking how many times it's executed?
<vincenz> anyways that begin end is really .... strange
<vincenz> really strange
<madroach> I traced it in toplevel.
<vincenz> oh
<Snark> madroach: permutations are O(n!) not O(n)
<vincenz> madroach: I'm not quite sure I see the logic of your code
<vincenz> and what snark said....
<vincenz> meaning you also have O(n!) execution
<madroach> Snark: yes, the are. But this is only bad for Heap, not for Stack.
<vincenz> and typically stack is smaller than heap
<vincenz> madroach: not true...you're not tail recurisve
<vincenz> and I really fail to see the logic of your function
<madroach> vincenz: But still my recursion depth is only the list length.
<vincenz> madroach: not true...you got fold_left and inside of it map and inside of it permutations
<vincenz> but please...
<vincenz> explain to me the logic of your function
<madroach> You can try it in toplevel and trace it if you like to.
<vincenz> you ave a special case for an empty list...
<vincenz> just a strange usage of |
<madroach> because I return a list of lists.
<vincenz> well...typically you use recursion and | if each call to permutations is with smaller stuff
<mrvn> permutations of [] are []
<vincenz> madroach: explain me the logic of your function?
<vincenz> so if you have a list... you do a fold_left that does...
<vincenz> besides...the @ is also non tail recursive
* vincenz codes a new version
<madroach> vincenz: That's true...thanks.
<vincenz> I'll make one with constant depth
<vincenz> or almost
<vincenz> hmm
<mrvn> Is @ not tail recursive?
<vincenz> no
<madroach> nop
<mrvn> replace that with a tail recursive one and it should work.
<madroach> mrvn: did it, still doesn't work.
<mrvn> List.map is tail recursive, right?
<vincenz> yes
<mrvn> List.filter?
<vincenz> yes
<madroach> mrvn: filter has to handle only small lists.
<vincenz> almost done
Submarine has joined #ocaml
<mrvn> List.map isn't tail recursive
<mrvn> # permutations [1; 2; 3; 4; 5; 6; 7; 8; 9;];;
<mrvn> - : int list list =
<mrvn> [[1; 2; 3; 4; 5; 6; 7; 8; 9]; [1; 2; 3; 4; 5; 6; 7; 9; 8];
<mrvn> [1; 2; 3; 4; 5; 6; 8; 7; 9]; [1; 2; 3; 4; 5; 6; 8; 9; 7];
<mrvn> replacing append and map and it works.
<vincenz> WOO
<vincenz> I rule
<mrvn> I think with 10 elemnets it will run out of ram
<madroach> vincenz: can you post it??
<mrvn> Not yet. I'm trying myself.
vezenchio has quit ["We learn from history that we learn nothing from history"]
smkl_ has joined #ocaml
<vincenz> WOO
<vincenz> madroach: just testing
<vincenz> I have one function that given a list and a number
<vincenz> returns a list of lists with the number inserted at each point
<vincenz> then I map this to the results I have already and build incrementally
<vincenz> lemme test
<madroach> vincenz: Can you post it??
<vincenz> wait
<vincenz> last bug
<mrvn> It's faster too.
<vincenz> crap
<mrvn> I build the permutation recursively by trying each element in the list and passing a list without it down the line. When the permutation is complete it gets added to accu.
<mrvn> So no append when coming out of the recursions.
<mrvn> vincenz: how does yours look like?
<vincenz> I can go up to 8
<vincenz> then I get stack overflow
<mrvn> paste
<vincenz> let me make a tail recursive map
<vincenz> then I'll paste ;)
<mrvn> let mymap f l =
<mrvn> List.rev (List.fold_left (fun accu x -> (f x)::accu) [] l)
<vincenz> is flatten tail-recursive?
<mrvn> Anything keeping the order of the list is likely not to be tail recursive.
<vincenz> lemme make that too
<vincenz> yip got it now
<vincenz> woot
<vincenz> flatten is not tail recursive but that's alright
<vincenz> works for 9
* vincenz tries 12
<vincenz> :P
<mrvn> 10 takes 10 times as much ram as 9
<vincenz> crap
<vincenz> # permutations [1;2;3;4;5;6;7;8;9;10;11;12];;
<vincenz> Stack overflow during evaluation (looping recursion?).
<vincenz> must be the flatten
<mrvn> 11 takes 110 times, 12 takes 1320 times as much as 9
<vincenz> List.flatten
* vincenz mutters
<vincenz> fold_left is tail-recursive?
<vincenz> then I'll combine fold_left with rev_append
<madroach> Sometome I will try to understand your solutions..thanks!.
<mrvn> What does expand_list do?
<madroach> vincenz: Isn't that what I did=
<madroach> vincenz: Isn't that what I did?
<vincenz> mrvn: expand_list takes one element and a list and generates length(list)+1 lists with the element inserted at each position
<vincenz> tail recursive ;)
<vincenz> replace List.flatten by
<vincenz> List.fold_left List.rev_append []
<vincenz> I don't care about the order of the lists within the final list... and that is tail recursive
<vincenz> flatten isn't
<vincenz> wooo
<vincenz> it's going for 12 elements
<mrvn> vincenz: So you build bigger and bigger lists starting with 0 ending with |input|.
<mrvn> vincenz: That creates a lot of temporary lists.
<vincenz> yip
* vincenz shrugs
<mrvn> Still fast
<vincenz> conceptually it works
<vincenz> It's still running for 12
<vincenz> :P
<mrvn> Since 9 takes some 300MB ram 12 takes some 300Gb.
<mrvn> or half that for 32bit I guess.
<vincenz> replace List.flatten by List.fold_left List.rev_append []
<vincenz> cause the flatten creates stack overflow for 12
<vincenz> heh...
<mrvn> vincenz: Did 9 take ~5s? because then you have to wait 2 hours for 12 (given you have enough ram)
* vincenz hacks it to print a
<vincenz> mrvn: you use the flatten version?
<mrvn> no. I don't go past 9 since thats how much ram I have.
<vincenz> I mean you use the version with
<vincenz> (List.flatten ?
<mrvn> yes.
<vincenz> ah
<vincenz> seems to be much faster than the one without it
<vincenz> :/
<vincenz> it's even slow for 8 elements
<vincenz> without it
<vincenz> crap
<vincenz> yip
<vincenz> serious factor of performance diff
<mrvn> I still prefer my method. less messy code.
<vincenz> mine is not messy
<vincenz> each function is a logically different part
<mrvn> Lost of outer/inner functions
<vincenz> no need for them
<mrvn> and long
<vincenz> just make them separate functions
* vincenz shrugs
<vincenz> mrvn: you use a loop for 2 different things
<vincenz> freaky
<Smerdyakov> Talk to the French, not to the face!
<vincenz> o.O?
<vincenz> Smerdyakov: go back to weed
<mrvn> vincenz: yes. But then I only need 11 lines.
<vincenz> mrvn: I could compact mine as well
<vincenz> for instance expand_list...
<mrvn> 9 if you don't break after "in"
<vincenz> remove the inner and ensure proper callning
<vincenz> but at least like this you can take it out and use it as a separate function
<vincenz> use your map-hack
<vincenz> and I'd have the same line count
<mrvn> How could I measure time in ocaml again?
<mrvn> Wasn't there some function to get the number of seconds ocaml has been running as float?
<vincenz> no idea
<vincenz> gotta go
<vincenz> adiou
<pango> there's a Benchmark module somewhere
<mrvn> both take about 2 seconds so wallclock timing doesn't work. :(
<vincenz> mrvn: you're way off wrt memory usage
<vincenz> # List.length (permutations [1;2;3;4;5;6;7;8;9]);;
<vincenz> - : int = 362880
<vincenz> so...
<mrvn> vincenz: ; 9!
<mrvn> 362880
<mrvn> Seems right.
<vincenz> 362880 * (2 pointers + list of 10 elements)
<vincenz> != 300 MB
<mrvn> vincenz: lists are "header, element, next pointer" right?
<vincenz> euhm
<vincenz> no idea
<vincenz> ask an ocaml expert
<pango> question is, how much of the lists are shared
<vincenz> pango: nada
<vincenz> besides I remember reading somewhere the maximal sharing would be about O(N) which nowhere compares to O(n!)
<mrvn> ; 9! * (24 + 9 * 24) / 1024 / 1024
<mrvn> 83.056640625
<mrvn> That makes 83Mb for the endresult.
<mrvn> vincenz: you never share.
<vincenz> I know
<vincenz> hence me saying "nada"
<vincenz> anyways
<vincenz> gotta run
<mrvn> I do share some. hmmm.
<vincenz> bbl
<mrvn> # let start = Gc.allocated_bytes () in let res = permutations [1;2;3;4;5;6;7;8;9;] in print_float ((Gc.allocated_bytes ()) -. start);;
<mrvn> 79021192.- : unit = ()
<mrvn> Thats vincents version. mine is: 67893712.- : unit = ()
<mrvn> So some minor sharing. :)
smimou has joined #ocaml
Godeke has quit [Remote closed the connection]
mrvn_ has joined #ocaml
<madroach> Thanks for your interrest!!!! See you!
madroach has quit ["leaving"]
zzorn has quit [Read error: 60 (Operation timed out)]
swaplinker has joined #ocaml
<swaplinker> hello
<swaplinker> i've a problem with ocamlopt
<swaplinker> it apparently doesn't want to link more than 11 files together to make an executable
<swaplinker> ocamlopt -o helloworld.exe -I +sdl -I +lablGL lablgl.cmxa sdl.cmxa sdlttf.cmxa bigarray.cmxa sdlloader.cmxa global.cmx events.cmx scene.cmx camera.cmx tex.cmx interface.cmx caca.cmx
<swaplinker> gcc: @C:/DOCUME~1/julian/LOCALS~1/Temp\camlresp6bbf08: Invalid argument
<swaplinker> Error during linking
Godeke has joined #ocaml
<mattam> may windows doesn't let you use more than n chars in a command ?
<swaplinker> i'm using mingw && msys
<swaplinker> so i put compilations commands in a rvxt console
<mattam> hmm, i have no idea then :)
<swaplinker> it's very strange
<swaplinker> probably nobody here already have linked more than 11 files :)
pango has quit ["Leaving"]
mrvn has quit [Read error: 110 (Connection timed out)]
<vincenz> re
<vincenz> WOOO
<vincenz> the new icfp site is up
<vincenz> sponsored by plt-scheme
humasect has quit [Read error: 104 (Connection reset by peer)]
* vincenz starts rallying together a team
humasect has joined #ocaml
<det> This year's competition rewards programmers who can plan ahead. As before, we'll announce a problem and give you three days to solve it. Two weeks later, we'll announce a change to the problem specification and give you one day to adapt your program to the new spec. And you guessed it: the second half will be worth considerably more than the first.
<mauke> huhu
Yorick has joined #ocaml
<vincenz> WOOOOHOOO
<vincenz> I'm so excited
* vincenz bounces around like a rotten egg
* Yorick feels like a catalyst
pango has joined #ocaml
<mrvn_> vincenz: url
<mrvn_> an ocaml team?
<vincenz> sounds good
<vincenz> and you know why?
<vincenz> 2 years ago I did it in scheme, that went ok except our team fell apart
<vincenz> last year I did it in C++
<vincenz> development was so slow that durng one night
<vincenz> most were gone
<vincenz> I built the simulator in ocaml
<vincenz> and patched C++ interfaces
<vincenz> :P
<vincenz> each time the setup was my box = public cvs
<vincenz> my only issue with ocaml: gui
<mrvn_> lablgtk?
<det> vincenz, you mean for ICFP?
<det> vincenz, or in general?
<mrvn_> I hope ICFP doesn't need a big gui
<vincenz> det: ICFP
<vincenz> mrvn_: I've found that gui's help a lot
<vincenz> mrvn_: last year to see the ants, the year before to see the car
<vincenz> typicall guis are good
<det> well
<det> LablGL seems ideal for visualization of past ICFP problems
<vincenz> I just wish there was something built into ocaml
<vincenz> that uses native windowing
<mrvn_> I wish I could use the labl* stuff better
<vincenz> so you don't need to compile extra libs
<det> vincenz, who cares about anything other than GTK :)
<vincenz> ugh
<vincenz> got a tutorial?
<mrvn_> vincenz: I wrote some simmple gui stuff for Graphics. But without right/left mouse clicks it sucks.
<vincenz> yah
<mrvn_> The mouse events hsould have "int button;"
<vincenz> well I loved drscheme's gui-oo classes
<det> ocamlsdl does input handling
<vincenz> just hook in the right closuers
<vincenz> and you're set
<vincenz> SO lovely
<mrvn_> Anyone used the gtk gui generator with ocaml?
<det> What is it called?
<det> Does O'caml support Glade?
<mrvn_> ocaml-zoggy - OCaml LablGTK interface builder
<Submarine> I think OLabl supports glade.
<Submarine> lablgtk I mean
_JusSx_ has joined #ocaml
<mrvn_> not lablgl?
<det> labgl = OpenGL, lablgtk = GTK, Glade is a GTK thing
<palomer> glade rocks
cognominal has quit [Read error: 54 (Connection reset by peer)]
cognominal has joined #ocaml
monochrom has joined #ocaml
grirgz has joined #ocaml
<grirgz> hi
<grirgz> what is the difference between virtual classes and class types ?
Snark has quit ["Leaving"]
<grirgz> and what is a virtual class type ? :p
Submarine has quit ["Leaving"]
smkl_ has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
cognominal has quit [Read error: 60 (Operation timed out)]
cognominal has joined #ocaml
Yorick has left #ocaml []
psnively has joined #ocaml
<psnively> Afternoon, everyone.
smkl_ has joined #ocaml
<psnively> Yo.
<psnively> Testing, 1, 2, 3...
Msandin has left #ocaml []
psnively has quit []
CosmicRay has quit ["Client exiting"]
cjohnson has joined #ocaml
smkl_ has quit [Read error: 110 (Connection timed out)]
shawn_ has joined #ocaml
smimou has quit ["?"]
humasect has quit ["Leaving.."]
vodka-goo has joined #ocaml
_shawn has quit [Connection timed out]
_JusSx_ has quit ["leaving"]
ntk has joined #ocaml