dark_light changed the topic of #ocaml to: OCaml 3.09.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/
<Shimei> buluca: I just started reading it. So far my impression is that it's a good, informative book, but not like Shakespeare in code.
<buluca> Shimei: :) I'm reading "Developing applications with Objective Caml"
<buluca> I know it's a bit old
<Shimei> Ah, that's the ebook on the inria site right? I read a tiny bit of it.
<Shimei> Trouble is, I can't concentrate on reading on-screen texts. I have to have my thick, bound paper copies. :P
<buluca> yes
<buluca> I too, wish to print it
<buluca> are there some on-demand printing service (in italy!)? :)
<Ugarte> Kinkos? :P
m3ga has joined #ocaml
m3ga has left #ocaml []
<buluca> it seems that such a service doesn't exist in italy... there are only print-on-demand services for authors and editors...
protoscript has joined #ocaml
<Smerdyakov> CPS is the MAN.
erikh has left #ocaml []
<buluca> what's CPS?
chessguy has joined #ocaml
Pupeno has joined #ocaml
<Pupeno> Hello.
<Pupeno> What license is OCaml released under these days ?
<Pupeno> Thank you.
Pupeno has left #ocaml []
bmiller has quit []
sponge45 has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
danly_ has joined #ocaml
chessguy has joined #ocaml
danly_ has quit [Remote closed the connection]
delamarche has joined #ocaml
danly_ has joined #ocaml
Smerdyakov has quit [Remote closed the connection]
Smerdyakov has joined #ocaml
chessguy has quit [" Like VS.net's GUI? Then try HydraIRC -> http://www.hydrairc.com <-"]
piggybox has joined #ocaml
danly_ has quit ["Leaving"]
danly_ has joined #ocaml
Slack4020 has joined #ocaml
danly_ has quit ["Leaving"]
Smerdyakov has quit ["Leaving"]
pango_ has joined #ocaml
<Slack4020> i think i know ocaml fairly well now
<Slack4020> i like the language alot onnly thing i ddint like is the learning curve
<Mr_Awesome> Slack4020: agreed
<Slack4020> Mr_Awesome: but yea i like this language better then c++
<Mr_Awesome> me too
<Slack4020> Erlang looks cool
<Slack4020> i think i will try the old pascal sometime too it looks like it has some life itno it :maybe"
<Mr_Awesome> Slack4020: ive been meaning to look at erlang too, but pascal?
<Slack4020> yea
<Slack4020> pascal ?
<Slack4020> FreePascal
<Slack4020> Clean looks cool too
<Mr_Awesome> id stay away from pascal
Mr_Awesome has quit ["...and the Awesome level drops"]
pango has quit [Remote closed the connection]
<levi_home> If you're going to do a Wirth language, at least do Modula or Oberon or something.
sponge45 has quit ["zzzzzzzzzz"]
gene9 has joined #ocaml
gene9 has quit ["Client Exiting"]
<Slack4020> is there any other langauges like ocaml ?
<Slack4020> like can be compiled byte code etc
<Slack4020> and are fairly good to work in
<Shimei> SML maybe?
<Slack4020> SML?
<Slack4020> they dont have to be ML
<Shimei> Haskell perhaps.
<Shimei> Or Concurrent Clean.
<Slack4020> dont have to be functional
<flux__> can't see how it would be like ocaml then :)
love-pingoo has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
ikaros has quit [Read error: 60 (Operation timed out)]
l_a_m has joined #ocaml
ikaros has joined #ocaml
delamarche has quit []
kral has joined #ocaml
pango_ has quit [Remote closed the connection]
jajs has joined #ocaml
pango has joined #ocaml
Skal has joined #ocaml
Demitar_ has joined #ocaml
love-pingoo has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
swater has joined #ocaml
slipstream has quit [Read error: 54 (Connection reset by peer)]
slipstream has joined #ocaml
gene9 has joined #ocaml
Skal has quit [Read error: 104 (Connection reset by peer)]
Skal has joined #ocaml
Skal has quit [Remote closed the connection]
Skal has joined #ocaml
Skal has quit [Remote closed the connection]
Skal has joined #ocaml
MisterC has joined #ocaml
Skal has quit [Read error: 60 (Operation timed out)]
jajs has quit [Remote closed the connection]
ppsmimou has quit ["Leaving"]
ppsmimou has joined #ocaml
gene9 has quit [Remote closed the connection]
_fab has joined #ocaml
fab_ has joined #ocaml
_fab has quit [Client Quit]
dark_light has quit ["Ex-Chat"]
buluca has quit [Read error: 104 (Connection reset by peer)]
Leonidas has joined #ocaml
tld has quit [Remote closed the connection]
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
buluca has joined #ocaml
chessguy has joined #ocaml
love-pingoo has quit ["Leaving"]
chessguy has quit [" Want to be different? HydraIRC -> http://www.hydrairc.com <-"]
Smerdyakov has joined #ocaml
<flux__> (an interview/demo video involving directx)
unfo- has joined #ocaml
Sweetshark has joined #ocaml
fab_ has quit [Remote closed the connection]
bmiller has joined #ocaml
Aradorn has joined #ocaml
Sweetsha1k has quit [Read error: 110 (Connection timed out)]
<unfo-> I would appreciate if someone could take a look at this pastie: http://pastie.caboo.se/21027 and give me some pointers. Pointers I'm looking for: how to get it working and what to read up on next so I could've figured it out myself.
<pango> unfo-: compiles fine for me
<unfo-> errrh. what the hell then
<unfo-> The Objective Caml toplevel, version 3.09.1
<unfo-> pango, which ver do you have?
<pango> same here
* unfo- blinks
<unfo-> normally this is the place where I would use an internet acronym to display my dismay towards not understanding the situation
<pango> $ ocamlc -i paste-21027.ml
<pango> type position = { x : int; y : int; }
<pango> val num_routes : position -> position -> int
<pango> val start : position
<pango> val stop : position
<unfo-> errrh
<unfo-> I downloaded that paste and it works
<unfo-> aslkdhaskjdhas!!!!!!
<unfo-> What the hell! I pasted that code directly from my editor
<unfo-> now it works
<unfo-> pango, thanks for your time :)
<pango> np ;)
<unfo-> lessee how long traversing the entire 20x20 grid takes
<pango> most of the parenthesis are actually useless, but it's no biggie
<unfo-> oh? like the ones between if ... then ?
<pango> actually num_routes compiles without any parenthesis
<unfo-> oh cool :)
<pango> I'd left the ones in (num_routes bottom max_pos) + (num_routes right max_pos) for readability, however
<unfo-> okay. thanks for the input :)
<unfo-> but yeah... my code definitely fails... Project Euler <http://www.mathschallenge.net/index.php?section=project> from where I get these small maths quizzes has a strict One Minute Rule... and this has gone for quite a while now ;)
<unfo-> => I'm not doing the right thing
<unfo-> well usually brute force is not the answer
<pango> you could also have one_right : position -> position and one_down : position -> position function to factorize all those records manipulations
bohanlon_ has quit [Read error: 60 (Operation timed out)]
<unfo-> right. lemme do that :)
<pango> then have (num_routes (one_down start_pos) max_pos) + (num_routes (one_right start_pos) max_pos), etc.
<unfo-> should I define 'let one_right..' within num_routes or outside it?
<pango> as you wish... I you think it could be handy later, you can define it outside the function
<unfo-> okay
<unfo-> it's cleaner now, but still it's a brute force attack, when prolly a much simpler algorithm will do :)
<pango> well, there's obviously better solutions that plain brute force ;)
<unfo-> aye
<pango> you'll can num_routes many times with the same parameters... and since it's a function (in the mathematical sense) you'll just get the same result...
dbueno has quit [Remote closed the connection]
<unfo-> I don't follow your point
<pango> you'll call num_routes { 3, 4 } { 20, 20 } as many times as there's different paths from { 0, 0 } to { 20, 20 }
<pango> you'll call num_routes { 3, 4 } { 20, 20 } as many times as there's different paths from { 0, 0 } to { 3, 4 } sorry
<unfo-> so you're getting at that I am re-calculating complex things in vain
<unfo-> oh and I just realized, that at the start, I need to only go from 0,0 to 1,0 or 0,1 and continue from there, since the path's are mirrored
<pango> yes... So, as a "stop gap" measure, you could store all values of num_routes already computed, and skip recomputing the same value if the same parameters are used again... That's called "memoizing" the function
<pango> yes, you can also take advantage of symetries
<unfo-> okay, so I should start from the end and move backwards sort of
<unfo-> Yeah!
<unfo-> I just modelled that approach on a piece of paper with 2x2 and a 3x3 grid
<unfo-> it works like a charm, thanks pango!
<pango> indeed that's a good way to avoid duplicate efforts
<unfo-> does a Hash table take any kind of 'type' as its key?
<pango> by default it uses a "universal" hashing function privided by OCaml... I don't think there's much restrictions on what it can hash
<unfo-> so I can do: Hashtbl.replace routes {19,20} 1;;
<pango> that should work fine
<unfo-> okay :)
<unfo-> thanks mate
<pango> np
<unfo-> and now I figured out how to do the algo, coz I know that on if x=20 then with all y num_routes = 1 and vice versa with y=20
chessguy has joined #ocaml
<pango> last step is to find the mathematical formula for the result ;)
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Go on, try it!"]
<unfo-> btw. is there any convenience way to get like : myhash['somekeyhere'] or do I always need to provide an iterator function?
kral has quit [Remote closed the connection]
<pango> what do you call iterator function here ?
<unfo-> http://pleac.sourceforge.net/pleac_ocaml/hashes.html <- looking at that page currently
MisterC has quit [Read error: 54 (Connection reset by peer)]
<pango> the only functions I'd call iterators are Hashtbl.iter or Hashtbl.fold
<pango> if the question is just "is there a nice syntax for hash tables like in Perl", then the answer is no
<pango> you could probably create your own using camlp4, though
<pango> (I think there's also a trick somewhere to reuse .{} notation that's normally used by bigarrays... but that's a hack :) )
<unfo-> ok. I'd rather do this the OCaml way :)
<unfo-> I just wanted to know, in case I was reinventing the wheel with my own convenience fun :)
<pango> it works because .{} is hardcoded syntactic sugar for Bigarray.Array1.get and set
<unfo-> Hashtbl.find ... hmmm
<pango> the same way .[] is syntactic sugar for String.[gs]et and .() for Array.[gs]et
<unfo-> that's what I was looking for :D
<unfo-> thanks pango
<pango> that was the 10 minutes "don't do this at home" hack chronicle :)
<unfo-> yeah, not using yer hack. Using Hashtbl.find + Hashtbl.replace
<unfo-> I just didn't know of Hashtbl.find :)
<pango> yes... just watch out for Not_found exceptions if the key doesn't exist
<unfo-> *nod*
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
<unfo-> look at the time fly! I need to catch a bus in abt 10mins :)
<unfo-> I'm so close with this algo I can feel it :)
<unfo-> pango, again, thanks for your pointers and help :)
<unfo-> bye bye
<pango> bye!
<unfo-> (this client will stay online, but I'll be afk, just in case you were wondering ;)
<ikaros> how can i avoid this error: http://nopaste.tshw.de/11625771119bed0/ (error shown in code)
<ikaros> i think i have to define that alome is of type string list not 'a list but i dont know how..
<pango> if you compare List.hd alome with [], then alome is a list of list
<pango> # List.hd ;;
<pango> - : 'a list -> 'a = <fun>
<ikaros> oh yea.. ;)
<ikaros> just alome=[]
<ikaros> silly..
<pango> you can add a type annotation... let rec build_menu (alome: string list) ...
<ikaros> yea tried that.. but my List.hd alome = [] was still wrong.. obviously.. hehe
jajs has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
smimou has joined #ocaml
chessguy has joined #ocaml
Demitar_ has quit ["Ex-Chat"]
Demitar has joined #ocaml
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
jajs has quit [Remote closed the connection]
jajs has joined #ocaml
swater_ has joined #ocaml
swater has quit [Read error: 110 (Connection timed out)]
jajs has quit [Remote closed the connection]
Aradorn has quit ["Leaving"]
malc_ has joined #ocaml
jajs has joined #ocaml
menace has joined #ocaml
Skal has joined #ocaml
bmiller has quit []
beschmi has joined #ocaml
chessguy has quit [Read error: 110 (Connection timed out)]
ita has joined #ocaml
jajs has quit [Remote closed the connection]
chessguy has joined #ocaml
jajs has joined #ocaml
mattam has quit [Read error: 60 (Operation timed out)]
swater_ has quit ["Quat"]
chessguy has quit [" Try HydraIRC -> http://www.hydrairc.com <-"]