vect changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, ICFP'03 http://www.icfpcontest.org/, 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
<blueshoe> well, if you run in to some, let me know :)
<Smerdyakov> Psst. #sml exists as well. The book you're reading is about SML, right?
mimosa has quit ["I like core dumps"]
<blueshoe> smerdyakov, yes, it's true
<blueshoe> but i'm reading it to learn ocaml
<blueshoe> and all the exercises in it i do in ocaml
<blueshoe> i've been converting the syntax to ocaml as i read :)
<blueshoe> wow, the sml channel actually has fewer people in it... i'm surprised
<blueshoe> i thought sml was by far more popular than ocaml
<Swynndla_wk> well .. gotta go (I'll just lurk) ... thanks for all your help people :)
* teratorn wants to be able to define python types in ocaml :(
<blueshoe> bye, swynndla
<Swynndla_wk> cu :)
<blueshoe> "python types"? what do you mean?
<teratorn> blueshoe: like is commonly done from C
<blueshoe> can you elaborate?
<teratorn> only using ocaml instead of C to extend python would be really cool
<blueshoe> i don't know python, btw
<blueshoe> ahh, i see
<blueshoe> someone did write a python interpreter in ocaml
<blueshoe> it's called 'vyper', iirc
<teratorn> yes
<teratorn> perhaps there is useful code there
<blueshoe> but why not just use ocaml? :)
<teratorn> I do, for some things
<blueshoe> what do you like to use python for instead of ocaml?
<teratorn> hmm
<teratorn> well, just to give one example, pretty much any kind of networked app.
<blueshoe> because of better or more libraries for what you want to do in python?
<blueshoe> or is it a core language issue?
<teratorn> both
<blueshoe> can you talk about the core language issues?
* blueshoe is interested in language comparisons
<teratorn> well, i can develop faster in a strong, dynamically typed world.
<Smerdyakov> That's odd. I can develop faster is a statically typed world.
<blueshoe> me too
<blueshoe> i like the compiler telling me when i've made a mistake right away
<Smerdyakov> And I am generally regarded as a very fast developer.
<blueshoe> so by the time it's compiled it's virtually bug free
<teratorn> blueshoe: hehe
<teratorn> come on
<blueshoe> well, bugs in design still exist
<teratorn> static typing finding bugs is a good thing indeed
<blueshoe> but sooo many bugs are caught by static typing
<teratorn> nah, very few bugs are left in dynamic typing after the first test run
<blueshoe> depends on how much of your program you test
<blueshoe> and what happens when you change it later?
<blueshoe> you might affect somethign you don't test
<teratorn> well
<blueshoe> why not let the compiler test for you? :)
<teratorn> i assume you do test-driven development?
<Smerdyakov> teratorn, which kind of interface to a library do you prefer? One that can be described with formal types (and verified to match that type specification), or one that can only be described informally?
<blueshoe> right, but why waste time rewriting the tests a static language already does for you?
<teratorn> blueshoe: that is the thing. you do not.
<Riastradh> blueshoe, a test suite is good for _other_ reasons that static typing doesn't help you with.
<teratorn> no-one writes unit tests that do type checking.
<blueshoe> that's true
<blueshoe> but maybe they should
<blueshoe> heh
<teratorn> the point is, that since you need to write unit tests anyway, and those unit tests will certainly catch any typing errors, there is no point expending extra effort dealing with a static type system.
<blueshoe> in other words, could there be some bugs that aren't caught in the test you write because they are not general enough?
<teratorn> now you may dispute that static typing causes you to expend extra effort :)
<blueshoe> what extra effort?
<Smerdyakov> teratorn, how about my question?
<blueshoe> with type inference there is virtually none
<teratorn> Smerdyakov: sorry.. let me think.
<Smerdyakov> teratorn, I think that is an example of how static typing saves effort.
<teratorn> Smerdyakov: it can save effort if you don't have unit tests, yes.
<Riastradh> Static type analysis is certainly useful. But it's not the answer to all your problems.
<blueshoe> definitely not
<Riastradh> And limiting the set of allowed _and_ correct programs is not necessarily a good thing.
<Smerdyakov> teratorn, how do unit tests help you:
<Smerdyakov> 1) Learn the interface of a new library.
<Smerdyakov> 2) Verify that your library really meets the interface that you document.
<Riastradh> Smerdyakov, fascist static type systems don't help (1) either.
<Riastradh> Documentation and source code help (1).
<Smerdyakov> Riastradh, untrue.
<teratorn> Smerdyakov: well, if you use a library incorrectly in your program, it is highly unlikely that it will prodce correct outputs.
<Riastradh> Smerdyakov, if you're going to try to argue that having the type of a function is going to tell me what the function does, then I'm not even going to bother arguing with you.
<Smerdyakov> teratorn, and if you rely on undocumented behavior that you shouldn't rely on?
<teratorn> Smerdyakov: then your dumb?
<Smerdyakov> Riastradh, and I'm not going to argue with you, since you've obviously spent no significant amount of time using new ML libraries.
<teratorn> Smerdyakov: dunno what you're saying...
<Smerdyakov> teratorn, that doesn't placate software users who find bugs.
<Riastradh> Smerdyakov, please tell me what this function does:
<Riastradh> f : a -> (a -> b) -> b
<Smerdyakov> Riastradh, that's easy. If it's pure functional, then it either diverges or passes arg 1 to arg 2 and returns that.
<Riastradh> Er, add some quote marks there.
<Riastradh> OK, how about this one:
<Riastradh> g : int -> 'a list -> ('a, 'a) -> float
<Smerdyakov> teratorn, say you use an abstract type incorrectly. You use fact of its details that you shouldn't.
<teratorn> blueshoe: for example, static typing requires a lot of extra effort to pass around interface-compatible objects.
<Smerdyakov> teratorn, when the library changes the implementation of this type, your code breaks. But your Python tests didn't catch this before.
<Smerdyakov> Riastradh, that one is purposely vague. Good library designers make things clearer.
<blueshoe> teratorn, i haven't yet learned oo, so i'm just going to take your word on that one :)
<Riastradh> Smerdyakov, yeah, _WITH_DOCUMENTATION_.
<Smerdyakov> Riastradh, try using some OCaml libraries. You'll find it's often not needed.
<Smerdyakov> Riastradh, not to mention that types provide a FORMAL specification which the compiler can check for you.
<teratorn> Smerdyakov: you just read the defenition file?
<Smerdyakov> teratorn, I read the signature.
<Riastradh> OK, let's try this one, from the Filename module:
<blueshoe> the names of the functions probably help
<Riastradh> quote : string -> string
<blueshoe> that's just a form of documentation, though
<teratorn> Smerdyakov: Inded I agree that not guessing on what types a foreign function call wants is a very good thing.
<Smerdyakov> Riastradh, purposefully vague example.
<Riastradh> Smerdyakov, that had nothing to do with (1).
<Riastradh> Smerdyakov, what? You're saying an example is bad just because (1) doesn't help with it?
<teratorn> Smerdyakov: in python, most of the time, it is obvious. most of the rest of the time, the funciton will have a docstring that explains how it works.
<Riastradh> How about this one:
<Smerdyakov> val is_relative : string -> bool
<Smerdyakov> That one is easy. :-)
<Smerdyakov> teratorn, the interpretr/compiler can't verify that the docstring is accurate.
<teratorn> Smerdyakov: i know!
<Riastradh> open_temp_file : ?mode:Pervasives.open_flag list -> string -> string -> string * Pervasives.out_channel
<blueshoe> teratorn, docs can diverge from the program
<Smerdyakov> Riastradh, the OCaml standard libraries are not very complicated or semantically rich.
<Smerdyakov> Riastradh, libraries that do more complicated things tend to have more telegraphic types.
<Riastradh> Smerdyakov, here, let me take a random example from LablTk:
<Riastradh> bind : events:event list -> ?extend:bool -> ?breakable:bool -> ?fields:eventField list -> ?action:(eventInfo -> unit) -> 'a Widget.widget -> unit
<Riastradh> I haven't the _faintest_ idea what that's supposed to do, even _with_ the annotation of label names.
<Smerdyakov> Well, it looks pretty clear if we ignore the optionals. :)
<Riastradh> Convert it to just bind : events:event list -> 'a Widget.widget -> unit you mean?
<Smerdyakov> Yup
<Riastradh> I still haven't the foggiest idea what it does.
<Smerdyakov> Install a sequence of event handlers for a GUI widget
<Riastradh> I am bewildered as to how you knew that.
<Smerdyakov> Looking at the event type definition would make it even clearer, no doubt.
<Smerdyakov> The name of the function, the context, and the types.
<Riastradh> How do you get from 'bind' to 'install a sequence of event handlers?'
<Smerdyakov> That's what "bind" means in the GUI interface world.
<blueshoe> choosing informative funciton names is documentation
<blueshoe> but it's really minimal documentation
<teratorn> yep
<blueshoe> some people are good at giving lots of information in very little space, but some aren't
<blueshoe> so better to be overly verbose, imo, and spell out exactly what the thing does
<blueshoe> not just try to name it wisely (though that's important too)
<blueshoe> and types help
<blueshoe> but they're not the end of documentation, just the beginning
<teratorn> hmm btw, does ocaml allow in-line documentation?
<blueshoe> (* foo *) ? :)
<teratorn> :)
<blueshoe> what do you mean by "in-line documentation"?
<teratorn> blueshoe: like python "docstrings"
<Riastradh> ocamldoc. (** ... *)
<Riastradh> OK, ocamldoc isn't like CL docstrings.
<teratorn> Riastradh: aah, i was just going to ask if there were convetions for formatting comments
<teratorn> blueshoe:
<teratorn> >>> def foo(a, b):
<teratorn> ... "Add a and b"
<teratorn> ... return a+b
<teratorn> ...
<teratorn> >>> foo.__doc__
<teratorn> 'Add a and b'
<teratorn> then programs like pydoc or epydoc can go through and auto-generate api documention.
<blueshoe> i don't know python, so i don't know docstrings
<Smerdyakov> An unprocessed OCaml signature can provide superior documentation, because it also includes types.
<blueshoe> ahh, i see
<blueshoe> so, like doxygen
<blueshoe> smerdyakov, yes, types are a big plus
<teratorn> Smerdyakov: eh?
<Smerdyakov> teratorn, look at .mli files that have comments for each member. That's complete documentation for a module.
<teratorn> Smerdyakov: there is certainly type information in python documentation.
<blueshoe> someone should write a doxygen extension for ocaml
<Smerdyakov> There are already doxygen-like tools for ocaml.
<teratorn> Smerdyakov: cool
<teratorn> this is a common markup language for python docstrings: http://epydoc.sourceforge.net/epytext.html
<teratorn> say i want a hyperlink to appear in my documentation, to another ocaml object, in perhaps a different module. is that doable?
<teratorn> please excuse my ignorance of how pepole document there ocaml code :)
<teratorn> s/there/their
<Riastradh> teratorn, please read the ocamldoc manual.
<teratorn> ok!
<blueshoe> yeah, i know there are quite a few documentation tools for ocaml... but it would be nice if i could just use doxygen, rather than install yet another tool
<blueshoe> and learn another tool, which basically does the same thing as a tool i already have, and which i'm relatively satisfied with (except for its lack of ocaml support)
<blueshoe> i'd write the ocaml extension for doxygen myself, but i'm just not that advanced yet
<blueshoe> one day ocaml will conquer the world, though!
<Riastradh> It will have to wrest the throne from Scheme, and because it's so disciplined and, more importantly, bonded, it will never be able to do that.
<blueshoe> "bonded"?
<Riastradh> As in the term 'bondage & discipline.'
<blueshoe> ahh
<Riastradh> In reference to its fascist type system.
<blueshoe> i see
<blueshoe> i don't find the type system fascist... i find it refreshing
<blueshoe> it's like having a dresser to put your clothes in rather than throwing them all in to a big heap on the floor
<teratorn> blueshoe: refreshing compared to what?
<Smerdyakov> Riastradh has not demonstrated that he has any substantial software devlopment experience, so his claims of what's "fascist" should be taken with a grain of salt.
<ayrnieu> O'Caml works well for static systems, and not so well for systems that you'd like to program at 'runtime' -- but it differs little from every sufficiently lisp-distant language in this respect.
<blueshoe> socks can go in one drawer, shirts in another... makes finding the right shirt easier when you want one
<blueshoe> ayrnieu, can you give an example of a "system that you'd like to program at 'runtime'"?
<blueshoe> teratorn, refressing compared to most imperative languages i've used
<Riastradh> Smerdyakov, a) do you really find it necessary to try to insult me whenever you can? b) you're obviously taking the meaning of the term 'fascist' in this context the wrong way; c) it was a bloody _SILLY_COMMENT_; d) it's irrelevant now, as I've set my client to ignore messages from you.
gim_ has quit ["++"]
<teratorn> blueshoe: perl, php and python are mostly imperative, and their type systems are way different.
<ayrnieu> blueshoe - an IRC client, for the most immediate example. With a lisp-like language I can trivially 'script' the IRC client in its own language, maybe bringing up a window to access a repl.
<teratorn> i'm highly impressed with lisp's applicability to window manager extensions, a la sawfish, but i don't really have the lisp experience to quantify just why that is.
<ayrnieu> blueshoe - but with Erlang I've found that I can develop a server much faster and more reliably if I first get it running, and then do all the rest of development in the context of this one running server -- fixing bugs, adding features, and then moving the running processes over to the new module code.
<teratorn> ayrnieu: hmm! how do you do that?
<ayrnieu> teratorn - trivially, in Erlang.
<Riastradh> Using gen_server and the fact that hot-swapping Erlang code is really simple.
<Smerdyakov> Hey, any of you folks who like programming might like #hprog .
<ayrnieu> Riastradh - yeah, but I went pretty far without messing with gen_server =) I had my own ad-hoc system up for a while.
<blueshoe> teratorn, i've used perl... and i actually like it.. but i like ocaml more... i really like how many bugs ocaml eliminates at compile time... that's HUGE gain over most other imperative lagnuages i've used... but, as i said, i haven't used python... nor c++ or java, for that matter
<teratorn> erlang and mozart-oz have always intrigued me, but i've never studied them in great detail.
<teratorn> blueshoe: perl typing sucks, yes.
<ayrnieu> Riastradh - I find that all Erlang's nonsense about 'applications' and such make a great deal of sense after you write a few servers in that manner.
<teratorn> blueshoe: you may or may not learn anything from java, c++ will demonstate how not to do things.
<blueshoe> ayrnieu, don't know lisp or erlang, so can't really comment... but your examples sound interesting
<blueshoe> what's #hprog?
<Smerdyakov> It is a channel for programmers.
<blueshoe> teratorn, not just perl's typing, but c's typing, and assembly, and quite a few other imperative languages... vb, basic, pascal, rexx... not to mention some other not so general purpose "langauges" like html or sql
<blueshoe> teratorn, i'm determined to put off learning java and c++ for as long as possible
<teratorn> blueshoe: all true
<ayrnieu> blueshoe - I advise that you never waste time on C++.
<blueshoe> advice well taken :)
<blueshoe> it's quiet
<blueshoe> too quiet
* Riastradh pops a balloon.
<blueshoe> AAAAGHH!
* Riastradh drops the pin with which he popped the balloon.
<blueshoe> i can't hear it
<blueshoe> i must not be using Sprint
* Riastradh drops a cell phone on blueshoe's head -- one of those satellite ones with the six kilogram antennae --.
<blueshoe> thank you sir, may i have another?
<Riastradh> No.
<blueshoe> :(
wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
<Smerdyakov> blueshoe, are you at work now?
<blueshoe> yes
<blueshoe> don't remind me :)
<Smerdyakov> Which building?
<blueshoe> evans
<Smerdyakov> Ah. My 2nd favorite building. :)
<blueshoe> heh
<blueshoe> it's so ugly
<Smerdyakov> Yes, but it has goodies inside.
<blueshoe> what's your first?
<blueshoe> true
<Smerdyakov> Soda, of course :D
<blueshoe> lots of computers
<blueshoe> never been there
<blueshoe> only seen it from the outside
<blueshoe> i like the hearst mining building
<blueshoe> inside
<Smerdyakov> I'm talking mostly about the departments housed in the buildings when I say this, not architecture.
<blueshoe> right
<blueshoe> i was talking architecture :)
<blueshoe> i'm part of the bioengineering dept
<blueshoe> i really don't know much about the depts here
<blueshoe> except that they exist, have students... that kind of thing
<blueshoe> mostly i just work in my loud little server room
<Smerdyakov> Well, I will tell you that the EECS and Math departments are both world renowned. Both are cited as the tops in the country reasonably often by particular surveys.
<blueshoe> cool
<blueshoe> i know berkeley is ivy league, so i'd expect nothing less
<Smerdyakov> No, it's not ivy league...
<blueshoe> and bsd was invented here (supposedly right behind my room)
<blueshoe> not ivy league?
<blueshoe> it's one of the best universities in the country, isn't it?
<Smerdyakov> Yes, but the ivy league is a concrete athletic league, or former athletic league, I'm not sure.
<blueshoe> i know it's library was just rated the best in the country, for public universities, and only behind harvard and yale among all univ libs :)
<blueshoe> atheltic league? that's not my understanding of the term
<Smerdyakov> That's not most people's understanding, but it's the correct understanding. :)
<blueshoe> i thought ivy league meant quality of education, over all
<blueshoe> ahh... i see
<Smerdyakov> Since I think it is a _former_ athletic league, it stands for a fixed set of schools.
* Smerdyakov attempts to remember
<Smerdyakov> Harvard, Yale, Princeton, Cornell, UPenn, Dartmouth, ...
<Smerdyakov> Ah. Brown and Columbia.
<Smerdyakov> Looks to be a still living league.
<blueshoe> anyway... i just meant that berkeley is one of the best schools in the country, academically
<blueshoe> so it's not surprising they have great math/eecs depts
<blueshoe> http://www.cs.tufts.edu/~sanpawat/prince1.html puts it at #23 for competitiveness for getting in
<blueshoe> that's surprisingly low, actually... i'd have thought it would be in the top ten
<Smerdyakov> It's #1 for _graduate_ program quality and competitiveness, with no close competition from other schools, I think.
<Smerdyakov> In that it has the most "top 10" graduate programs.
<blueshoe> ahh... interesting
<shrimpx> Smerdyakov: what's your phd topic?
<blueshoe> <cartan> what if OCaml really means Oppressive Communist Academic Militant Language?
<Smerdyakov> shrimpx, I just started! I don't have one yet.
<shrimpx> ah
<shrimpx> will it be languages-related?
<Smerdyakov> Probably
<blueshoe> "Cqual is a type-based analysis tool that provides a lightweight, practical mechanism for specifying and checking properties of C programs. Cqual extends the type system of C with extra user-defined type qualifiers. The programmer adds type qualifier annotations to their program in a few key places, and Cqual performs qualifier inference to check whether the annotations are correct..."
<shrimpx> heh
<blueshoe> hey, maybe i don't need ocaml after all! ;)
<shrimpx> just use java :)
<blueshoe> damn... it's been a while since i've seen a program that requires csh in order to compile
<blueshoe> then again, it's written in fortran
<Riastradh> FORTRAN!? What program is this?
<blueshoe> a data visualization program
<blueshoe> i've given up on it, though... can't even get it to compile... too buggy
<blueshoe> oh, wait, maybe i can install one of the binaries.. even though they don't have a debian package i could use alien to convert the rpm...
<blueshoe> but, really, all i want is something simple that runs on unix that can display three dimensional data
<Smerdyakov> OpenOffice :)
<blueshoe> blech
<blueshoe> simple!
<blueshoe> something i can feed in data on the command line
<Smerdyakov> Search Freshmeat!
<blueshoe> ideally in real time
<blueshoe> yeah, i'll probably go there next
<Smerdyakov> "In real time" = "very quickly" in this context?
<blueshoe> not necessarily... just so that it will update as new data comes in
<blueshoe> doesn't have to be particularly quick... and there won't be a lot of data streaming by quickly
<blueshoe> that's hilarious... i didn't know comment lines in fortran started with a "C"
<blueshoe> that makes so much sense, in an caveman sort of way
<Swynndla_wk> hey blueshoe, you know how I was summing up values of an array in an imperitive way? ... could you show me how to do it in a recursive way (if I show you my code again)?
blueshoe has quit [Read error: 104 (Connection reset by peer)]
<vect> hi
<Swynndla_wk> hey
blueshoe has joined #ocaml
<vect> Swynndla_wk try this :
<Swynndla_wk> wb blueshoe
<vect> let rec sum_aux tab value = function
<vect> 0 -> value + tab.(0)
<vect> | index -> sum_aux tab (value + tab.(index)) (index-1)
<vect> let sum tab = sum_aux tab 0 (Array.length tab - 1)
<blueshoe> hey
<blueshoe> my stupid irc client keeps disconnecting... but now i have to go eat
<Swynndla_wk> ok blueshoe :p
<blueshoe> here is something on recursion, btw http://web.access.net.au/felixadv/files/output/book/x237.html
<Swynndla_wk> ahhh ok .. thx
<Swynndla_wk> vect ... I'm a bit too new to appreciate your code
<vect> ok
<teratorn> blueshoe: what kind of data do you want to visualize
<teratorn> ?
<blueshoe> teratorn, just three columns of real numbers... ex: 0.0 0.0 0.0, 1.1 2.2 3.3
<teratorn> how are you going to show it?
<blueshoe> it should draw this in three dimensions (simulated with a 2d graphics card is perfect)
<vect> Swynndla_wk, if you want to see how recursion works, use #trace in the toplevel.
<vect> It should help you
<blueshoe> teratorn, i'll be using an X display to show it
<Swynndla_wk> ahhhh ... never tried that ... I'm give it a go
<teratorn> blueshoe: ok! check this out: http://vpython.org/
<vect> mh, 5h15 am, time to sleep
<Swynndla_wk> vect ... still trying to see what your code does :)
* vect &
<Swynndla_wk> ahhh cu vect
<vect> Swynndla_wk maybe you should try to see how recursion works on basics examples like "factorial"
<blueshoe> teratorn, ahh.. but that looks ilke it uses 3d capabilities of your graphics card... i don't have mine set up in linux to do 3d... so i relly need something that does 2d to simulate 3d, not any special 3d hardware
<Swynndla_wk> yea ... I've got the hange of that one vect
<teratorn> blueshoe: mesa and such will do the opengl layer in software
<blueshoe> teratorn, looks cool, though.. once i get around to getting my linux box to work w/my 3d accelerator i'll give it a go
<Swynndla_wk> vect, but anything more gives me a headache at the moment
<blueshoe> teratorn, again, opengl requires the 3d capabilities of my graphics card to be configured correctly to run w/linux, and they're just not (ie. i don't have opengl drivers installed)
<teratorn> you're not listening. it can be done in software, although pretty slowly. :)
<blueshoe> teratorn, but don't i need opengl drivers?
<teratorn> right
<blueshoe> which i don't have installed
<blueshoe> and won't for a while
<blueshoe> which is why i need pure 2d
<teratorn> have fun!
<blueshoe> :)
<blueshoe> thank you for helping, though... i do appreciate it, though it wasn't exactly what i was looking for
<Swynndla_wk> vect, your code works well tho :)
<vect> ok course ! :)
<vect> s/ok/of
<Swynndla_wk> lol
<Swynndla_wk> vect, you know how "sum_aux tab 0 (Array.length tab - 1)" passes sum_aux 3 values (ie tab, 0, and another number) ... well sum_aux is defined to have only two arguments "tab value" ... isn't it??
<blueshoe> maybe i'll just use gnuplot - http://www.cs.uni.edu/Help/gnuplot/dataplot3d.html
<blueshoe> anyway, i have to eat... bbl
<Swynndla_wk> cu blueshoe
<vect> Swynndla_wk sum_aux is defined to have 3 args, but the third is direclty matched in the definition (sum_aux tab value = (*now i match the last arg *) function 0 -> ... | n -> ...
<vect> let f x = x + 1 is equivalent to let f = function x -> x + 1
<Swynndla_wk> right ... I've seen eg's like that
<vect> i can write "let rec sum_aux tab value index = match index with 0 -> ... | _ -> ..."
<vect> it's the same thing
<Swynndla_wk> ok ... let me absorb that in :)
<Swynndla_wk> ok vect ... I wrote out the recursion on a bit on paper with a simple array of lenth 3 ... I understand how the recussion works now, but some of the syntax is still a bit mysterfying :)
<Swynndla_wk> eg the pattern "0 -> value + tab.(0)" ... how does it know to match index and not value? (ie I know it matches index when it gets to 0, but why not value when it is 0?)
<vect> hu ?
<vect> let me re-write the code without this syntax
<Swynndla_wk> ok
<Swynndla_wk> vect! ... I got to go home ... will you be here in 45 mins?
<Swynndla_wk> I'll log back on when I get home ok?
<vect> query
<vect> don't want to flood
Swynndla_wk is now known as Swynn_wk_afk
Herrchen has quit [Read error: 60 (Operation timed out)]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Kinners has joined #ocaml
<Maddas> mimosa: still there?
<Maddas> oh, never mind.
blueshoe has joined #ocaml
blueshoe has quit [Client Quit]
Swynn_hm has joined #ocaml
blueshoe has joined #ocaml
<blueshoe> so no one knows what the deal is with the next icfp contest, huh?
blueshoe has quit [Read error: 104 (Connection reset by peer)]
teratorn has quit [Nick collision from services.]
teratorn- has joined #ocaml
Herrchen has joined #ocaml
ott has joined #ocaml
<ott> ree all
teratorn- has quit [Read error: 110 (Connection timed out)]
blueshoe has joined #ocaml
<blueshoe> Two engineering students were walking across campus when one said, "Where did you get such a great bike?" The second engineer replied, "Well, I was walking along yesterday minding my own business when a beautiful woman rode up on this bike. She threw the bike to the ground, took off all her clothes and said, 'Take what you want.'" "The second engineer nodded approvingly, Good choice; the clothes probably wouldn't have fit."
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
Kinners has left #ocaml []
<Swynn_hm> lol ... heard that one b4 blueshoe, but still funny ;)
<blueshoe> :)
mattam_ is now known as mattam
blueshoe has quit [Read error: 104 (Connection reset by peer)]
mimosa has joined #ocaml
mimosa has quit [Client Quit]
mimosa has joined #ocaml
blueshoe has joined #ocaml
<Swynn_hm> wb mimosa, blueshoe
<blueshoe> "The benchmarks show that FISh is significantly faster than Ocaml in all cases... in-lined mapping, reducing or quicksort, the fast Fourier transform, or matrix multiplication all show FIsh running at at least twice the speed of Ocaml are all examples of simple imperative programs, written almost identically in both languages. Yet FISh programs run at least twice as fast as the corresponding Ocaml programs."
teratorn- has joined #ocaml
gim_ has joined #ocaml
<Swynn_hm> but there is no #fish :P
<blueshoe> not yet
<blueshoe> but one day we'll all be fish
<Swynn_hm> plenty more in the sea
<ayrnieu> blueshoe - nonsense. Where'd you hear that?
<blueshoe> hear that we'll all be fish?
<ayrnieu> Indeed.
<blueshoe> it was a poor attempt at humor
<ayrnieu> FISh sounds like the ultimate just-for-benchmarking language.
<blueshoe> i dunno...
<blueshoe> what's all this stuff about "shape", anyway?
<blueshoe> they syntax looks kind of ocaml/mlish
<blueshoe> well, i don't have time to learn another language right now... haven't even half finished ocaml
<blueshoe> and i'd wait until it gained some in popularity to have as many libs as ocaml before i'd give it a serious try anyway
<blueshoe> but it looks kind of interesting... certainly seems to have a lot of documentation for a new language
<Swynn_hm> perhaps the next version of the ocaml compiler can learn from it?
<mimosa> hi everybody
<smkl> fish is just a proof of concept implementation of some research project
<Swynn_hm> hey mimosa
<ayrnieu> Indeed, it doesn't do anything useful.
<mimosa> Swynn_hm: did you try to program with lists btw ?
<mimosa> you should definitively start with lists rather than arrays
<mimosa> to get the functionnal programming style
<Swynn_hm> lists? ... I'm using arrays ..
<Swynn_hm> oic
<blueshoe> well, i'm very interested in highly optimized code
<blueshoe> yet i don't want to dive in to full assembler for complex projects
<Swynn_hm> yes ... what I read list are immutable but arrays are mutable so it lends itself to my imperitive techniques :P
<mimosa> Swynn_hm: something like that would be better than your example of yesterday:
<mimosa> let add_list = function
<Swynn_hm> lol
<mimosa> x :: s -> x + add_list s
<mimosa> [] -> 0
<blueshoe> ocaml's supposed to provide some nice abstraction management features while being very close to or better than c as far as performance goes... if there's a language that's twice as fast and has some of the same features, i'm interested in leranign more about it... even if it is just proof of concept
<mimosa> ;;
<Maddas> blueshoe: which language are you speaking about? (I missed the discussion before this)
<Maddas> And how could a language be twice as fast?
<ayrnieu> blueshoe - but it *doesn't* have some of the same features =)
<Maddas> mimosa: In the end you're just rewriting let sum = List.fold_right (+) 0
<ayrnieu> It seems to use concepts from APL.
<blueshoe> ayrneiu, yes, maybe it doesn't have all of the same features, but does it have enough of hte same features to make it useful and a real alternative?
<ayrnieu> blueshoe - no.
<Maddas> "Neither of these things happen in these benchmarks. In part this is because the benchmarks are all data intensive."
<blueshoe> well, that's what i'd like to know by learning more about it
<Maddas> Seems to be very selective benchmarks
<blueshoe> but i think i need to learn more ocaml first :)
<Maddas> clicking on FISh code gives me a 404
<Maddas> so does the OCaml code
<blueshoe> yeah, lots of broken links on that benchmark page
<Maddas> Can I review the code anywhere?
<Maddas> I don't trust benchmarks without any proof
<blueshoe> there is some sample code on the main fish page
<Maddas> Where?
<Maddas> oh, it has no garbage collection :/
<blueshoe> "FISh supports a strong stack discipline, so there is no need for a garbage collector"
<Swynn_hm> mimosa, so I can add the numbers in the list that way?
<blueshoe> "no need", huh?
<Maddas> blueshoe: that page sounds rather subjective
<mimosa> Swynn_hm: then you do add_list [1,2,3];;
<mimosa> and you get the sum
<mimosa> Maddas: I know that I'm rewriting List.fold_*
<blueshoe> yeah, i'm not trying to sell you on the virtues of fish... i just foudn out about it 5mins ago
<blueshoe> just seemed interesting, that's all
* Swynn_hm takes notes
<Maddas> possibly :)
<Maddas> I'd like to see the code for the benchmarks before believing the benchmarks though
<blueshoe> especially for my apps, which are very performance sensitive
<blueshoe> i'm sure you could email him and ask him
<blueshoe> he'd probably be overjoyed at someone showing interest
<Maddas> haha :)
<Maddas> I'm sure it'll get the general interest if it lives up to what it claims
<Maddas> I'm a bit, well, conservative when it comes to believing this kind of things :)
<blueshoe> hmm... just searched google for fish on the ocaml mailing list archive and there's no mention of it
<blueshoe> for a guy who's so eager to show how his language is twice as fast as ocaml you'd think he'd announce it there
<Maddas> yes
<Swynn_hm> mimosa, can I show you my code so far? (it's 13 lines ... I'll put it in a querry window huh?)
<Maddas> especially claiming that it's o
<mimosa> of course
<Maddas> over two times as fast as C when sorting random arrays of floats with qsort
<blueshoe> http://nopaste.snit.ch/ is a good site for pasting code into
<blueshoe> http://www.rafb.net/paste/ is another
<Maddas> blueshoe: to be honest FISh sounds a bit FIShy to me, but if you ever learn more, let me know
<blueshoe> heh, yeah, ok
<blueshoe> doubt i'll be learning more about it any time soon
<Maddas> it sure does sound interesting
<Maddas> I just wonder if it sounds too promising :-)
<ayrnieu> It doesn't sound too promising, because it doesn't promise anything.
<blueshoe> once i master ocaml i might give it another look, though... don't hold your breath on how long that'll be
<ayrnieu> Look at its bloody library =) It doesn't *do* anything.
<blueshoe> well, if it's as fast as he claims that's useful in itself
<Maddas> oh, written in o'caml
<Maddas> haha blueshoe
<Maddas> back in a bit
<Maddas> fish doesn't compile here
<blueshoe> fish wasn't written here :)
<Maddas> sorry, just wanted to note :-)
<blueshoe> no, don't take that as a criticism
<blueshoe> it was just a bad joke
<blueshoe> referring to the "not written here" syndrome
<Maddas> I wonder if it compiles anywhere, that's what I meant :)
<Maddas> heh
<blueshoe> probably only compiles in australia
<blueshoe> on a cray
<Maddas> haha
<Maddas> exactly :-)
<blueshoe> that's why it's twice as fast as ocaml on an intel box
<Maddas> I still mailed the author, just in case
<Maddas> :>
<blueshoe> "A Prediction - Macromedia Flash, along with its goofy little language ActionScript, is a Disruptive Programming Language Technology, as described above in Todd Proebsting's talk. As a programming language, ActionScript has a much brighter future than, say, OCaml."
<blueshoe> the sad thing is he's probably right... the goofy languages shall inherit the earth
<Swynn_hm> I posted my 13 lines of my script so far on http://nopaste.snit.ch:8001/352 :P
<Maddas> blueshoe: he claims that?
<blueshoe> maddas, no, that's from someone else
<Maddas> ok :)
<Maddas> blueshoe: It will definitely be more popular
<blueshoe> would be funny if it was the same guy, though
<Maddas> not due to the language, though, but simply because it's bundled with Flash, whereas O'Caml isn't
<Maddas> haha :)
<blueshoe> right
<blueshoe> and other reasons such as simplicity
<blueshoe> user friendliness
<Maddas> possibly, I don't know ActionScript
<blueshoe> no "This expression has type 'a but is here used with type 'a" errors
<blueshoe> i don't know it either... just guessing
<Maddas> ah, yes, error messages are somewhat confusing
<blueshoe> swynn, so what was your question regarding that code?
<Swynn_hm> oh .. I just wanted some pointers ... since I'm new to ocaml
<vect> Random.self_init();;
<vect> let hello_v = [|'H'; 'e'; 'l'; 'l'; 'o'; ','; ' '; 'w'; 'o'; 'r'; 'l'; 'd'; '!'|];;
<vect> let helloVal_v = Array.init 13 (fun i -> int_of_char(hello_v.(i)));;
<vect> let helloTryVal_v = Array.init 13 (fun i -> Random.int (126+1-32)+32);; (* rand no from 32 to 126 *)
<vect> let helloTry_v = Array.init 13 (fun i -> char_of_int(helloTryVal_v.(i)));;
<vect> let abs x = if x < 0 then x*(-1) else x;;
<Swynn_hm> I've never used a functional language b4
<Maddas> Swynn_hm: if you want a way to create an array of characters out of a string, check the O'Caml examples
<vect> let sum_of_diffs tab1 tab2 =
vect has quit [Remote closed the connection]
<Swynn_hm> did he flood himself off?
<Maddas> I think he accidentally flooded and closed his client as soon as he noticed
<Swynn_hm> Maddas, oic ok
vect has joined #ocaml
<vect> ahem, sorry dudes
<Maddas> hello vect :)
<Swynn_hm> wb vect
<blueshoe> shot your wad, huh?
<Maddas> Swynn_hm: http://tnx.nl/2022DJES
<Maddas> takes a string, returns an array of characters
<Maddas> no wait, a list, sorry.
<Maddas> Make it return an array as an exercise :-)
<Swynn_hm> lol
<Swynn_hm> ok .. I just have to take half an hour to get my head around the recusion again :)
<Maddas> blueshoe: seems like fish is serious
<blueshoe> maddas, yes, that's an interesting article
<Maddas> Swynn_hm: Once you understand it, you should like it
<Maddas> Swynn_hm: I found that it just takes a bit of writing recursive code until you understand it very quickly
<blueshoe> you need to do lots of exercises
<blueshoe> then it'll become second nature
<blueshoe> just like iteration
<Swynn_hm> gotcha
<Maddas> yeah
<Maddas> I actually like recursion more and find it more elegant by now
<Swynn_hm> but why is it bad practise to use "for i = 1 to String.length s - 1" etc etc?
<Maddas> I wouldn't say bad practice, but it's just not functional at all :)
<Maddas> doesn't "fit in" as nicely
<Swynn_hm> ahhhh
<Maddas> note that I'm not an authority by any means though
<Swynn_hm> I kow that recusion can do thing that iterations cant (eg searching tree structures?)
<Swynn_hm> s/kow/know/
<Maddas> Iteration is a subset of recursion
<Swynn_hm> ahhh ok
<Swynn_hm> I'll just have to get used to it :P
<Maddas> and also with for i = 1 to ... you typically have references around, while with recursions you don't
<Maddas> I try to avoid references unless really necessary in O'Caml :)
<Swynn_hm> ok
<Swynn_hm> Maddas, by examples, do you mean the ones I can download from: http://caml.inria.fr/Examples/eng.html ?
<Maddas> that's where I got the explode function from, yes
<Maddas> a lot is in French though :-(
<Swynn_hm> oic oic
<blueshoe> i found the first few shortest examples in there to be useful, as a beginner
<blueshoe> then it gets way too complex, and looses most of the comments
<blueshoe> i'd rather advise you get a good book instead, like cousineau and mauny's "the functional approach to programming", which uses caml light, or ullman's "elements of ml programming", which uses sml97
<blueshoe> the examples in those are very thoroughly explained
<blueshoe> much, much, much, much, much easier to follow than the examples from the ocaml site, imo
<blueshoe> at least for my little brain
<Swynn_hm> gotcha
<blueshoe> then agian, if you've had a ton of comp sci experience you might just be able to make it through the ocaml page's examples without much explanation
<Swynn_hm> hmmmm ... doesn't sound like me somehow :P
<blueshoe> then a good book might be the way
mimosa has quit ["I like core dumps"]
mimosa has joined #ocaml
<Swynn_hm> wb mimosa
<blueshoe> cousineau and mauny's considered advanced, just so you konw... though i found it understandable (at least the first part), if you do all the exercises... ullman's book is super clear
<mimosa> :)
<Swynn_hm> I've found that heaps of ppl in this channel are very open to helping me ... even though I'm totally new to ocaml ... which is great
<blueshoe> but it uses ml, so you'll have to convert the syntax to ocaml, unless you want to learn ml first, which is probably fine too, as they're so similar
<blueshoe> yeah, this channel is great for beginners... lots of very helpful people
<Maddas> I learned O'Caml (the bit that I know) by reading the free ebooks available
<Maddas> not too many people though :-)
<blueshoe> i went through a couple of the online tutorials too
<blueshoe> they're ok... these two books are much better, though, imo... more thorough, maybe... just really spell things out, whereas the online stuff i've found to be more terse
<Maddas> (I think those should be in the topic, too)
<Maddas> possible :-)
<Maddas> I had quite a bit of problems :)
<blueshoe> yeah, i have that hickey book too
<Maddas> knowing a little Scheme definitely helped
<blueshoe> i scoured the net for ocaml tutorials
<blueshoe> i didn't know any scheme or any other fp language before starting w/ocaml
<Swynn_hm> what about the book and tutorial in the subjec of this channel ... any good?
<blueshoe> i actually never did read the 'learning ocaml for c,c++, perl and java programmers'
<blueshoe> so i can't say
<Maddas> I looked at it, I found it too brief though
<blueshoe> remy's book is too terse also, imo... and seems kind of advanced
<blueshoe> anyway, i have to go to sleep... work tommorow
<Swynn_hm> cu blueshoe
<blueshoe> bye swynn, maddas
<Maddas> wait!
<Maddas> blueshoe!
<Maddas> FISh runs on solaris :-)
<blueshoe> ?
<blueshoe> only?
<Maddas> I don't know
<Maddas> They provide binaries for Solaris
<Maddas> oh, isn't RedHat 5 old?
<Maddas> looks like FISh isn't too maintained anymore
<blueshoe> yeah, i've read that jason hickey book, swynn... it's better than the remy book, but, again, still not with as much explanation, and not as high a quality as the real paper books you have to pay money for :)
<Swynn_hm> gotcha
<blueshoe> yes, redhat 9 is even old
<blueshoe> though not very old
<blueshoe> we have a bunch of redhat 7.3 machines where i work, for a few years ago
<blueshoe> for=from
<blueshoe> anyway, i'll see you guys later
blueshoe has quit ["_"]
mimosa has quit ["I like core dumps"]
mimosa has joined #ocaml
Swynn_hm is now known as Swynn_hm_afk
codeburnt has joined #ocaml
<codeburnt> can you redine individual class methods and change the existing class instances to use the new method
<codeburnt> s/redine/redefine
Kinners has joined #ocaml
_JusSx_ has joined #ocaml
<_JusSx_> wuuru : heya
<wuuru> _JusSx_: :-)
<_JusSx_> wuuru : how are you?
<wuuru> good... you? :-)
<_JusSx_> quite well
<wuuru> the weather became much warmer, -2 C today instead of -22 last week :-)
<_JusSx_> great : even here it's warmer today
<wuuru> :-)
<_JusSx_> i think it will be 10 C
<_JusSx_> maybe you can say it's hot
<wuuru> Modena, Italy: +7C
<wuuru> Valencia, Spain: +18C
<_JusSx_> great
<wuuru> no, I'd rather move to Spain :-)
gim|570 has joined #ocaml
wazze has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
gim|570 is now known as gim
Kinners has left #ocaml []
karryall has joined #ocaml
codeburnt has quit ["Leaving"]
tomasso_ has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
<Maddas> hum
<Maddas> how do I trace a variable inside a function?
<karryall> whadayamean, "trace" ?
<wuuru> Maddas: find a '=' sign and see the right-hand side expression. that will be the value of the variable
<wuuru> let variable_name = ...
<Maddas> wuuru: :)
<Maddas> can't you #trace variables?
<Maddas> never mind, you can only trace functions
<wuuru> Maddas: you need to trace variables in languages where the value of a variable may change
<wuuru> Maddas: not in ocaml
<Maddas> wuuru: yes, in ocaml
<Maddas> wuuru: read about references
<wuuru> no, not in ocaml
<Maddas> yes, O'Caml
<Maddas> or read about Arrays
<Maddas> or Records
<Maddas> :)
<wuuru> hm :-)
<Maddas> O'Caml is not a purely functional language
<wuuru> got it
<Maddas> You want Haskell :)
<wuuru> in fact, using references or mutable records is abusive
<wuuru> however, arrays really could be of use
<wuuru> :-)
<Maddas> :)
antc has joined #ocaml
pou has quit [Read error: 54 (Connection reset by peer)]
ott has quit ["×ÁÌÉÔØ"]
antc_ has joined #ocaml
antc has quit [brunner.freenode.net irc.freenode.net]
__DL__ has quit [brunner.freenode.net irc.freenode.net]
mimosa has quit [brunner.freenode.net irc.freenode.net]
antc has joined #ocaml
__DL__ has joined #ocaml
mimosa has joined #ocaml
antc has quit [Read error: 104 (Connection reset by peer)]
mimosa has quit [brunner.freenode.net irc.freenode.net]
__DL__ has quit [brunner.freenode.net irc.freenode.net]
teratorn- has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
mimosa has joined #ocaml
kruskal has joined #ocaml
karryall has quit ["home"]
__DL__ has quit [Remote closed the connection]
srv has quit ["leaving"]
srv has joined #ocaml
kruskal has quit ["Leaving"]
kruskal has joined #ocaml
shawn has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
async has joined #ocaml
gim_ has quit ["zzz.."]
mimosa has quit ["I like core dumps"]
<async> are hashing functions usually O(1)?
<Riastradh> Depends on what kind they are. Identity hashing, typically yes, but structural hashing, probably no.
<async> that makes sense
<__DL__> the hashing function of the stdlib is not O(1)
drWorm has joined #ocaml
__DL__ has quit [Remote closed the connection]
_JusSx_ has quit ["User abortion with 5 coathooks"]
antc_ has quit ["Leaving"]
kruskal has quit ["Leaving"]
blueshoe has joined #ocaml
kruskal has joined #ocaml
kruskal has quit [Client Quit]
gim has quit [Read error: 104 (Connection reset by peer)]
gim has joined #ocaml