systems changed the topic of #ocaml to: Archive of Caml Weekly News http://pauillac.inria.fr/~aschmitt/cwn/ | ICFP Programming Contest 2003 http://www.dtek.chalmers.se/groups/icfpcontest/ | A tutorial http://merjis.com/richj/computers/ocaml/tutorial/ | Good free book http://cristal.inria.fr/~remy/cours/appsem/ | Mailing list (best mailing list ever for any computer language) http://caml.inria.fr/bin/wilma/caml-list
mattam has joined #ocaml
Nate1975 has quit [Remote closed the connection]
Nate75Sanders has quit [Remote closed the connection]
mattam_ has quit [Read error: 110 (Connection timed out)]
jdrake has quit ["Oops. This machine just fell asleep"]
jdrake has joined #ocaml
<jdrake> is there any way of testing membership in a tuple? such as whether or not 'a' is in a given tuple
foxster has joined #ocaml
foxster has quit [Client Quit]
foxster has joined #ocaml
Kinners has joined #ocaml
foxster has quit [Client Quit]
jdrake_ has joined #ocaml
jdrake has quit ["HOLY UPGRADE BATMAN!"]
jdrake_ is now known as jdrake
Kinners has left #ocaml []
<jdrake> anybody alive?
* brwill looks around
<jdrake> was missing a 'with' on the try
<jdrake> how does printf work with unlimited parameters? (and does it still remain safe?)
<vect> humpf
<vect> justed coded a dumb piece of ocaml :)
<Maddas> haha
<Maddas> somehow I get the feeling that I can't get further than coding dumb ocaml :]
<brwill> jdrake: i see no reason why num of params would matter
<jdrake> i come from evil C
<Maddas> ok, not THAT dumb!
<Maddas> jdrake: there's something special about printf
<Maddas> Ugh, let me see if I can find the text describing it. It processes the first argument in a very special way, IIRC
<brwill> vect: what window manager are you using?
<vect> brwill, fluxbox
<jdrake> i just ran out of stack
* jdrake forgets how to fix that
<brwill> vect: really? very minimalist setup
<Maddas> jdrake: http://caml.inria.fr/ocaml/htmlman/libref/Printf.html I think it's something in there
* brwill runs fluxbox as well
<jdrake> does ocaml install that doc set on local?
<Maddas> Yes, I think so.
<Maddas> locate Printf.html :)
<vect> brwill yes, I like it.. I don't need bigs WM's .. fluxbox is ok for me : key binding, that's all I need
* brwill nods at vect
<brwill> jdrake: in terms of docs-- from what I can see, the gentoo ebuild (at least) installs a huge set of man files
<Maddas> hm
<Maddas> You might want to try pekwm, I really like it (used to use fluxbox)
<Maddas> It allows more flexible keybinding support (keychains) :)
* vect writes "p-e-k-w-m" on a post-it.
<Maddas> Heh, I stopped using post-its because I always forget reading them.
<jdrake> could anyone look at my first ocaml program? http://darwinports.gene-hacker.net:8080/98
<jdrake> it always overflows on stack
<jdrake> it looks like it should work...
<Maddas> Hm. Just as a note, do you know about #trace?
<Maddas> Might help while debugging
<jdrake> can't say I do
<Maddas> in toplevel, #trace function
<Maddas> will print whenever function is called (and when it returns, IIRC)
<Maddas> Do you know where about you get the overflow?
<jdrake> i only have one recursion, and that is probably it
<jdrake> but no idea in particular
<Maddas> Which recursion is that?
* brwill reminds himself to get syntax highlighting working for ocaml on his codepaste site
<jdrake> let rec operate channel =
<Maddas> ah, ok.
<Maddas> That's not tail recursive, might that be the problem?
<Maddas> (or is it just not 'tail call optimised'? I'm not sure about terms)
<jdrake> i really have only done a few recursive things in my life time
<Maddas> Heh.
<Maddas> I did more recursive things in o'caml than in all other languages together. (OK, except Scheme)
<jdrake> its been at least 2 years
<Maddas> And I hardly coded *ANYTHING* in O'Caml :)
<jdrake> so the question now is- how does one make something tail recursive
<Maddas> When do you get the overflow?
<Maddas> After starting or after running it for a while?
<jdrake> a while
<jdrake> 3mb stack
<Maddas> That might be the problem
<Maddas> jdrake: it's normally automatically tail recursive if the recursive call is the last call executed
<Maddas> and returned
<Maddas> BUT, not if there is a try .. with block around it
<Maddas> which is somewhat of a catch
<Maddas> So maybe you can move the try ... with block out of the function
<Maddas> Or move it somehow :-0
<jdrake> i can put it down around the Array.iter below
<jdrake> how does the code look btw
<Maddas> I don't know enough to judge it, sorry
<Maddas> but the last expression in "let file =" seems a bit unrelated :)
<jdrake> what do you mean unrelated?
<Maddas> Well, I don't know if it's good to add it there
<jdrake> where else would I do it
<Maddas> I don't know, I just wondered!
<Maddas> It seems not to be related to the function file itself, as in, it doesn't do anything which one would expect file to do
<Maddas> err, s/function file/function/ # sorry
<jdrake> that is just where I am loading up the datafile
<Maddas> I see.
<Maddas> I should stop confusing you, I don't know much myself.
<Maddas> Sorry :)
<jdrake> shit
<jdrake> i just noticed something
<Maddas> Tell me if it works when you move the try .. with outside of the let rec operator
<jdrake> let file = open_in (Sys.argv).(0) in notice anything wrong with that?
<Maddas> yes, you want Sys.argv.(1)
<Maddas> Hah! :)
<Maddas> (Or don't you?)
<jdrake> yes :-)
<Maddas> I fell for that one myself already ;)
<jdrake> is .ml the normal extension for files?
<Maddas> I guess, yes
<Maddas> jdrake: I think you can do it even easier than moving the try ... with away
<jdrake> it works now :-)
<Maddas> ok :)
<Maddas> You could just do let operator = let rec operator = (...) in try operator with End_of_file -> ();; I think
<jdrake> want to see the original python :-?
<Maddas> No thanks, I'm more of a Perl guy ;)
<Maddas> I'll be back in a bit (an hour or so), but I'll pop in occasionally
<jdrake> why does #haskell have more persons than #ocaml?
<Maddas> No idea!
<Maddas> And I'm sure other people will be around, just ask if you have a question
<jdrake> i best be sleeping :-)
<Maddas> jdrake: maybe because Haskell is more widely used? I don't know :)
<jdrake> i will be working more tomorrow afternoon after work
<jdrake> haskell looks more obfuscated than ocaml :-0
<Maddas> Ok, good night then, wherever you are
<jdrake> almost like perl
<Maddas> Shush, Perl isn't obfuscated
<Maddas> :)
<vect> jdrake because haslell community is not as serious as the ocaml's one :)
<jdrake> vect, making sense itn't
<vect> s/haslell/haskell
<Maddas> That might be it, people using O'Caml generally seem pretty all-knowing
<Maddas> or doctors or something :)
<Maddas> So I told myself, maybe *I* will become more serious too, when I use O'Caml ;-)
<vect> hehe
<jdrake> a problem...
<jdrake> oops
<jdrake> an oversight again
<jdrake> it looks like ocaml docs were not installed
<jdrake> now they be, and program works nicely
<jdrake> and I bid everybody a good night
jdrake has quit ["Oops. This machine just fell asleep"]
<vect> foo@void:~/code/ocaml/graphics$ wc -l dumbpaint.ml
<vect> 21 dumbpaint.ml
<vect> O'Caml->Graphics() rocks.
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
jdmarshall has quit [Read error: 60 (Operation timed out)]
__buggs is now known as buggs
buggs is now known as buggs|afk
vect has left #ocaml []
vect has joined #ocaml
_DL_ has joined #ocaml
_DL_ has quit [Read error: 104 (Connection reset by peer)]
__DL__ has quit ["Bye Bye"]
brwill is now known as brwill_zzz
two-face has joined #ocaml
<two-face> gra
Nate1975 has joined #ocaml
Nate1975 has quit ["using sirc version 2.211+KSIRC/1.2.4"]
two-face has left #ocaml []
polin8 has quit [Read error: 104 (Connection reset by peer)]
TimFreeman has joined #ocaml
two-face has joined #ocaml
two-face has left #ocaml []
polin8 has joined #ocaml
TimFreeman has left #ocaml []
croesus has joined #ocaml
atom-z has joined #ocaml
<Maddas> Does O'Caml have lvlaues?
<smkl> Maddas: there is the 'a ref datatype
<Maddas> Ah, I see
<Maddas> You'd just return a reference and work with that one?
<Maddas> Silly question.
<smkl> objects and records can have mutable fields
<smkl> there is no way to make a reference to those fields, though ... so the fields would have to be refs too
<Maddas> Ok :)
systems has joined #ocaml
brwill_zzz is now known as brwill
systems has quit [Read error: 60 (Operation timed out)]
Riastradh has quit [Read error: 110 (Connection timed out)]
mellum has quit ["ircII EPIC4-1.1.11 -- Are we there yet?"]
buggs|afk is now known as buggs
bk_ has joined #ocaml
Riastradh has joined #ocaml
croesus has left #ocaml []
jdrake has joined #ocaml
Xcalibor has joined #ocaml
atom-z has quit [zelazny.freenode.net irc.freenode.net]
mattam has quit [zelazny.freenode.net irc.freenode.net]
atom-z has joined #ocaml
mattam has joined #ocaml
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
buggs has quit [Read error: 60 (Operation timed out)]
buggs has joined #ocaml
bk_ has quit ["I'll be back"]
Xcalibor has quit ["Terminando cliente"]
<atom-z> if i declare a local variable with let whatever=X in ..., how can i change the value of whatever once its been set?
<Riastradh> You don't.
<brwill> heh.
<brwill> and there we have it, in a nutshell.
<atom-z> can i redefine it with another let?
<brwill> # let foo = ref 1;;
<brwill> val foo : int ref = {contents = 1}
<brwill> # foo := 2;;
<brwill> - : unit = ()
<brwill> # foo;;
<Riastradh> Yes, but that's going to be 'shadowing' it, which is different.
<brwill> - : int ref = {contents = 2}
<brwill> if you must.
<Riastradh> Note that refs have nothing to do with variables; they are mutable _values_.
* brwill nods
<atom-z> i havent got to refs in my tutorial yet
<mattam> shadowing is what you want atom-z
<atom-z> ok
foxster has joined #ocaml
<jdrake> atom-z, are you coming from another language?
<atom-z> many
<atom-z> python,C,C++
<jdrake> what do you think so far
<atom-z> interesting language
<atom-z> v.good for maths stuff
<atom-z> i liked being able to do:-
<atom-z> let a R = pi * R ** 2
<atom-z> ;;
<mattam> you don't need the ;; usually atom-z
<jdrake> currying is cool
<Maddas> yeah, it is jdrake
<mattam> unless in ocaml read-eval-print loop
<jdrake> some things to show you guys...
<jdrake> sort of a before and after code
<jdrake> after:http://darwinports.gene-hacker.net:8080/101
<jdrake> note that the after code has just one hiccup
<jdrake> i don't know how to get the list back at the end :-)
<Maddas> jdrake: I decided to implement something like that too =)
<Maddas> Because it's easy and small, and I need practice
<jdrake> i have a starting python program
<jdrake> want to see that horrid thing?
<jdrake> (its not the best done)
<Maddas> Heh, I don't know any Python
<Maddas> So I doubt it'll help me much :-)
<jdrake> its easy to read to see how shitty it is
<Maddas> heh
<Maddas> well, I'll have a look at it if that makes you happy :)
<mattam> jdrake: mutable fields are set using <- :)
<jdrake> mattam, i forgot to change it from mutable
<jdrake> don't need it mutable in the after
<Maddas> Looks like the Python version could be written a bit tighter ;)
<jdrake> you could say that
<jdrake> that is a good reason why I need some ocaml
<Maddas> He.
<Maddas> Heh, even
<Maddas> Hm. Is it possible to automatically loop through all values a type can have?
<mattam> like what ?
<Maddas> Hm, wait, maybe I'm not making much sense.
<Maddas> e.g. type foo = Bar | Baz;; Then 'loop' through the values Bar and Baz (Is that pointless?) with some construct
<mattam> is it pointless
<Maddas> Ok :)
<mattam> but you can make a [Bar; Baz] list if you like
<Maddas> I think I'll still have to work on understanding the type/constructor difference.
<Maddas> mattam: I'd like to auto-generate such a list.
<mattam> for what purpose ?
<Maddas> So that if I change the type declaration, the list will not need to be updated 'manually'
<Maddas> It's just an itch I'd like to scratch.
<Maddas> Hm, wait.
<Maddas> This probably wouldn't work out the way I'm thinking anyway.
<Maddas> Never mind then :-)
<mattam> you can't, except for parsing ocaml sources
<Maddas> Ok
<Maddas> I think my "picture" of types is still flawed anyway.
<Maddas> I basically use them more like a C(++)-style ENUM ;)
<Maddas> just to make things a bit readable, that is. I don't really use "advanced" pattern matching for anything yet
atom-z has quit ["Client Exiting"]
mrvn_ has quit [Read error: 110 (Connection timed out)]