Yurik changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available
hitachi has quit ["Client exiting"]
* Vincenz wrote a cat and a tee utility in ocaml, his first 'real' progs
<seth_> Vincenz: I am bringing my first fairly large ocaml program on line.
<Vincenz> neat :)
<seth_> It even works, almost. :)
<Vincenz> what is it?
<seth_> It is part of an internet site filtering system. So it is fairly involved. I originally wrote it in Ruby, and now I've converted it to ocaml.
<Vincenz> neat
* Vincenz learned ruby before meeting ocam
<Vincenz> what do you use for sockets?
<seth_> standard library stuff, UnixLabels module stuff, and the rest I wrote myself.
<Vincenz> ah
<Vincenz> isn't it a pain to use something so lowlevel?
<Vincenz> I know ruby has some nice std libs for that stuff
<seth_> well, there is always a trade off between the level and the degree of flexibility. But, actually, ocaml has just as much as ruby, if you use the cdk libraries.
<seth_> I didn't use the cdk libraries, though, because I wanted to maintain control.
<seth_> So I wrote some classes to fill in the missing functionality.
<seth_> Now that I am over the hump of understanding the compiler's messages and the general framework, I am very pleased with ocaml.
<seth_> It takes some mental reorientation, though.
<Vincenz> hmm
* Vincenz reminds himself to look up cdk
<seth_> there is a link to it on the main ocaml page. It is a fairly extensive set of additional libraries, and IDL compiler for interfacing to C, a lot of interesting stuff.
<seth_> s/and IDL/an IDL/
lament has quit ["Support Darwin Awards! Join the military!"]
lus|wazze has quit ["*liephab* <3 <3 <3"]
* Vincenz has the IDL he thinks
<Vincenz> I have the standard windows-install
<seth_> Don't know, I don't use windows.
Kinners has joined #ocaml
mattam_ has quit [Read error: 110 (Connection timed out)]
lament has joined #ocaml
exa has joined #ocaml
<exa> anybody around?
<exa> need help with module compilation :(
<exa> File "dynarray.ml", line 13, characters 13-84:
<exa> Unbound record field label vec
<exa> I get this error, but in dynarray.mli the record including vec field is defined correctly
<exa> And when I copy/paste the error-yielding function, it works in the interpreter
<exa> I compile using: ocamlfind ocamlc -package "unix str getopt" -predicates "" \
<exa> -c dynarray.ml
<exa> Of course I've produced dynarray.cmi from dynarray.mli
<exa> Pffff
<exa> What's wrong with this can you guess?
<Kinners> try -c dynarray.mli dynarray.ml ?
<Kinners> the dynarray.cmi might be older
<exa> it doesn't work either, maybe the code is wrong?
<exa> i don't understand
<exa> type 'a dynarray = { mutable vec: 'a array; mutable size: int;
<exa> f: (int -> 'a) }
<exa> let make x = { vec = Array.make 2 x;
<exa> size = 0;
<exa> f = function _ -> x }
<exa> What could be wrong with this code?
<exa> type 'a dynarray = {
<exa> mutable vec : 'a array;
<exa> mutable size : int;
<exa> f : int -> 'a;
<exa> }
<exa> val make : 'a -> 'a dynarray = <fun>
<exa> Interpreter can understand my code, but the compiler can't!!!
* exa hits his head on the wall
<Kinners> do you use a makefile?
<seth_> exa: what does the compiler complain about?
<exa> Kinners: Yea, I wrote a makefile
<exa> seth_: File "dynarray.ml", line 13, characters 13-84:
<exa> Unbound record field label vec
<exa> Like it doesn't read the interface file at all
<exa> Maybe I'm totally clueless, I don't know :)
<Kinners> exa: have you done a make clean?
<exa> Kinners: Yes, yes, I built everything from scratch
<seth_> exa: make the files module files, and use ModuleName.vec
<exa> The funny thing I got the same problem with this code:
<exa> orion:test$ cat a.ml
<exa> let m = {a=3; b=2}
<exa> orion:test$ cat a.mli
<exa> type record = {a: int; b: int}
<exa> I'm suspecting everything ATM :)
<seth_> exa: If you make each file a module, and use fully qualified names, the problem will go away.
<exa> Excuse me?
<exa> Aren't they modules?
<exa> I mean, a.mli and a.ml define a compilation unit called A. No?
<seth_> Not unless you have module ModuleName = struct ... end
<seth_> yes, but a compilation unit is not a module.
<exa> Hm, actually that's not true, right?
<seth_> although a module is a compilation unit
<seth_> that is, a compilation unit is not necessarily a module
<exa> ocaml manual seems to say otherwise
<seth_> It might, but I'm just telling you what works.
<seth_> Follow the syntax in the modules chapter of the manual
<exa> The same way you can evidently compile GetOpt library. No module construct used.
<exa> You can just write things in toplevel
<exa> I suspect my installation is broken
<seth_> Yes, that's true. I don't think it is your installation, though. I've run into this occasionally. Or my installation is also broken. :)
<seth_> In any event, if you use explicit module naming and qualify the names, the problem goes away.
<exa> Then it's a bug and it should be fixed
<exa> Arrrrrghhhh
<exa> I hated it
<seth_> Yes, I think you are correct.
<seth_> I just do what works so I can keep working, as I have to deliver completed code by a deadline.
<Kinners> you need to duplicate the type in the module implementation
<exa> Kinners: uh?
<exa> Kinners: Right!
<exa> Kinners: Is that correct?
<Kinners> yes
<exa> Kinners: Because the mli it's only an abstract specification?
<exa> Kinners: Mighty counterintuitive though
<seth_> No, even if that works you don't want to do it. A prime opportunity to make a mistake.
<exa> What should I do then?
<exa> Use module ... = struct ... end
<exa> ?
<exa> So maybe I'm better off not writing .mli files at all?
<Kinners> no
<exa> Interesting view
<exa> So there will be modules that are just sigs, and implementations that might refer to them
<exa> Or better functors using them?
<Kinners> search for ocaml type duplication on google groups
<exa> like graphtype.mli and graphalgos.ml ?
<exa> So it will be like AbsGraphAlgo: GraphType -> GraphAlgo
<Kinners> I'm still in the ocaml learning phase so don't ask me :)
<exa> I'm thinking of posting some of the stuff to ocaml list so I wanna make 'em look like the stdlib
<Kinners> ok
<exa> I'm writing some graph code that people could build aroud
<exa> C++ frustrated me so much that I'm taking pains to avoid it :)
<exa> Reference to undefined global `Dynarray'
<exa> Why do I get that error?
* exa RTFMs
<Kinners> link dynarray before the modules that need it
<exa> ok
<exa> thx for the help, gotta sleep now
<exa> l8r
exa is now known as exa-away
Kinners has left #ocaml []
reltuk has joined #ocaml
emu_ has joined #ocaml
emu has quit [Read error: 54 (Connection reset by peer)]
mattam has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
iusris_ has joined #ocaml
baader has joined #ocaml
lament has quit ["Support Darwin Awards! Join the military!"]
emu_ is now known as emu
TachYon26 has joined #ocaml
gene9 has joined #ocaml
TachYon26 has quit [sterling.freenode.net irc.freenode.net]
karryall has quit [sterling.freenode.net irc.freenode.net]
mattam has quit [sterling.freenode.net irc.freenode.net]
iusris_ has quit [sterling.freenode.net irc.freenode.net]
Vincenz has quit [sterling.freenode.net irc.freenode.net]
TachYon26 has joined #ocaml
iusris_ has joined #ocaml
mattam has joined #ocaml
Vincenz has joined #ocaml
karryall has joined #ocaml
gene9 has quit [Read error: 60 (Operation timed out)]
baader has quit ["I'll be back"]
baader has joined #ocaml
<emu> FBI is on the look-out for people writing ocamls
<baader> good, i'm safe then coz i don't understand the language
<reltuk> haha, they're looking to hire people, or what?
mattam_ has joined #ocaml
systems has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
systems has quit [Client Quit]
TachYon26 has quit [Remote closed the connection]
mattam_ is now known as mattam
lus|wazze has joined #ocaml
<reltuk> caml light has prefix...?
sshaw has joined #ocaml
<Vincenz> really?
Zadeh has joined #ocaml
sshaw_ has joined #ocaml
<Vincenz> emu: where did you read that?
mattam has quit [Read error: 110 (Connection timed out)]
sshaw has quit [Read error: 110 (Connection timed out)]
mattam has joined #ocaml
mattam_ has joined #ocaml
mattam_ has left #ocaml []
two-face has joined #ocaml
two-face has quit [Client Quit]
sshaw_ has left #ocaml []
<exa-away> w000t
<exa-away> I can work for FBI, I'm totally immoral
exa-away is now known as exa
karryall has quit ["bye"]
<Vincenz> where does it say about the FBI?
<pattern_> i think that was a joke :)
lament has joined #ocaml
<pattern_> vincenz, if you like that you should try to find the domokun movies
<pattern_> they're hilarious
<Vincenz> alright :)
<vegai> hmm, will the O'reilly ocaml-book be online forever?
<vegai> why is it online? are the authors rich already? =)
<baader> i've downloaded and printed it
<vegai> awfully nice, though
<pattern_> yes, just think of the millions that the authors could make by printing and selling an ocaml book ;)
<baader> i'd buy a final englisch version anytime
<vegai> pattern_: it seems authors are more selfish usually regardless of the demand
<pattern_> true
systems has joined #ocaml
systems has quit [Read error: 60 (Operation timed out)]
Vincenz has quit [Read error: 104 (Connection reset by peer)]
<emu> "on the look-out" meaning "for suspicious characters writing camls"
<lus|wazze> ?
<exa> emu: are you naturally high?
exa has quit ["using sirc version 2.211+KSIRC/1.3.4"]
lament has quit ["Support Darwin Awards! Join the military!"]
hitachi has joined #ocaml
<hitachi> seems dead in here...
<hitachi> anyone wouldn't happen to know anything about raytrace?
<lus|wazze> depends
<lus|wazze> what do you want to know?
<hitachi> hehe what I would need to know to start making myown raytracing program
<lus|wazze> hm
<lus|wazze> theres actually nothing special you need to know
<lus|wazze> some math
<lus|wazze> and some coding
<lus|wazze> some elementary linear algebra should suffice in the math department
<hitachi> not even light physics? I am currently in Algebra II and i mostly use python but also used c
<lus|wazze> then the basic principle is this
<lus|wazze> no you don't need much if any physics knowledge really :)
<lus|wazze> raytracing is actually pretty far away from real life physics
<lus|wazze> if you want to model light behaviour realistically you'll need radiosity
<lus|wazze> but that is very complicated and uses prettyadvanced math
<lus|wazze> but raytracing is acutally relatively simple
<lus|wazze> for each pixel in the screen
<lus|wazze> you calculate a ray
<lus|wazze> which starts at the observer position
<lus|wazze> then goes through that pixel
<lus|wazze> and find where it intersects with objects
<lus|wazze> you then take the closest of those intersections
<lus|wazze> calculate how much light of whicch colors it reflects
<lus|wazze> and make that pixel that color
<lus|wazze> for the calculating the color step there are several models, that is, formulas, the most common one being the phong model
<lus|wazze> suppose for example a simple raytracer which only supports spheres as the only object type
<lus|wazze> in ocaml, for example, you could represent a sphere as a record { orgx:float;orgy:float;orgz:float;rad:float }
<lus|wazze> you could then have a list of those spheres
<lus|wazze> and apply a function which calculates the intersection distance along a ray for a sphere
<lus|wazze> and simply map that function to the sphere list
<lus|wazze> take the minimum
lament has joined #ocaml
<hitachi> heh make it sound simple ^_^
<lus|wazze> you would then loop through all the pixels like this: for ix = xmin to xmax do for iy = ymin to ymax do let ray = {startx=0.0; starty=0.0; startz=0.0; directx = float_of_int ix; directy = float_of_int iy; directz = 1.0 } in ... done done
<lus|wazze> well the basic principle behind it IS very simple
<lus|wazze> what makes it complicated is only advanced features based on the basic princinple, and speed improvements, that is, optimizations
<hitachi> how long would you say it would take for someone new to ocaml and some coding to develope? (i kinda want to develope this before by the end of my senior yeat in HS, i am in 11th right now, maybe it would help me get into college )
<hitachi> 3-4 months?
<lus|wazze> hm
<lus|wazze> its hard to say#
<lus|wazze> it really depends too much on the feature set
<lus|wazze> a really basic one you might hack out in a matter of a few days
<lus|wazze> with a basic model and support for the most common shapes and lighting models id say, a good coder who understands his math, and not counting the parsing of the input language, maybe a month or two
<lus|wazze> but
<lus|wazze> there are really extreme cases
<lus|wazze> you might want to consider, for example, that one of the ifcp contest challenges in the last few years was to write a raytraces
<lus|wazze> complete with parsing of a moderately complex source language
<hitachi> where?
<hitachi> on the site?
<lus|wazze> they did it, iirc, all over the course of a weekend
<lus|wazze> it only needed to support phong lighting and no shadows, though, as far as i remember
<hitachi> heh cool!
<lus|wazze> i suppose it should be in some of the archives there
<lus|wazze> as i said, the basic layout of a raytracing engine is VERY simple
<lus|wazze> you should have your program up and running on the same day you begin
<lus|wazze> then you begin to add features which is what takes time
<hitachi> heh for me maybe longer I just began to use ocaml 2 days ago...
<hitachi> whats the difference from .ml and .mli
<lus|wazze> .ml is the implementation
<lus|wazze> if you know C the following analogy might help:
<lus|wazze> .ml is like .c
<lus|wazze> .mli is like .h
<hitachi> oh!
<lus|wazze> .mli contains type definitions and "prototypes"
<lus|wazze> which will be exported from the .ml module of the same name
<lus|wazze> eg you have an .ml file with the contents
<lus|wazze> let private_put_the_string () = print_string "this is private!"
<lus|wazze> let public_put_the_string () = private_put_the_string (); print_string "\nthis, however, is public!"
<lus|wazze> and then a .mli file with the contzents
<lus|wazze> val public_put_the_string : unit -> unit
<lus|wazze> and you could ony call public_put_the_string from other modules
<hitachi> unit is like void in c right?
<lus|wazze> pretty much
<lus|wazze> only that its a valid datatype
<lus|wazze> it just contains only 1 value, ()
<hitachi> cool I remebered that from yesterday heh
<lus|wazze> you can make a perfectly valid array of unit's for example
<lus|wazze> it's just that each one will be the same value, ()
<hitachi> about putting the pixels on the scene...i would use the graphic lib the comes with ocaml right?
<lus|wazze> you could use whatever you want
<lus|wazze> personally i wouldn't really care about that at first
<lus|wazze> best might be, in fact, to declare a class type for outputting pixels or something
<lus|wazze> and then using that
<hitachi> just work on he point&vector math and calculations right?
<lus|wazze> and at first only dumping the pixel values directly in some file or something
<lus|wazze> but the graphics library that comes with ocaml is ok - why not
<hitachi> for testing? thats smart hehe
<lus|wazze> well you can create your image without any interaction from the user once you've read and parsed the scene description