mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
mrpingoo has joined #ocaml
hkBst has quit ["Konversation terminated!"]
coucou747 has quit ["bye ca veut dire tchao en anglais"]
Kopophex has quit [Read error: 110 (Connection timed out)]
<palomer> back
<palomer> nuncanada, functors?
<palomer> oh, you want them first class
Jeff_123 has joined #ocaml
<palomer> whoa! I threw ocamlc into an infinite loop
<palomer> wicked
<Jeff_123> :)
<Jeff_123> ya I can't say i've seen that before
<palomer> *** omake: finished reading OMakefiles (0.0 sec)
<palomer> ...
<palomer> ...
<palomer> never ends!
<Jeff_123> I should learn ocamlbuild. I still just write my own little compile scripts.
<nuncanada> objects are first class?
<palomer> nuncanada, yes
<nuncanada> will try them
<nuncanada> for the simple interface that solves the problem :)
<nuncanada> thanks
<palomer> objects rock!
<Jeff_123> eh, they're ok
<palomer> they're wicked cool
<palomer> typing wise, they are to records what polymorphic variants are to variants
<Jeff_123> I think they might be more powerful than that :)
Loki_ has joined #ocaml
<Jeff_123> would anyone like to help try getting my unsigned 64-bit integer library to link to native code?
<Jeff_123> I've tried it on 3 systems and I always get linking errors. With ocamlc it's fine.
<palomer> ok, I'll help out
<Jeff_123> awesome. let me make sure the version on my webspace isn't different from what I'm using now
<Loki_> Hi all - I've been reading about some of the cool features of ocaml and I was wondering/hoping someone could recommend a book/books and tutorials that would help a newbie learn the language
<Loki_> the ones listed on the language page seem a little dated
<Loki_> any advice would be greatly appreciated
<Jeff_123> the free ocaml o'rielly book is pretty good
<kig> the ocaml manual + ocamlbrowser and reading through the stdlib sources with some thought kinda helped me along
<palomer> the cambridge book is the best!
<Loki_> cambridge?
<Jeff_123> ignore the compile.ml
<palomer> Loki_, lemme look it up
<Jeff_123> ocamlopt uInt64.c uInt64.ml test.ml
<Jeff_123> ld: duplicate symbol _camlUInt64__code_begin in uInt64.o and uInt64.o
<Jeff_123> collect2: ld returned 1 exit status
<Jeff_123> Error during linking
<Jeff_123> test.ml is just "print_endline (UInt64.to_string UInt64.zero)"
<palomer> Jeff_123, tell me what to do
<palomer> File "uInt64.ml", line 1, characters 0-1:
<palomer> Could not find the .cmi file for interface uInt64.mli.
<Jeff_123> ocamlopt uInt64.mli
<palomer> (.text+0x2d4): undefined reference to `to_string'
<palomer> etc...
<Jeff_123> ya exactly :)
<palomer> Loki_, check out that link
<Loki_> oh cool
<Loki_> thanks palomer
<palomer> it's a good book
<palomer> I especially like the chapters on subtyping
<palomer> http://ocaml.pastebin.com/me7cf7a4 <---can someone compile this with ocamlc?
<Loki_> I'm mainly going to be using ocaml in my scientific work - I _hate_ c, but I'm really limited in options for scientific computing. Jon Harrop keeps raving about his own book on the forums, but I've been putting in interlibrary loan requsts for five moths now to no avail
<palomer> which book is this?
<Jeff_123> he raves about his own stuff a lot.
<Loki_> Ocaml for Scientists
<Loki_> the title struck me
<Jeff_123> It's probably a good book. Don't bother with his journal though, it's mostly stuff you can learn from free tutorials.
<Loki_> ah
<Loki_> considering the exchange rate for the dollar, I'd have to be insane to try to buy access. And my university won't because it's not put out through the usual channels or something
<Jeff_123> its a private journal; he's the only contributor
<Jeff_123> it has basically no academic value
<Loki_> well, I guess that explains it
<palomer> that website seems pretty quirky
Amorphous has quit [Read error: 110 (Connection timed out)]
<Loki_> how 'experimental' is JoCaml? I'm concerned that if I write code for it I'll either be left in the dust when the syntax changes radically or I'll be out of luck when the developers get bored
Amorphous has joined #ocaml
<Jeff_123> palomer -if you get rid of inherit node then it works
<Jeff_123> loki - you need concurrency?
<Loki_> some of my work involves neural networks
<Jeff_123> palomer - I'm looking at ocaml's language spec and it doesn't look like
<Jeff_123> "inherit" is a keyword for class signatures
<palomer> but, erm, I've inherited from class types before
<thelema> palomer: don't define get_right_sibling twice.
<Jeff_123> loki - I was wondering because if you're not doing multithreaded or distributed computing then you don't technically need jocaml
<Loki_> Jeff_123, true
<Jeff_123> although it might be easier, I dunno (I've never used jocaml...)
<palomer> thelema, it freezes ocaml!
<palomer> doesn't that freak you out?
<thelema> palomer: freezes? as in the compiler stops?
<Jeff_123> it doesn't freeze mine
<palomer> thelema, yes! doesn't it for you?
<Jeff_123> no
<palomer> oh
<palomer> what version you got?
<thelema> palomer: well, the toplevel deals with it ok.
<Jeff_123> er oops, didn't mean to reply for thelema :P
<palomer> try ocamlc
<thelema> palomer: my ocamlc errors out just fine.
<thelema> 3.10.2
<palomer> aw man
<Jeff_123> hehe, mine doesn't even give an error
<palomer> that's funky
<thelema> Jeff_123: you mean without the [include node], no?
<thelema> err, inherit node
<Jeff_123> I added it back in
* pango gets a nice 13 lines long error message... (3.10.1)
<thelema> palomer: I recommend you comment out all class types.
<Loki_> palomer, this book looks like a great intro - what would you recommend I read to further advance my ocaml knowledge?
<palomer> Loki_, this book!
<Loki_> no, I mean after that
<thelema> pango: I guess I get the same message - mine's 13 lines too.
<palomer> so my ocaml freezes, Jeff_123 compiles and yours gives you an error
<palomer> funky.
<Loki_> for instance, I'm particularly interested in performance and optimization - neither seemed to be covered here
<palomer> Loki_, compiler optimization?
<Jeff_123> loki - ocaml compiles everything as you code it pretty much
<palomer> linear programming?
<palomer> integer linear programming?
<palomer> optimization means a gizillion different things!
<palomer> thelema, I just thought I was on to something
<palomer> I don't actually want to compile that code!
<palomer> anyways, I should get running
<palomer> thx!
<thelema> palomer: you should probably upgrade.
<Jeff_123> palomer - commenting out the duplicate method like thelema said worked for me (the above pastebin link)
pango has quit [Remote closed the connection]
<Loki_> you're right - I'm mainly interested in sequence alignment algorithms, evolutionary algorithms, and neural networks. Ocaml sounding interesting because it could perform so well on numerical tasks and yet be a very high-level language. If the compiler transform what I write to native code pretty much how I write it then I'm still looking for guides on how to write code that doesn't wast cycles
<Loki_> ^sounded
<Loki_> waste
<Loki_> damn
<thelema> Loki_: 1) learn ocaml, 2) learn how the various types get implemented, 3) learn how the GC works, 4) profit
<thelema> err, 4) write fast code in OCaml.
<Loki_> got it
<Loki_> any advice on where I can find resources to achieve 3?
pango has joined #ocaml
<Loki_> hell, even 2
<thelema> http://www.ocaml-tutorial.org/garbage_collection <- can get you started on 3
bzzbzz has quit ["leaving"]
<thelema> for 2, there's good docs in the refman - http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html section 18.3
<Loki_> thelema, thanks!
<thelema> I think you'll learn a lot how ocaml works by reading about its C interface.
<thelema> (I have)
<Jeff_123> if youwant to play with the c interface, feel free to look at my uInt64.c file, and let me know if you can get it to link with ocamlopt ><
mrpingoo has quit ["Connection reset by pear"]
<pango> Chapter 9 of "Developing Applications with Objective CAML" is a good resource about garbage collection too... more "implementation oriented" than the ocaml-tutorial page
jlouis has quit [Remote closed the connection]
<Loki_> pango, got it. thanks
<pango> Loki_: while OCaml seems to allow good numerical performance and high level code, I'm not 100% confident you can have both... For example floats are always boxed across function calls
<Loki_> pango, I don't mind writing low level, fast code when I have to when I can jump back up to a high-level again without headaches
<Loki_> is this the case?
<thelema> pango: ocaml will allow moderately high level code with high performance. OCaml doesn't do the optimizations needed for really high-level code to run fast.
<thelema> as for jumping to C, absolutely.
<thelema> just don't allocate too much memory in C, as you'll have to play nice with the GC, and that might require asprin.
<Jeff_123> I could be mistaken, but one performance issue I've had with ocaml is slow array access.
<thelema> Jeff_123: array.unsafe_get
<Jeff_123> I tried that
<Jeff_123> it could be that my testing was b ad
<Loki_> array/matrix access is something I need to be fast
<Jeff_123> I think I posted what I did to a forum, lemme look
<thelema> Loki_: bigarrays are fast
<Loki_> ah, good
<Loki_> is there some reference comparing the relative performance of these sorts of things?
<thelema> I imagine you could write a micro-benchmark pretty easily.
<Loki_> hmm
<Jeff_123> bigarrays are slower than regular arrays I think
<thelema> but benchmarks are like miniskirts
<jdrake> What editors do you guys use to write ocaml code? (I am staying away from vim and emacs though)
<Loki_> there are several eclipse plugins
<thelema> jdev: emacs for me...
<thelema> err, jdrake: emacs for me.
<Jeff_123> i use aquamacs (mac) and xemacs (windows)
<jdrake> I could never get into emacs, and eclipse I find is horribly slow
<jdrake> I am using gedit currently, but its syntax highlighting has a few issues
<Loki_> I'm running eclipse on a 400mhz PII and it's still decently fast
<thelema> jdev: talk to me about gedit's syntax highlighting - I wrote the syntax highlighting definition.
<jdrake> thelema: perfect :-)
<jdrake> I am no good at regular expressions they use there
<thelema> grrr... jdrake: see above.
<thelema> yes, regexes are definitely voodoo.
<jdrake> If I have an identifier: sceneAppend it will match the 'variant' part on 'Append' and make it bold, leaving the 'scene' normal
pango has quit [Remote closed the connection]
pango has joined #ocaml
<thelema> jdrake: first question: what version of gedit?
<jdrake> gedit 2.22.1
<jdrake> I am running an up to date ubuntu system
<thelema> me too. that helps.
<thelema> you're right. I'll have to fix that bug (although the caml way doesn't involve camelcase.)
<jdrake> haha
<jdrake> Can you tell me what the fix would be?
<thelema> well, what I'd want to do involves matching all identifiers, but the gedit people don't want to do that, so I'll try putting in a \W on line 116, so it only matches cap-indents that start words.
<jdrake> I tried \w+
<jdrake> Didn't really work
<thelema> (I think \W is the right code - I'm looking it up now)
<thelema> nope. I'm looking for the assertion that there's a word boundary here.
<thelema> ah, \b
pango has quit ["I shouldn't really be here - dircproxy 1.0.5"]
pango has joined #ocaml
<thelema> grr...
<jdrake> I was thinking on writing a plugin for an ocaml console, similar in concept to what camelia provides
<thelema> doh, editing the wrong file.
<pango> Loki_: for completeness, I think you should at least have a look at optimizing compilers like MLton... It's SML, but the languages are quite similar
<jdrake> I do believe that \b fixed it
<thelema> jdev: do constructors still get highlighted?
<thelema> jdrake: I mean you.
<jdrake> thelema: Copy this code: http://paste.lisp.org/display/60614
<jdrake> I believe the answer is yes
<jdrake> THat code is by no means 'good', it is in progress. Of course any comments are welcome :-)
Kopophex has joined #ocaml
<jdrake> I am essentially taking some code from here and there and getting my target idea working with the limited ocaml knowledge I retain.
<thelema> nope, it seems \b kills highlighting of None and Circle. otoh, it may be debatable that they need highlighting...
<jdrake> It works here
<jdrake> Line 116 to verify is <match>\b\%{cap-ident}</match>
<Loki_> pango, I will do so. Incidentally - do any other languages boast a similar high-performance and high-level to ocaml?
<thelema> hmm, that's what I have too... are None and Circle in black?
<jdrake> No, they are in some cyanish colour and bold
<thelema> jdrake: great. do you want to submit the patch to gedit?
<jdrake> thelema: Nah, you came up with the solution
<jdrake> Can I call my
<jdrake> oops
<jdrake> Can I call my 'sceneAppend', simply append without causing issues elsewhere being it is using my own types?
Jeff_123 has quit []
<thelema> jdrake: suggestions on code: don't use None in types shape and scene.
<jdrake> ok, that part I copied from other code :-)
<thelema> jdrake: and defining sceneAppend twice doesn't work like you think.
<jdrake> thelema: are you reading my mind?
<thelema> yes.
<thelema> Psycorps: we're everywhere, for your convenience.
<jdrake> haha
<jdrake> Is that like a geek thing that is assumed we have watched B5?
<thelema> oops, Psi Corps.
<jdrake> We are mother and father.
<thelema> The corps is mother, the corps is father.
<jdrake> ok, two questions: How do I think it works, and how does it work, or how to make it work like I want it to?
<thelema> you think you're defining the function in pieces, like haskell allows.
<jdrake> I am expecting pattern matching
<jdrake> I shall be back in a moment...
<thelema> in fact, you define two separate functions, the second of which ends up with the binding.
<jdrake> hmm
<jdrake> That certainly isn't good
<jdrake> That would explain why you wrote the other code last night :-)
<thelema> yup.
<jdrake> ok, I need to do some fun stuff with this code
<jdrake> So sceneappend would be the name of a caml style function?
<thelema> scene_append
<jdrake> Now why isn't camel case used?
<thelema> why don't java programs use _-style names. That's just the culture.
<thelema> the author of camomille (unicode library) used camlcase names for lots of his identifiers
<jdrake> lpszCaption in the windows api :-)
<thelema> it's permitted, but most common is to use _
<thelema> most common in ocaml is _
<jdrake> ok, well I do prefer camel, but fitting in with those names has value too
<thelema> very little value.
<thelema> if you actually have a preference, then use camelcase.
<thelema> if you don't, use _
<jdrake> Is there any method of writing this code where I can use simple names like append without clobbering other appends?
Loki_ has quit [Read error: 113 (No route to host)]
Loki_ has joined #ocaml
<thelema> jdrake: in ocaml, each module has its own namespace - you won't clobber any other appends from your file. (excepting if you open other modules, and just don't open anything with an append)
<jdrake> hmm, I would like to set this thing up to be able to render a scene, but this renderer being in a library of sorts.
<jdrake> Although I should focus on getting it to render something first.
<thelema> render somthing first. if you design it well, librarification should come easy
<jdrake> thelema: oh yes there is another problem with the syntax definition file. IF you uncomment the code I stored from last night, the 's2' becomes highlighted different. The '2' is highlighted like a number.
<jdrake> \b fixes it, I put it into all of the number definitions
<thelema> you're right. I thought I had fixed this before... hmmm...
* thelema starts to feel that the insistence on removing the context for regular identifiers was... a poor choice.
<jdrake> Who had the insistence?
<thelema> one of the gsv developers
<jdrake> I wonder why
<thelema> because he didn't want rainbow highlighting.
<thelema> where every piece of text gets a different color
<jdrake> ok
<jdrake> Is there a way to start ocaml with a script file run, and then present the repl?
<palomer> gsv?
<thelema> pal; gtksourceview
<palomer> context for regular identifiers?
<thelema> palomer: gsv dows syntax highlighting through contexts - one enters a context with a certain regex, and leaves it with another (or leaves it immediately)
<thelema> contexts get colored.
<thelema> there's no context for plain identifiers, although there is for many special forms (Constructors, module names, variant tags, optional/named arguments)
<jdrake> Do any of you guys use ocaml for web programming?
<thelema> not I
<jdrake> Would you say it would be suitable or illsuited for that task?
* thelema reserves judgement
<jdrake> I just noticed this code line: Sdlvideo.blit_surface ~src:text ~dst:screen (); Where it uses ~src ~dst, are those like named parameters?
<thelema> yes
<jdrake> ah, I see they are called labels
<jdrake> Hmm, optional ones too
<jdrake> This expression has type int * int * int but is here used with type int32
<jdrake> (255,0,0)
<jdrake> Not sure what is going on here
<jdrake> If I use Sdlvideo.red, it gives the same error. The problem is, red is a color, which is type color = int * int * int
<palomer> thelema, so what's the kerfufel?
<orbitz> palomer: hai
<palomer> orbitz, hai
<jdrake> oops, wrong function
<orbitz> palomer: i can haz functional language?
<palomer> orbitz, no, you can have object oriented quantum language
<palomer> man, objects give funky error messages
<palomer> usually 150 lines long
<orbitz> cuz they are defined funny!
<jdrake> Hmm, a quantum language - is that what you program a quantum computer with? :-)
<orbitz> jdrake: it's a language where bogosort is the most efficient sorting algorithm!
<jdrake> orbitz: I hate to say it - but it exists: http://en.wikipedia.org/wiki/Quantum_programming
<orbitz> sure it does, we *do* have quantum compuers afte rall, they are just weak
<jdrake> orbitz: Where are they?
<orbitz> research labs
<jdrake> Do we even know what quantum computers will really allow? (what is realistic and what is not)
<orbitz> id ont' know
<orbitz> we have some idea i think, theoretically
<palomer> type 'p child_typ = ('p,'p child_typ,'p child_typ) typ <--typ is a class, how do I use child_typ to constrain my class?
<orbitz> i think the largest one is 16 qbits?
<orbitz> palomer: was that you who asked teh question about ocamlc freezing?
<palomer> orbitz, yeah, does it freeze on your system?
<orbitz> i'll try it
<orbitz> i don't know much about thigns, but in yrou example is [...] a list?
<jdrake> orbitz: You type like cat.
<palomer> if I try class ['a] foo : 'a child_typ = ... I get a parse error
<orbitz> jdrake: it's true i do
<orbitz> palomer: i mean, is the [] suppsoed to conform to list syntax? using ; instead of ,?
<palomer> if I try class ['a] foo : ['a] child_typ = ... I get the error
<palomer> Unbound class type
<palomer> child_typ
<palomer> orbitz, hmm?
<orbitz> class type ['top_parent_type,'left_sibling_type,'right_sibling_type
<orbitz> is that suposed ot be a list?
<orbitz> the code in your email gives me a compiler error
<palomer> err no
<palomer> that's a list of type arguments
<palomer> I don't quite understand when to use [] and when not to use it
<orbitz> i'm on 3.10.0
<orbitz> palomer: so it's a lis tor no ta list?
<palomer> I know I have to use it when I'm defining a class
<palomer> and when I'm inheriting
<palomer> orbitz, not
<orbitz> ok
<palomer> type 'p child_typ = ('p,'p child_typ,'p child_typ) typ <--is it possible to use child_typ as a class type?
<palomer> http://ocaml.pastebin.com/m5d461b7d <--how do I do this?
<jdrake> I need to do a for expression (going from 0.0 to ~6.2 in steps of 0.01); but it doesn't appear to be what I want. Is there a better method of implementing this?
<orbitz> i'm not sure, i never use for
<jdrake> I suppose a recursive function would be appropriate
<orbitz> i think f you doi twith for you'd have to do i tas ints then divide
<flux> palomer, I don't think it's possible to do that
<flux> palomer, perhaps the caml list would know if there are workarounds. atleast one springs to my mind: using a function returning an object instead of using class..
<jdrake> Can I have a pattern matching function definition (so two function definitions) inside of an outer function definition?
<palomer> flux, worked around it by defining a class
<Loki_> to whomever recommended the cambridge book: mega thanks. Are solutions to the exercises also available?
<palomer> Loki_, it was me!
<palomer> you're welcome
<Loki_> palomer, I love you
<palomer> good book, eh?
<Loki_> it certainly meets my needs at the moment
<Loki_> I love the irony of the 'do not distribute' label at the bottom of each page though
<palomer> not ironic! he put it up for free on purpose
<Loki_> huh. That's pretty cool of him.
<palomer> they do it so you can criticize the book
<palomer> find errors
<Loki_> still, I'd love to have worked out solutions to the exercises
<palomer> etc...
<palomer> Loki_, ask the channel!
<Loki_> haha
<Loki_> well, I've been able to get them all so far, so we'll see.
<Loki_> I really love how close to pure logic/problem space the language is
<Loki_> I've tasted so many languages and none have intrigued me as much as ocaml
<palomer> it's super cool!
<palomer> if you're into logic, don't forget to check out Coq
<Loki_> yes, that was in part how I found out about ocaml
<palomer> but, like, I've never even touched it:P
<Loki_> I may use coq to cheat in my required symbolic logic class ;-)
<palomer> there's also LF
<Loki_> haven't heard of it
<palomer> Coq is a full fledged programming language based on dependent types, right?
<palomer> LF is to Coq what sml is to ocaml
<palomer> from my understanding
<Loki_> one of my professor/mentors is really big on SML. He used it to write his High Assurance Transformation System, but he'd never heard of this cool kid on the block called ocaml
<palomer> strange, I'd take ocaml over SML any day!
<palomer> no offence to you sml wonks out there
<Loki_> I don't particularly care for it but it doesn't seem that different from ocaml at the language level
<Loki_> there are more books about it, for what that's worth
<palomer> about SML?
<Loki_> well, it's taught at our school, so maybe I've just seen more floating around
<Loki_> I found a book on amazon called Practical Ocaml but it got incredibly bad reviews
<Loki_> which is why I was hoping in vain to get Jon Harrop's book until you came along
<Loki_> sml doesn't meet the performance criteria that I require
jdrake has quit [Read error: 110 (Connection timed out)]
<Loki_> ruby -> ocaml -> c seems like a good combination
<palomer> there's a whole program compiler for SML
<palomer> mlton
<Loki_> yes
<palomer> whole program optimizing compiler
<palomer> isn't it blazing fast?
<Loki_> I read somewhere that ocaml's was significantly faster?
<palomer> Loki_, out of all the programming books I've read, the cambridge one is the best
<palomer> err
<palomer> one of the best
<Loki_> I've downloaded the french o'reilley book too
<palomer> in french?
<palomer> or from france?
<Loki_> english translation
<Loki_> I have a hard time reading technical french, it's just such specialized vocabulary and it's not like I can get dictionaries for that.
<palomer> stick to english;P
<palomer> (speaking as someone who has studied in paris)
<Loki_> though I tried watching the videos from the ocaml conference in paris and I kind of hoped that they'd just talk in their native french so I could understand at least the gist of what they were saying
<Loki_> oh cool! where did you study?
<palomer> Paris VII
<Loki_> studying what?
<palomer> I studied models of lambda calculus
<Loki_> holy shit
<Loki_> undergrad?
<palomer> grad
<Loki_> aah
<Loki_> I'm an underling
<palomer> undergrad?
<Loki_> bioinformatics major
<Loki_> yeah
<palomer> did you hear about the protein folding game?
<Loki_> hahaha, yes. brilliant
<palomer> funny that bioinformatics people would be interested in ocaml
<Loki_> anything to help. There's an ocean of data exponentially growing in size and if the proteomics bit of computational biology gets helped along then fanfuckingtastic
<Loki_> why do you say that?
<palomer> it's mostly the programming language wonks who dig it
<Loki_> you have to understand, most bioinformatics 'programming' is perl or (sometimes) python
<palomer> for shame!
<Loki_> with the underlying algorithms generally written in really really really bad c
<palomer> ;P
<palomer> do the whole thing in ocaml!
<Loki_> programming by biologists = not good
<Loki_> the point of bioinformatics is to combine the mathematics and programming of compsci with the bio,chem,and genetics side
<Loki_> thing is, I see incredible potential in jocaml
<palomer> distributed ocaml?
<palomer> have you heard of erlang?
<Loki_> I have, and would be great if numerical computations weren't so slow
<palomer> http://lambda-the-ultimate.org/node/2751 <-- nice discussion on concurrent programming languages
<palomer> forget about erasmus though
<Loki_> incidentally, is all this chatter about a concurrent garbage collector amounting to anything?
<palomer> dunno, not much into that stuff
<Loki_> here's my main problem - I'm doing work on evolving spiking neural networks. I need to be able to send a message from neuron 3453 to neuron 24564 as fast as possible. I'm very new to caml so the only two possibilities I've thought of are a network of objects - call(spike) object 1, action potential is recomputed, sometimes spikes are sent out to a large number of other neurons (objects) - or just converting the DSL that I've evolved and turning i
<Loki_> t into a massive list of functions which update their own state and send out spikes to other hardcoded functions. I'm really wondering which is faster.
<Loki_> I've thought of using hashes and matrices as well, but I don't know caml well enough to formulate a design beyond 'hey, I could use these'
<Loki_> any advice?
<Loki_> huge list of objects vs. huge function graph
<palomer> if performance is the bummer you can use functors to test different implementations
<palomer> but we're talking linear difference here
<Loki_> I hypothesized that the function graph, by not invoking any OO support would be lighter weight and faster, but I don't know.
<Loki_> both performance and # of neurons and axons are the issue
<palomer> so you spike a neuron which in turn spikes other neurons
<palomer> jocaml uses message passing (according to the latest jabbering on the mailing list)
Kopophex has quit [Connection timed out]
<Loki_> right. I'm confident that ocaml can do the math as well as C, I just don't know what sort of approach would yield the best results. I'm going to experiment with jocaml once multiple 'lobes' are relevant.
<Loki_> since jocaml is still dealing with separate processes, albeit in an elegant way
<Loki_> shared memory would be fantastic - which is why I ask about the concurrent garbage collector
<palomer> if you're new to ocaml I suggest you implement in every way you can think of
<Loki_> mm
<palomer> it takes a while to get the hang of it
<palomer> thinking about performance when you haven't written anything yet is trouble!
<Loki_> what drew you to the language?
<palomer> I've been a language wonk all my life
<palomer> but, erm,
<Loki_> ah
<palomer> I first tried out ocaml
<palomer> didn't like it
<palomer> tried haskell
<palomer> was hooked for about 2 years
<palomer> then for my most recent project, I wanted my meta language to be the same as my object language
<palomer> ie, I wanted to write a compiler in ocaml that compiles into ocaml
<palomer> and I wanted references
<palomer> so haskell was out
<palomer> and ocaml turned out to be a better language for my needs!
<Loki_> what sort of problem are you normally using ocaml for?
<palomer> well, right now I'm writing an IDE/compiler
<Loki_> what are you using -- GTK, QT, win?
<palomer> GTK
<palomer> ocaml doesn't have QT
<Loki_> oh
<palomer> I'm doing it under linux
<palomer> not much choice
<Loki_> have you run up any particular snags with the language?
<Loki_> against
<Loki_> bla
<palomer> yes!
<palomer> but only one
<palomer> the error messages are incomprehensible!
<palomer> _huge_ waste of time
<Loki_> because they're in franglish or because they're actually gibberish?
<palomer> but that's mostly when you're dealing with objects
<palomer> like, it'll say
<palomer> "you put this type <100 lines of code> but we wanted this type <100 lines of code>"
<palomer> sometimes it's nice enough to tell me the difference
<Loki_> hahaha
<Loki_> for a UI I imagine you make pretty heavy use of objects and threads
<palomer> no threads
<palomer> I make super heavy use of objects
<palomer> and ocaml has some _really_ nifty subtyping capabilities
<Loki_> what sort of tools or process do you use to track down the one type error in a big chunk of code?
<palomer> deep breathing
<Loki_> hahaha
<palomer> I try to annotate
<palomer> or add type constraints
<palomer> it gets really funky sometimes
<Loki_> from what Xavier says, ocaml isn't high on INRIA priorities
<palomer> EH?
<Loki_> so I guess it's unlikely that the error system will become more verbose
<palomer> what are they working on?
<Loki_> I don't know
<palomer> ocaml is one of my favourite pieces of software, ever
<Loki_> wiki.cocan.org/events/europe/ocamlmeetingparis2008
<palomer> can't find the video
<Loki_> it's in the second link anyway, I probably typed it wrong
<Loki_> [different comps]
<palomer> err
<palomer> what's the gist
<palomer> ;P
<Loki_> haha, don't know. I've only watched a bit of it so far.
<Loki_> but xavier simply said he and the other compiler developers have very limited time to spend on ocaml improvements
* palomer has spent the WHOLE DAY fighting type errors!
<Loki_> hahaha
<Loki_> so the question is: would it be easier to ferret them out in a dynamic language?
<palomer> well, erm
<palomer> the reason I'm fighting the type system is that I'm refactoring my code
<palomer> take, for example, the type
<palomer> class ['a] foo =
<palomer> class ['a,'bar] foo =
<palomer> object
<palomer> constraint bar = #foo
<palomer> method virtual get_right_sibling : 'bar
<palomer> method dostuff = ...
<palomer> end
<palomer> actually, let's take a simpler example
<palomer> class foo =
<palomer> method get_right_sibling : foo = ...
<palomer> method do_stuff = ...
<palomer> end
<palomer> class type bar =
<palomer> method get_right_sibling : bar
<palomer> end
<palomer> let a = (new foo :> bar)
<palomer> compiles!
<palomer> given that you don't return references in methods
<palomer> and other constraints
<palomer> so, in ocaml, the name of a class doesn't really matter to the type system
<palomer> I'm doing a terrible job explaining this
<Loki_> it's okay
<Loki_> I'm getting it
<palomer> anyways, the moral of the story is
<palomer> a class type decides the shape of a class
<Loki_> now I'm not
<palomer> let's take polymorphic variants
<palomer> same principle
<palomer> type foo = [`c1 of foo ]
<palomer> type bar = [`c1 of bar | c2 of int]
<palomer> so foo is a subtype of bar, right?
<Loki_> it doesn't seem explicit
<palomer> doesn't need to be
<palomer> try it out
<palomer> write a function bar -> int
<palomer> or, even better
<palomer> type foo = [`c1 of foo | `c2 of int ]
<palomer> type bar = [`c1 of bar | `c2 of int | `c3 of float]
<palomer> write a function bar -> int
<palomer> and then try it on a foo
<palomer> so, for polymorphic variants and types, the name of a type doesn't matter (as far as the type system is concerned)
<palomer> err
<palomer> polymorphic variants and class types
<palomer> however, try this
<palomer> type foo = [`c1 of foo ref | `c2 of int ]
<palomer> type bar = [`c1 of bar ref | `c2 of int | `c3 of float]
<palomer> and write a function bar -> int
<palomer> and then try it on a foo
<palomer> the compiler will give you an error
<palomer> and then will say "got [`c1 of foo ref | `c2 of int ] but expected [`c1 of bar ref | `c2 of int | `c3 of float]"
<palomer> which is pretty stumping in itself
<palomer> following this?
<Loki_> remember, I'm a total newbie to ocaml -- it gives me a syntax error on 'of' :-(
<palomer> which one?
<Loki_> I get what you're saying, but I can't translate it into ocaml code
<Loki_> all of it - my ocaml toplevel doesn't like 'of'
<palomer> my code seems to work
<palomer> # type foo = [`c1 of foo ref | `c2 of int ];;
<palomer> type foo = [ `c1 of foo ref | `c2 of int ]
<palomer> anyways, I don't want to confuse you too much
<Loki_> yeah, the plane crashes into the mountain
<Loki_> don't worry about it
<palomer> BUT, what's a bummer is that instead of printing "expected foo but got bar"
<palomer> it has to print out the whole type
<Loki_> wouldn't that be a relatively minor change to the compiler?
<palomer> structural vs nominal subtyping?
<palomer> huge change!
<Loki_> damn.
<palomer> anyways, it's getting late and I'm blabbering
<Loki_> <--- specializes in synthetic evolution
<palomer> night!
<Loki_> good night
<Loki_> hope to talk to you again
filp has joined #ocaml
ygrek has joined #ocaml
al-maisan has joined #ocaml
al-maisan has quit [Remote closed the connection]
al-maisan has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
bluestorm has quit ["Konversation terminated!"]
rwmjones has joined #ocaml
Tetsuo has joined #ocaml
al-maisan has quit [Remote closed the connection]
al-maisan has joined #ocaml
Linktim has joined #ocaml
hkBst has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
Poulet has joined #ocaml
Mr_Awesome has joined #ocaml
Mr_Awesome has quit [Remote closed the connection]
LordMetroid has joined #ocaml
Linktim_ has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
Linktim has quit [Read error: 110 (Connection timed out)]
Demitar has quit [Read error: 110 (Connection timed out)]
mrpingoo has joined #ocaml
Linktim_ has quit [Read error: 113 (No route to host)]
Linktim has joined #ocaml
sporkmonger has quit []
mrpingoo is now known as love-pingoo
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
sporkmonger has joined #ocaml
<flux> hmm.. idea: generate log information of which threads communicate with which threads, and the process this log file into a graphviz dot file. tada, instant picture of communication hierarchies :)
<Yoric[DT]> Has anyone followed the mailing-list thread wrt Ancient and concurrency ?
LordMetroid has quit [Read error: 110 (Connection timed out)]
bzzbzz has joined #ocaml
Linktim_ has joined #ocaml
jlouis has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
coucou747 has joined #ocaml
<flux> it's not a small task roughly 60 functions to move their first argument to be the last (plus make the change to all the call sites)
<flux> I really hope something useful comes out of the ocaml refactoring tools project: -)
<flux> (well, relatively speaking, it wasn't a big task, but it is still quite annoying to do by hand)
nuncanada has quit [Remote closed the connection]
<rwmjones> Yoric[DT], me :-)
nuncanada has joined #ocaml
Kopophex has joined #ocaml
<Yoric[DT]> rwmjones: :)
blue_prawn has joined #ocaml
marque has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
blue_prawn has quit ["Client exiting"]
blue_prawn has joined #ocaml
<blue_prawn> hi!
<orbitz> hai
<blue_prawn> I would have a question about bigarrays
<orbitz> lay it on us
<blue_prawn> I'm trying to compile C code allocating a ba, I have put on command line -cclib -lbigarray, but I get the error message "undefined symbol: alloc_bigarray"
pango has quit [Remote closed the connection]
<blue_prawn> that's it, I found my error, sorry
pango has joined #ocaml
love-pingoo has quit [Remote closed the connection]
Kopophex has quit [Read error: 110 (Connection timed out)]
<orbitz> glad i could help
<blue_prawn> yes, thanks a lot
filp has quit ["Bye"]
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim- has quit [Read error: 110 (Connection timed out)]
JokerDoom has joined #ocaml
thelema has joined #ocaml
<coucou747> 42
<blue_prawn> 97
<marque> I want to code a function with the following type ('a -> 'b) -> 'a t -> 'b t where t is defined by:
<marque> type 'a t = V of 'a | L of 'a option t
<marque> do you know a trick to do it without using Obj.magic ?
thelema has quit [Read error: 104 (Connection reset by peer)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
<blue_prawn> let f g = function V a -> V(g a) | _ -> raise Exit ;;
yminsky has quit [Read error: 110 (Connection timed out)]
<marque> :)
<marque> well played :) but I'm looking for something with the same behavior than
<marque> let rec map f = function V x -> V (f x)
<marque> | L t -> map (function None -> None
<marque> | Some x -> Some (f x)) t
<marque> (which isn't typable)
Snark has joined #ocaml
JokerDoom has left #ocaml []
<blue_prawn> I get something compiled but with a warning "pattern not exhaustive
sporkmonger has quit []
<blue_prawn> the problem is that as many L there are accumulated, the same number of options are accumulating too
sporkmonger has joined #ocaml
<blue_prawn> and the trick is how to unwrap these options
<blue_prawn> maybe you should consider a maximum nested L
<blue_prawn> and if there too many L nested raise an exception ?
jonafan_ is now known as jonafan
filp has joined #ocaml
<mfp> marque: looks like the standard polymorphic recursion problem
<mfp> there are several ways to solve it, one being recursive modules: http://pastebin.com/m5162234a
<mfp> # let z = L (L (L (V (Some (Some (Some 1))))));;
<mfp> val z : int t = L (L (L (V (Some (Some (Some 1))))))
<mfp> # map ((-) 10) z;;
<mfp> - : int t = L (L (L (V (Some (Some (Some 9))))))
al-maisan has quit ["Leaving."]
<blue_prawn> beautifull turn-arround
<blue_prawn> mfp: you say there are other ways to solve this ?
<mfp> blue_prawn: using polymorphic record fields (similar to the encoding of existential types)), or splitting the type into 2 sum types
<marque> mfp, nice :)
<marque> thank you !
<mfp> here's an ex by Okasaki: given type 'a seq = Nil | Cons of 'a * ('a * 'a) seq which requires non-uniform recursion, you do
thelema has joined #ocaml
<mfp> type 'a ep = Elem of 'a | Pair of 'a ep * 'a ep type 'a seq = Nil | Cons of 'a ep * 'a seq
<mfp> see Okasaki p. 143
* mfp afk now
bluestorm has joined #ocaml
guyzmo_ is now known as guyzmo
Poulet_ has joined #ocaml
Poulet has quit [Read error: 110 (Connection timed out)]
TychoBrahe has quit [Read error: 145 (Connection timed out)]
TychoBrahe has joined #ocaml
Poulet has joined #ocaml
Poulet_ has quit [Read error: 110 (Connection timed out)]
al-maisan has joined #ocaml
Snrrrub has joined #ocaml
jdrake has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
<rwmjones> anyone on from debian-ocaml-maint?
<rwmjones> just wondering what the heck was the final decision on naming of jane/street/st/core package
<blue_prawn> hi, richard
<blue_prawn> did you recived my email ?
<blue_prawn> about ocaml-ode
<rwmjones> blue_prawn, oh yes, I do remember it
<rwmjones> ocamlode has a rather complex history
<rwmjones> in particular, someone picked up my bindings and did loads of work on them
<rwmjones> but I've no idea what happened to that
<rwmjones> in any case, binding ODE is much harder than it seems at first, and my bindings get lots of stuff wrong in hindsight
<blue_prawn> it seems to work
<blue_prawn> have you something in particular that is done the wrong way ?
<rwmjones> blue_prawn, no I just mean it's not safe, because the GC doesn't know when is the right time to collect ODE objects
<rwmjones> the reason is that there are lots of hidden dependencies within the C objects
<blue_prawn> yes I have seen this
<rwmjones> which need to be made explicit for the OCaml GC
<blue_prawn> but is it possible ?
<rwmjones> eg. the ODE "world" points to just about everything else
<rwmjones> yes
<rwmjones> but only with loads of extra effort
<rwmjones> & since I was only playing ith ODE for a bit of fun
<rwmjones> I wasn't inclined to do the extra effort
<blue_prawn> if you explain to me how to do this, I could do it
<blue_prawn> but I don't see how the gc could know if a geometry is still in the ode space or not
<blue_prawn> from what I understand the programmer needs to explicitly call dBodyDestroy dGeomDestroy, etc..
<flux> idea: could there be a thread that did a "stop the world" garbage collection to the ODE, by tracking down what it references? (btw, I don't know ODE at all)
<flux> (or perhaps not a thread but something more explicit)
<blue_prawn> I don't know ODE enough yet to make such high tasks, but
<blue_prawn> anyway I have seen that you explicitly put all your functions in a sub module LowLevel which is not complete
<blue_prawn> adding all the missing functions is very easy to do
<blue_prawn> I have also corrected 2 bugs
<flux> I've just used Ocaml-Chipmunk. 2d is enough for me at this time :)
<blue_prawn> and made it possible to use the binding with an ODE compiled with dSINGLE or dDOUBLE
<blue_prawn> yes Chipmunk is very easy and nice to use :-)
<blue_prawn> ODE seems to be a bit complecated, you need to explicitly create the contacts
<blue_prawn> and the current ode binding is not usable with the last ODE, the new dInitODE() function is not in the binding and now you need to call it at the beginning
<blue_prawn> flux: have you tryed the little ocaml-chipmunk game "rolling-moon" ?
<flux> yeah
<flux> it's interesting
<blue_prawn> it's inspired from an old SNES game :)
<blue_prawn> "on the ball" or the japaneese name "CamlTry"
<flux> but maybe it is inspired from those little plastic games where you have a ball (or multiple balls!) trapped in a maze :)
<flux> CamlTry? now that would be a fitting name for that implementation of it..
<blue_prawn> yes, I have seen this japaneese name after having choosing its name
<flux> multiple balls would increase the difficulty a lot
<blue_prawn> so it could have been named (or rename) "CamlWith"
<blue_prawn> it is commented in the source
<blue_prawn> 2 balls
<flux> also, multiplayer could be interesting.. all parties would have their own gravity.
<blue_prawn> but the camera follows only one of these 2 (or more) balls
<blue_prawn> just sharing the targets state ?
<flux> two players, two balls, and the gravity would work as means to make the ball move
<flux> so what the other player has rotated wouldn't affect the other player
<blue_prawn> but the gravity is associated with the world
<flux> yeah, that's a problem.. but I suppose the gravity could be simulated
<flux> without using the global gravity
<blue_prawn> mmmh, perhaps with no gravity, and just applying a force to the balls
<blue_prawn> but the main problem is that I have no knowledge to make to instances of a program to communicate
<blue_prawn> how such things are done ? with sockets ?
<flux> yes
<flux> I've actually written a smallish game (with sockets): http://modeemi.cs.tut.fi/~flux/goba/
<blue_prawn> the world handling on a server, and two client connecting on it with only the frontend ?
<flux> that would be a straightforward solution
<flux> the tricky issues are on how to handle latency
<flux> for instance, you don't want everything to round-trip with the server, because that would look slow to the player locally
<flux> and if you update the other player's ball position just when you get server information, it might be jumpy
<blue_prawn> even with udp ?
<flux> with udp it can be better
<flux> (I use only TCP with goba)
<blue_prawn> so what would you recommand ?
<flux> trying it out :)
<flux> you could also use both
<flux> tcp for important messages and udp for location information
<flux> (be sure to sequence-number the udp packets so you can discard old packets, in case they are delivered in out-of-order)
pango has quit ["I shouldn't really be here - dircproxy 1.0.5"]
<blue_prawn> arg, goba has a lot of deps
<flux> yes :)
<flux> and they're not even up to date with the latest release.. oh well
pango has joined #ocaml
<flux> if you're new to socket programming, here are some gotchas: 1) ignore SIGPIPE, otherwise your program will die when it sends to a disconnected peer. 2) do note that you may not receive as many bytes from a TCP socket in one read as what you've put in with one write. (so have your own framing, or use an ascii-based protocol with newlines)
<flux> maybe that's it :)
<flux> 3) handle EINTR (and EAGAIN if you're using nonblocking sockets)
Axioplase has joined #ocaml
Snark has quit ["Ex-Chat"]
<blue_prawn> do you play with netpanzer ?
<blue_prawn> i find it nice
<flux> nope
<blue_prawn> it's close to your game
<flux> looks very nice
Axioplase has quit [Client Quit]
<flux> it has been one idea of mine (for a long time) to write a C&C-clone, but it would be a lot of work :) (too much, I'm afraid)
<blue_prawn> maybe you could like it, there are servers to play online against others
<blue_prawn> I don't know C&C
<flux> Command & Conquer?
<flux> a classic.
<flux> I believe the actual game play is very different with Goba (or the original: Flash Attack) and such games
<flux> as, for example, you have exactly four vehicles, and after they're done, that's it
<flux> also, you can view all the devices all the time
melkart has joined #ocaml
<flux> and then there is the defence aspect of using walls and mines; this is a big similar in C&C
<flux> I think I'll be off to sleep now, though
<blue_prawn> perhaps the more problematic part would be the graphics
melkart has left #ocaml []
<blue_prawn> what is your local time ?
<flux> 23:56
<blue_prawn> ok, one more than me
<blue_prawn> so, see you next time !
<flux> yes. good night.
Axioplase has joined #ocaml
al-maisan has quit ["Leaving."]
Axioplase has quit [Client Quit]
thelema has quit [Read error: 110 (Connection timed out)]
Axioplase has joined #ocaml
filp has quit ["Bye"]
blue_prawn has quit ["Client exiting"]
postalchris has joined #ocaml
sporkmonger has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
Snrrrub has quit []
<palomer> does ocaml have polymorphic recursion?
<pango> nope
<palomer> crap!
<palomer> I really need it:P
<pango> I think they're workarounds, for example using existential record fields... http://caml.inria.fr/cgi-bin/search.en.cgi?words=polymorphic+recursion&corpus=caml-list
<pango> (I haven't personally tried those tricks)
<Smerdyakov> Alternatively, switch to Coq. :)
Optikal_1 has joined #ocaml
Demitar has joined #ocaml
det has quit [Remote closed the connection]
sporkmonger has joined #ocaml
<Optikal_1> Mixing of the utensils is an abomination unto the lord.
Optikal_1 has left #ocaml []
blendin has joined #ocaml
Axioplase has quit ["leaving"]
Demitar has quit [Read error: 110 (Connection timed out)]
thelema has joined #ocaml
sporkmonger has quit []
hkBst has quit ["Konversation terminated!"]
Tetsuo has quit ["Leaving"]
marque has quit [Read error: 110 (Connection timed out)]
postalchris has quit [No route to host]
<palomer> http://ocaml.pastebin.com/m71eb7eca <--could anyone explain to me how this works?
blendin has quit []
Ramzi has joined #ocaml
<Ramzi> Hey thelema.
yangsx has joined #ocaml
Kopophex has joined #ocaml