dylan changed the topic of #ocaml to: OCaml 3.09.1 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/
shawn has joined #ocaml
mrsolo__ has quit [Read error: 104 (Connection reset by peer)]
mrsolo__ has joined #ocaml
dark_light has joined #ocaml
dark_light has quit [SendQ exceeded]
dark_light has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
dark_light has quit [Success]
ramkrsna has joined #ocaml
mattam has quit [zelazny.freenode.net irc.freenode.net]
slipstream has quit [zelazny.freenode.net irc.freenode.net]
illya23b has quit [zelazny.freenode.net irc.freenode.net]
Demitar has quit [zelazny.freenode.net irc.freenode.net]
Bigb[a]ng has quit [zelazny.freenode.net irc.freenode.net]
slipstream has joined #ocaml
mattam has joined #ocaml
Bigb[a]ng has joined #ocaml
illya23b has joined #ocaml
Demitar has joined #ocaml
shawn has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
SpiderX has joined #ocaml
<SpiderX> can I just say one thing?
<dylan> I tell you what, you can say two things.
cmeme has quit [Connection timed out]
<SpiderX> you are awesome
<SpiderX> ok
<SpiderX> 1. ocaml sucks.
<SpiderX> 2. python kicks its ass. I mean really... a python vs a camel?
cmeme has joined #ocaml
<SpiderX> hmm,
<SpiderX> yes it blows
<dylan> SpiderX: that was five things.
<dylan> six now.
<dylan> anyway, is there a particular point to this?
Skal has joined #ocaml
<SpiderX> lol your line counter sucks - you should rewrite it in python
<dylan> this sort of inanity isn't helpful.
<SpiderX> you are absolutely right. I should stop that.
<SpiderX> whats with 'let'
<SpiderX> like I have to give the program permission to do something?
<dylan> now, I'm going to go back to writing a toy algebra evaluator.
<dylan> let is a way of defining a symbol...
<dylan> python is broken in the aspect that it confuses assignment with declaration, IMO.
<dylan> if you don't like let, perhaps haskell is more your cup of tea.
<dylan> it uses it much less frequently.
<dylan> (and even allows an alternative, "where")
<SpiderX> haha
<dylan> also, it has list comprehensions just like python!
<SpiderX> but assignment IS declaration
<dylan> and a whitespace sensitive syntax.
<SpiderX> thats the beauty
<dylan> assignment is not declaration!
<Smerdyakov> SpiderX, what are you doing here?
<dylan> Smerdyakov: I would bet LSD.
<SpiderX> yes, in weakly typed languages it is
<dylan> Smerdyakov: or esctasy.
<dylan> SpiderX: not in perl, it isn't.
<SpiderX> thats because perl is strongly typed.
<dylan> (the distinction is rather different in ocaml anyway, as it doesn't have variables like python-ish languages do)
<dylan> LOL!
<dylan> perl is strongly typed?
<SpiderX> yes
<SpiderX> everything is assigned a type
<dylan> it is?
<Smerdyakov> SpiderX, have you ever written an ML program?
<dylan> and in python it isn't?
<SpiderX> yes
<dylan> python is weakly typed, and perl is not?
<SpiderX> correct
<dylan> SpiderX: Where do you buy these powerful drugs?
<SpiderX> I work for the distributor
<SpiderX> McKesson.
<dylan> I see.
<SpiderX> yeah, I get an employee discount.
<dylan> Smerdyakov: He uses some drug that makes perl appear to have a type system. Isn't that amazing?
<SpiderX> i mean, why cant you add an integer to a float?
<dylan> SpiderX: in ocaml?
<SpiderX> yeah
<dylan> the same reason you can't append an integer to a string in python.
<Smerdyakov> SpiderX, have you ever written an ML program?
<SpiderX> yes
<Smerdyakov> Basically, I'm trying to figure out if you have mean to have a legitimate conversation or if you are trolling.
<SpiderX> can you say anything other than "have you ever written an ML program" Smerdyakov ?
<dylan> I'd guess trolling, meself.
<SpiderX> of course I have written a machine language program before.
<dylan> or drunk / on drugs / a bot.
<Smerdyakov> SpiderX, of course, by ML I mean "Standard ML or OCaml."
<dylan> Especially with that comment.
<SpiderX> there can be multiple meanings of ML
<Smerdyakov> The meaning is clear here.
<SpiderX> now it is.
<dylan> so answer the question.
<SpiderX> yes
<dylan> you have written an SML or O'Caml program?
<Smerdyakov> SpiderX, can you please summarize your experience using ML?
<SpiderX> I wrote a program.
<SpiderX> Smerdyakov, can you summarize your experience using ML?
<dylan> what did this program do?
<SpiderX> take a CSV file, convert it into XML
<Smerdyakov> SpiderX, sure. I've written several compilers, theorem provers, and program analysis tools.
<SpiderX> wow you must be an expert or something
<Smerdyakov> I sure am.
<SpiderX> thats great.
<SpiderX> I have a friend that is an expert on horse manure.
<SpiderX> are you my friend, Smerdyakov?
<Smerdyakov> OK, so let me see if I understand. You have written one ML program worth calling a program, and it converts a CSV file into XML. Am I right?
<SpiderX> yeah
* dylan prays to the operators of this channel.
<SpiderX> reads in an ini file for the parimeters.
<Smerdyakov> OK, so now I know you're trolling, or you are so inexperienced a developer that you're not worth taking seriously.
<SpiderX> maybe both
<dylan> I wrote an .ini file parser that wade .ini files turing-complete.
<SpiderX> either way, i'm not the one sitting in the ocaml room looking to chat.
<SpiderX> oh wait...
<dylan> SpiderX: I'm not looking to chat, I'm having fun writing a toy algebra evaluator.
<SpiderX> right, a toy algebra evaluator... what are you in school for a CS degree?
<Smerdyakov> Good work. Get more good practice like this and you can be an Olympc backpedaling gold medalist some day.
<SpiderX> i mean... wow.
<dylan> backpedaling?
<SpiderX> yeah I'm kinda lost on that one Smerdyakov
<SpiderX> does backpedaling mean something in ML?
<Smerdyakov> "Backpedaling" is a common American English phrase for trying to change your position on something without making it clear that you were wrong.
<SpiderX> oh
<SpiderX> nah, I wrote a program in Python to do that for me.
<dylan> why don't you write a python program to simulate intelligence, you're clearly in need.
<dylan> trying to troll #ocaml is about most boring idea ever.
<SpiderX> hahah
<SpiderX> name a part of windows written in Ocaml
<dylan> name a part of windows written in python
<Smerdyakov> The Windows Device Driver Toolkit
<SpiderX> the DDK?
<Smerdyakov> ...now contains a substantial tool called the Static Driver Verifier written in OCaml
<dylan> Microsoft seems to have a small amount of love for ocaml, or a subset of it anyway
<Smerdyakov> OK, now name a part of Windows written in Python?
<SpiderX> Python can't write shitty code, so it isnt used in Windows.
<SpiderX> ha!
<dylan> python can infact write shoddy code.
<SpiderX> I didnt say shoddy.
<dylan> where shoddy == the word you used.
<SpiderX> is that an assignment or a comparison operator?
<dylan> it is comparison. I am unaware of a language where it is assignment.
<SpiderX> cause the answer is false if its comparison
<SpiderX> I can see you are an inexperienced programmer.
<dylan> oh, yep.
<SpiderX> its okay
<SpiderX> thats why you have to write toy programs.
<SpiderX> once you build enough of those, you can move on to real work.
<dylan> I'm writing toy programs because I'm sick with the flu and can't sleep.
<SpiderX> oh
<dylan> inbetween puking, I work on the ast... and read this drivel. :P
<SpiderX> my bad man
<SpiderX> namaste
<SpiderX> well, you get better... I can troll another day.
<dylan> you might have better luck in #ruby or #perl. :P
<SpiderX> hmm, I can hate on some perl...
SpiderX has left #ocaml []
<dylan> heh. well, at least my puking is good for something. :P
Smerdyakov has quit ["Leaving"]
<pango> yeah, you expelled him ;)
shawn has joined #ocaml
love-pingoo has joined #ocaml
pango is now known as pangoafk
pangoafk is now known as pango
Revision17 has joined #ocaml
andreas_1 has joined #ocaml
<andreas_1> Hi
ppsmimou has joined #ocaml
<andreas_1> I am pretty new to ocaml and get an error message by the compiler that I do not quite understand. Would some maybe have a look at the code? http://rafb.net/paste/results/uQLfxu67.html
_fab has joined #ocaml
<andreas_1> The compiler gives me:File "alignment.ml", line 47, characters 6-9:
<andreas_1> Syntax error: ')' expected
<andreas_1> File "alignment.ml", line 31, characters 24-25:
<andreas_1> This '(' might be unmatched
<ski> what if you replace the last 'done' with 'done;' ?
<ski> andreas_1 : btw, why do you have a 'let ret = ...' but with no 'in', there ?
<andreas_1> mom, I try
<andreas_1> File "alignment2.ml", line 47, characters 95-97:
<andreas_1> Syntax error
<andreas_1> aktually the "let ret = {..." is just a work around for returning the record, all I want is to return the record ;)
PierreTramo_ has joined #ocaml
<ski> then just write the record '{...}', no 'let ret = ' needed for that :)
<andreas_1> do still need the ;; at the end then?
<ski> in '(e0 ; e1 ; e2 ; e3)' the value of 'e3' is returned as value of whole expression
<ski> i don't think you need that
PierreTramo_ is now known as PierreTramo[iboo
PierreTramo[iboo is now known as Pierre[ibook]
<andreas_1> File "alignment2.ml", line 47, characters 1-79:
<andreas_1> This expression has type alignmet but is here used with type unit
<andreas_1> do the "try" and the "with" block have to return the same type?
<flux__> yes
<ski> they return to same place, so same type of value is expected, regardless which path was taken there
<flux__> not unlike an if-statement, match or a function needing to return the same type in all branches
revision17_ has joined #ocaml
<ski> the only difference between the two paths seems to be the 'xchars' field
<andreas_1> well in fact the first path should NEVER be taken, it's just there to make the compiler happy
<ski> if you want to avoid the code duplication, you can do something like 'let x = try ..tmp.. with ..x.. in {... xchars = x; ...}'
<ski> oh
<ski> you can then put something like 'raise CantHappen' in place of the first record
<ski> (with an appropriate 'exception CantHappen' declaration in scope)
<ski> (or maybe some assertion ..)
<andreas_1> sounds good
<andreas_1> let me try
<ski> yes, 'assert false' is proly better
<andreas_1> what does assert false do?
Revision17 has quit [Read error: 110 (Connection timed out)]
<ski> it's meant for use in places where execution cannot reach (but something must be put there, for typing reasons), and also for places where execution shouldn't reach, in a bug-free program (so reaching it e.g. can signify that some program-invariant has been broken)
<andreas_1> so where would I put the assert exactly? (btw: thx for helping)
<ski> 'assert false' never returns a value, instead it aborts execution .. this means that it is safe to say 'assert false' has any type you like (e.g. 'alignment'), since it will never actually return a value, this is safe
<ski> replace the first record construction (the one that you thought was unnecessary first) with 'assert false'
<flux__> failwith is nice
<andreas_1> it works ;)
<ski> yes, that will give a reason for failing, too
<ski> btw, there's also 'assert ..any boolean expression..', which will just abort if the boolean expression evaluates to false, otherwise it returns the trivial value '()' (so this can't be used in your case .. 'assert false' is a special case)
_fab has quit [Remote closed the connection]
<andreas_1> oh
<andreas_1> ocaml is better than I thought - way better ;)
<andreas_1> oh, one more question
<ski> :) ask away
<andreas_1> This code is for my diploma thesis project. From previous programming work I am used to structure all the components into classes. However with OCaml I figured that I could write my own Modules as well. Modules seem to do similar things as classes. So is there anything wrong with using modules instead of classes?
<ski> absolutely not, in most circumstances, i'd say
<andreas_1> nice to hear that
<ski> (statically typed) OO languages tend to put module features into the class system, instead of having a proper module system
<ski> some kind of programs fit well into objects and classes style, but that doesn't hinder that modules is still useful in those cases
<mellum> well, actually, many OO languages have a "namespace" concept that is similar to what modules do (minus functors)
<ski> more or less : use modules for name control, hiding implementation, abstract datatype etc, and classes for e.g. (code) inheritance, open recursion, etc
<sieni> I guess at least in C++ you can use abstract classes and templates to do functor-like stuff
<ski> mellum : ok, i possibly wasn't completely fair :) .. but that still corroborates the point that modules are still useful, even with class- and object-ful programming :)
<andreas_1> Actually I won't need much inheritance. It's mainly data structures and algorithms that act on them. So I think I will group each structure and the corresponding algorithms in separate modules.
<mellum> ski: sure.
<mellum> andreas_1: then you probably don't need any classes at all.
<andreas_1> Lunch calls ;) I'll be back soon. THX for helping
<pango> beware that @ complexity is O(n) however
<pango> if you construct big lists, it could become a problem
<pango> better build lists in reverse using :: and use List.rev as a last step
<pango> List.nth complexity is also O(n)
andreas_1 has quit []
andreas_1 has joined #ocaml
<andreas_1> So what would be a better way to do this? I tried with Arrays first, but with arrays you have to know the exact size before hand, which is why I could not use them
<pango> for @, try building lists in reserve, as I already suggested
Schmurtz has quit ["Plouf !"]
<pango> you could also try installing extlib, which provides dynamic arrays... http://ocaml-lib.sourceforge.net/doc/DynArray.html
Pierre[ibook] has quit ["Ex-Chat"]
<pango> interesting lapsus... s/reserve/reverse/ ;)
<andreas_1> I just downloaded and extracted extlib, it contains just the module files. How can I now use the package?
<pango> no idea, never used it ;)
<pango> and if I had, I would install the Debian package, so it would be fully automatic
<pango> there's a README.txt in the tarball
<ski> andreas_1 : simplest rn would prolly be to just to add to front of list, instead of add to back
<ski> i.e. instead of doing 'snames := !snames @ [ !sname ]' do 'snames := !sname :: !snames', and finally, instead of putting 'names = !snames' into the record, put 'names = reverse (!snames)' into the record (this last step is only needed if you really want this order of elements, instead of e.g. element order doesn't matter)
<ski> and, of course, mutatis mutandis for 'seqs' and 'sequences'
<andreas_1> thx
<andreas_1> I think I will try the DynArray because the O(n) runtime of List.nth is pretty bad, Arrays have constant random access right?
<ski> adding element to front of list, with '.. :: ..' (or even with '[..] @ ..') is cheaper than adding to back of list '.. @ [..]'
<ski> andreas_1 : yes .. but i dunno about DynArrays .. (mayhaps they have O(log(n)))
<pango> they probably use exponentially reallocated arrays
<ski> m .. could be
<pango> I wouldn't call that structure array otherwise :)
<ski> i think i've seen things called arrays that had logarithmic access
<pango> yuck :)
<andreas_1> extlib installation complete
<andreas_1> does anybody know how to compile a program that uses extlib modules?
<andreas_1> I have rewritten my program to use DynArray instead of lists, however when i run "ocamlc -o alignment alignment.ml" I get the following error: Error while linking alignment.cmo: Reference to undefined global `DynArray'
<love-pingoo> andreas_1: something like "ocamlfind ocamlc -package extlib -link alignment.ml -o alignment"
<love-pingoo> ocamlfind expands that to the correct ocamlc call with -I and -L options
<andreas_1> hmm, I don't have "ocamlfind" - I am working on a mac with ocaml installed via darwinports :(
<pango> ocamlc -o alignment extLib.cma alignment.ml ?
<andreas_1> THX, it works :))
<andreas_1> so what exactly does the command do?
<pango> link the bytecode compiled version of extlib to your program
<andreas_1> the extLib.cma is the bytecode compiled version of extlib?
<pango> yes, and .cmxa is native compiled version, if available
<love-pingoo> it would be good to manage to install ocamlfind
<love-pingoo> makes things really easier, especially as your project grows bigger
<andreas_1> unfortunately darwinport does not have the findlib package, so I will have to compile it myself I guess
<love-pingoo> sad
ramkrsna has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
andreas_1 has left #ocaml []
Smerdyakov has joined #ocaml
Skal has quit [Remote closed the connection]
love-pingoo has quit ["Leaving"]
<dylan> hmm.
<dylan> dynamic loading isn't supported on open bsd?
altDanly has joined #ocaml
danly has quit [Read error: 110 (Connection timed out)]
pango is now known as pangoafk
_JusSx_ has joined #ocaml
pangoafk is now known as pango
smimou has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
shawn has joined #ocaml
love-pingoo has joined #ocaml
<_JusSx_> hi can you explain what is wrong with "type a = A of { a: int };;"
<_JusSx_> ?
<_JusSx_> SML allow such kind of declaration
<love-pingoo> # type a = A of t and t = { a: int };;
<love-pingoo> unfortunately it looks like caml asks you to name the intermediate record type
<_JusSx_> humm
<_JusSx_> i don't like
<love-pingoo> that's unfortunate.. on the other hand it allows caml to use the name "t" instead of the whole type in error messages
<_JusSx_> however thanx a lot for the tip
Hadaka has quit [Read error: 110 (Connection timed out)]
sieni has quit [Read error: 110 (Connection timed out)]
joshcryer has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
shawn has quit ["This computer has gone to sleep"]
shawn has joined #ocaml
ppsmimou has quit [Read error: 110 (Connection timed out)]
shawn has quit [Connection timed out]
shawn has joined #ocaml
gim has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
sieni has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
ulfdoz has quit [zelazny.freenode.net irc.freenode.net]
khaladan has joined #ocaml
ulfdoz has joined #ocaml
ulfdoz has quit [zelazny.freenode.net irc.freenode.net]
ulfdoz has joined #ocaml
PierreTramo_ has joined #ocaml
ppsmimou has joined #ocaml
Axioplase has joined #ocaml
<Axioplase> Hi
<dylan> Hi
<love-pingoo> Hi
_JusSx_ has quit ["leaving"]
gim has joined #ocaml
PierreTramo_ has quit [Read error: 113 (No route to host)]
smimou has quit ["bli"]