systems changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn , A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ , A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
Defcon7 has quit [Read error: 60 (Operation timed out)]
Defcon7 has joined #ocaml
mimosa has quit [Remote closed the connection]
tyler has joined #ocaml
<tyler> Are O'caml lists implemented as singly linked lists?
<Smerdyakov> Yes.
<tyler> It seems that way, as List.nth l n seems to be proportional to n....
<Riastradh> It is.
<Smerdyakov> Lists are not an especially privileged type.
<Smerdyakov> They are defined with the 'type' keyword like anything else.
<Riastradh> If you want constant-time indexing, use an array.
skylan has quit ["."]
<Smerdyakov> So the definition tells you how it works.
<tyler> ahh...
* tyler is slowly getting the hang of O'Caml....
<tyler> sorta ;)
skylan has joined #ocaml
<Smerdyakov> Goodgood.
<tyler> I figure the rewards are worth the pain...
<tyler> In the sense that it's a decent language to work with (no memory managment...) while being high-performance as well
<Smerdyakov> Certainly. You'll never go back again if you learn the basics.
<Smerdyakov> I'd go further than "decent language"! :D
<tyler> My languages of choice currently are python and ruby
<tyler> Smerdyakov: All languages suck. Some just suck less...
<mattam> you'll love static typing i can tell you
<tyler> mattam: heh...
<tyler> mattam: well, I do C as well when I must...
<tyler> so I know that road...
<Riastradh> C's static typing is a joke.
<tyler> Riastradh: yep...
<mattam> you'll miss the fun reflection/dynamic stuff a little, but that's not so bad.
<tyler> mattam: yep.
<tyler> mattam: But then, I think OOP is overrated ;)
<tyler> not useless mind you, but overrated...
Nutssh has quit ["Client exiting"]
<mattam> we couldn't agree more :)
<tyler> Java gets it worst of all...
* tyler tries to repress the memories...
<tyler> ruby does it right...
* tyler hasn't gotten to O'Camls OO stuff yet
* tyler is in chapter 6 of the merjis.com tutorial
* Riastradh coughs 'multiple dispatch' at tyler.
<tyler> multiple dispatch?
* tyler never bothered to really dig in to OO theory...
<mattam> dispatch (select method) based on more than one argument (the object the method is called on usually). Is that right Riastradh ?
<Riastradh> Yes.
* mattam has good rests of reading the UW cecil report
mattam has quit [Read error: 60 (Operation timed out)]
mattam has joined #ocaml
Bakka has quit ["changing servers"]
mattam_ has joined #ocaml
mattam has quit [Read error: 60 (Operation timed out)]
<tyler> is there any sort of 'automake' for ocaml? That is, something that can scan a source file and generate the proper ocamlc / ocamlopt command line to build the binary, together with the right librarys, etc?
<Smerdyakov> There is a standard Makefile from someone or other affiliated with the OCaml project, where you just need to enter filenames.
<tyler> I mean, it's not a *huge* deal
<tyler> as 'open Foo' usually means just add /usr/lib/ocaml/3.07/foo.cmxa to the ocamlopt command.....
<Smerdyakov> You don't need to use 'open' to use libraries.
<tyler> right....
<Smerdyakov> It's entirely a syntactic convenience.
* tyler thinks it's cool that ocaml includes a drawling library :)
<tyler> brings back fond memories of hacking graphics in qbasic years ago...
Nutssh has joined #ocaml
* tyler bangs head on desk
<tyler> error on line 4
<tyler> says it's applying function to too many arguments
<tyler> I don't see the problem
<Riastradh> Parenthesizing the line fully with OCaml's precedences, you get:
<Riastradh> (Graphics.set_color (Graphics.rgb) (x y 0))
<Riastradh> That applies set_color to two arguments, Graphics.rgb and the result of applying x to y and 0; what you likely meant to write was:
<Riastradh> Graphics.set_color (Graphics.rgb x y 0)
<tyler> ahh
<tyler> yup
<tyler> thanks
mattam_ has quit [Read error: 110 (Connection timed out)]
<tyler> Anyone in here familiar with the Complex module?
<tyler> I've read the doc, but I can't figure out how to CREATE one...
<tyler> doh...
* tyler realises he just uses the type....
mattam has joined #ocaml
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
<tyler> wicked!
* tyler just wrote a mandlebrot viewer in about an hour and a half....
kinners has joined #ocaml
<tyler> hrrm
<tyler> I'm getting an 'Unbound record field' in the following snippet, on the second line:
<tyler> let s = Graphics.wait_next_event [Graphics.Poll] in
<tyler> if s.button
<tyler> it complains about s.button
<kinners>
<tyler> but Graphics.wait_next_event returns a 'status' type, and that is one of the records of that type...
<tyler> whole prog is at http://tylere.com/mandel.ml
<kinners> tyler: you have to use the full record identifer, s.Graphics.button
<tyler> ahh
<tyler> *sigh*
<kinners> or just do a open Graphics
<tyler> now I can't get fst to cooperate....
<tyler> This expression has type 'a * 'b -> 'a but is here used with type float
<tyler> on line 36 of mandel.ml
<Smerdyakov> Probably missing parens
<tyler> yup....
<kinners> yeah, (fst pos), not fst(pos)
<tyler> almost done
<tyler> now it gets to line 43 before it barfs....
<tyler> darkstar% ocamlopt /usr/local/lib/ocaml/graphics.cmxa mandel.ml -o mandel
<tyler> File "mandel.ml", line 43, characters 0-11:
<tyler> err...
<tyler> This expression has type float -> float -> float -> unit
<tyler> but is here used with type int
<tyler> That's the one thing that annoys me about O'Caml...
<tyler> the error messages could be a tad more helpful...
<kinners> put brackets around the negative numbers
<kinners> s/bracket/parens
<tyler> oh, so binary - must have precedences over unary -
<kinners> yeah it sees, foo - bar, ok that is a integer subtraction, but foo has type float -> float instead of int
<kinners> the parens make it parse it as a complete floating point number
Nutssh has quit ["Client exiting"]
<tyler> gotcha
<tyler> woohoo, it's actually working now
<tyler> It's no Xaos, but hey....
<tyler> it's kinda neat ;)
<tyler> and I'm impressed I was able to do it in about 3 hours
<tyler> considering I just started learning the language 2 days ago
<tyler> and this was my first app of more than 10 lines...
<kinners> congrats :)
<tyler> final source is at http://tylere.com/mandel.ml
<tyler> run it with a single int arg that determines the size of the graphics window
<tyler> click on the window (you might have to hold the button down a split second) and it zooms in where hte pointer is
<kinners> loading camlp4o.cma in the toplevel will give you better error messages in some cases
<tyler> neat ... any way to do that with ocamlopt?
<kinners> tyler: ocamlopt -pp camlp4o etc.
<tyler> neato, that is better
* tyler alias occ=ocamlopt -pp camlp4o
<tyler> *g*
<tyler> now the quest for speed....
<tyler> although it's not that bad
<tyler> and infact top makes me beleive the the graphics is the bottleneck
<tyler> as XFree and my app are both @ ~40% cpu
tyler has quit ["Lost terminal"]
drWorm has quit [orwell.freenode.net irc.freenode.net]
rox has quit [orwell.freenode.net irc.freenode.net]
mof has quit [orwell.freenode.net irc.freenode.net]
drWorm has joined #ocaml
mof has joined #ocaml
rox has joined #ocaml
mkennedy has joined #ocaml
kinners has quit ["leaving"]
andrewb has quit [Read error: 54 (Connection reset by peer)]
andrewb has joined #ocaml
mlh has quit ["Leaving"]
kinners has joined #ocaml
maihem has quit ["Client exiting"]
pattern has quit [orwell.freenode.net irc.freenode.net]
hf has quit [Remote closed the connection]
hf has joined #ocaml
pattern has joined #ocaml
wazze has joined #ocaml
lus|wazze has joined #ocaml
lus|wazze has quit [Client Quit]
gim has joined #ocaml
kinners has quit [orwell.freenode.net irc.freenode.net]
cjohnson has quit [orwell.freenode.net irc.freenode.net]
The-Fixer has quit [orwell.freenode.net irc.freenode.net]
hf has quit [orwell.freenode.net irc.freenode.net]
andrewb has quit [orwell.freenode.net irc.freenode.net]
skylan has quit [orwell.freenode.net irc.freenode.net]
mellum has quit [orwell.freenode.net irc.freenode.net]
Smerdyakov has quit [orwell.freenode.net irc.freenode.net]
hf has joined #ocaml
kinners has joined #ocaml
andrewb has joined #ocaml
skylan has joined #ocaml
cjohnson has joined #ocaml
mellum has joined #ocaml
The-Fixer has joined #ocaml
Smerdyakov has joined #ocaml
kinners has quit ["leaving"]
whiskas has joined #ocaml
bk_ has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
bk_ has joined #ocaml
LordJ|m has quit [Client Quit]
Nutssh has joined #ocaml
Banana[Home] has quit [Read error: 60 (Operation timed out)]
Banana has joined #ocaml
mimosa has joined #ocaml
The-Fixer has quit ["Goodbye"]
srv_ has joined #ocaml
srv has quit [Read error: 104 (Connection reset by peer)]
srv_ is now known as srv
srv has quit ["leaving"]
srv has joined #ocaml
bk__ has joined #ocaml
drWorm has quit [Read error: 54 (Connection reset by peer)]
bk__ has quit [Client Quit]
bk_ has quit ["I'll be back"]
bk_ has joined #ocaml
drWorm has joined #ocaml
LordJ|m has joined #ocaml
srv has quit ["leaving"]
srv has joined #ocaml
bk_ has quit ["I'll be back"]
lam has quit [Read error: 60 (Operation timed out)]
bk_ has joined #ocaml
Nutssh has quit ["Client exiting"]
indigo has joined #ocaml
<indigo> moo!
<bk_> mOO
<indigo> anyone know of some good, objective resources on the performance of the ocaml native code compiler?
<indigo> i know it's fastere than C at making fibonacchi numbers, but..
<indigo> a recursive fibonacchi function is a little unfair :)
lam has joined #ocaml
<indigo> perhaps if i asked differently...
<indigo> are there any well known, complex projects written in ocaml that could affirm it's efficiency?
<indigo> i'm sure this is asked all the time, but really, the only thing out there is "it's good" with really no reason
<mattam> ocamlopt.opt is the fastest compiler i know
Demitar has joined #ocaml
Hipo has joined #ocaml
<indigo> what's the diff between ocamlopt and ocamlopt.opt?
<mattam> ocamlopt.opt is a native version
<indigo> they both produce the same code?
<Demitar> diff `which ocamlopt` `which ocamlopt.opt`
<mattam> Demitar :)
<mattam> indigo: yes
<indigo> i see
<mattam> although it's not proved
<mattam> yet!
<indigo> would be a hard thing to prove
<mattam> certifying the ocaml compiler is in the works
<Demitar> indigo, OCaml is already proving difficult stuff. =)
Riastrad1 has joined #ocaml
<indigo> like what?
<indigo> you mean in the realm of program verification, or something else?
<Demitar> Mostly. It was pretty much an "shock-and-awe don't-ask-questions" statement. ;-)
<indigo> ah
* Demitar of course is too tired to have any idea what he's talking about.
<indigo> well, i'm looking at ocaml because i'm looking for a safe language with good performance
<mattam> indigo: what would you want to compare ocaml programs to ? i mean what sort of programs in C ?
<indigo> mattam: well, generally, just anything, which makes it kinda hard to test :)
<indigo> i've implemented some small tests and the results have all been on par with C, but i was looking for something bigger
<Demitar> indigo, OCaml allows me to write terrible code that still works. That is something which requires strong statical typing. :)
<indigo> heh
<indigo> well, i'm still trying to figure out just how safe it really is
<indigo> the idea is to make a language which can make memory protection unneeded
<mattam> indigo: ocaml does
<Demitar> Sound like TUNES?
<indigo> yes, it does :)
<mattam> if it hadn't some Obj.magic and the like
<Demitar> You always have to be wary of exceptions of course.
<indigo> well, if the program dies gracefully, that's fine
<indigo> comprimising the system is not acceptable though
<indigo> can't be worse than a segfault
<Demitar> Well, you'd have to write a memory manager for OCaml of course. Apart from that it should be safe afaik. But you probably want stronger proof of that if you're aiming to ditch memory protection.
<Demitar> Anyway, later.
Demitar has quit ["Bubbles everywhere!"]
<indigo> mmm...bubbles
<indigo> well, i have a feeling i'll be in the ocaml source soon...
<indigo> like right now
<indigo> i think ocaml would be a good language for poetry :)
Riastradh has quit [Success]
malte has quit [Read error: 54 (Connection reset by peer)]
<indigo> is there any way to take the bytecode produced by ocamlc, and produce native code?
<indigo> or is there a table of all the filetypes all these tools expect? :P
stupid|me has joined #ocaml
whiskas has quit [Read error: 113 (No route to host)]
Nutssh has joined #ocaml
stupid|me has quit ["Pa / Bye."]
det has quit [Read error: 104 (Connection reset by peer)]
bk_ has quit ["I'll be back"]
tyler has joined #ocaml
<tyler> Is there a tool to properly indent O'Caml code
<Smerdyakov> emacs
<tyler> I've got a series of really nasty nested statements
<tyler> and something isn't lining up right...
<tyler> I think anyways...
<tyler> I'm getting a syntax error on a line that is simply 'done ;'
<Smerdyakov> I hope you saw my answer to your question, tyler.
<tyler> yea
<tyler> what's the proper encantation?
<Smerdyakov> If you have an OCaml mode installed, nothing. It will automatically be syntax highlighted and indented as you edit it.
<tyler> Smerdyakov: err... little late for that...
<tyler> plus emacs isn't my $editor *g*
<Smerdyakov> You can select it all and indent-region, in that case.
<tyler> ok
<Smerdyakov> Also, switch to using emacs, if you want to code in functional languages. Almost all FP hackers use it.
<tyler> DOH!
<tyler> it wasn't looping percisley...
<tyler> but how I was entering
<tyler> I left the in off a let....
<tyler> my mandelbrot program is getting pretty neat ;)
<tyler> I'm implementing progressive rendering
<tyler> it requires a power of 2 window size
<tyler> and then continually subdivides until every pixel is rendered
<tyler> so you get a fast 'preview' and then kinda let the details fill in
<Hipo> Adaptive rendering isn't that good in mandelbrot...
Jaundice has joined #ocaml
<Hipo> Hmm, sorry I think I misunderstood.
bk_ has joined #ocaml
<tyler> Hipo: Still here?
<indigo> moOOOOooOOo
Defcon7 has quit [Read error: 60 (Operation timed out)]
<tyler> Anyways, if anyone is interested...
<tyler> code is at http;//tylere.com/mandel.ml
Defcon7 has joined #ocaml
<tyler> compile it, and run it with a single integer argument that specifys the size of the window
mimosa has quit ["J'ai fini."]
* indigo looks
<indigo> probably the biggest ocaml program i have read :)
<tyler> hehe
<tyler> come on now... it's under 100 lines
<tyler> not very well structured I'll give you...
<tyler> but it works
<tyler> it breaks up after you zoom in 20 or 30 times
<tyler> but that's just due to the limitations of doubles (!!)
<indigo> no ocaml on this box, so i can't run it :(
<tyler> a freebsd machine by any chance?
<indigo> windows :(
<tyler> ugg
<indigo> need it for work :((
<tyler> 1 sec
<indigo> i have linux availible to, but only through ssh
<indigo> that's where i am now
<indigo> i'd put ocaml on it, but stupid debian wants to install X also
<tyler> heh
<Smerdyakov> Whaaat?
<Smerdyakov> I install ocaml just fine on a remote Debian machine I run.
<indigo> does it have X?
<Smerdyakov> Probably, but who cares? It's just some extra time spent downloading and installing.
<indigo> and a whole lot of disk space
<indigo> disk space is money
<Smerdyakov> Whine whine whine!!
<Smerdyakov> Yeah, like $1....
<indigo> to buy the disk
<indigo> but then there's the lost profit by not doing something with it
<indigo> it's on a server
<Smerdyakov> Profit? Are you some sort of capitalist?
<indigo> looks pretty mandelish
<tyler> :)
<indigo> too bad the blue gun is dying on this monitor :P
<tyler> hah
<tyler> I'm trying to get a better zoom in
<tyler> but the Graphics library mouse handling is....shitty
<indigo> sweet
* tyler sides to hack to use a keybord key to zoom in
<indigo> heh
<tyler> desides
<indigo> well, i never use the mouse anyway
<tyler> use like i key to zoom in, o key to zoom out
<indigo> in fact, i have to disconnect it to boot linux
<tyler> with the current mouse location as the point to zoom on
<tyler> the problem with Graphics it that it doesn't care if the window is focused or not
<tyler> it triggers on EVERY click
<tyler> yea, I got the keys working ;)
<tyler> here's a more interesting image:
<tyler> super high zoom level
<tyler> heh, I hacked a new feature ;)
<tyler> ajustable max iterations
<tyler> more brings out more detail
<tyler> but it also slower
<tyler> here's one with low max_iter
<tyler> and the exact same region with max iter about 32 times higer (~800)
Riastrad1 is now known as Riastradh
maihem has joined #ocaml
Nutssh has quit ["Client exiting"]
Jaundice has quit [Client Quit]
Jaundice has joined #ocaml
Jondice has joined #ocaml
Nutssh has joined #ocaml
Nutssh has quit ["Client exiting"]
Jaundice has quit [Client Quit]
Jondice has quit [Client Quit]
Jaundice has joined #ocaml
Jaundice has quit [Client Quit]
Nutssh has joined #ocaml
mkennedy has quit ["ERC Version 4.0 $Revision: 1.637 $ (IRC client for Emacs)"]
maihem has quit ["Client exiting"]
wazze has quit ["--- reality is that which, when you stop believing in it, doesn't go away ---"]
Nutssh has quit ["Client exiting"]
maihem has joined #ocaml
Nutssh has joined #ocaml