mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
nashdj has joined #ocaml
smimou has quit ["bli"]
yminsky_ has joined #ocaml
yminsky has quit [Read error: 104 (Connection reset by peer)]
Morphous has joined #ocaml
yminsky has joined #ocaml
diosmalo08 is now known as JesusChrist2008
Morphous_ has quit [Read error: 110 (Connection timed out)]
yminsky has quit []
yminsky has joined #ocaml
middayc has joined #ocaml
thermoplyae has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
kmeyer has quit [Read error: 113 (No route to host)]
kmeyer has joined #ocaml
kmeyer has quit [No route to host]
kmeyer has joined #ocaml
dbueno has joined #ocaml
zmdkrbou has quit [Read error: 110 (Connection timed out)]
yminsky_ has quit [Connection timed out]
Hadaka has quit [Read error: 145 (Connection timed out)]
_hercules2x_ has quit [Read error: 110 (Connection timed out)]
zmdkrbou has joined #ocaml
yminsky has quit []
yminsky has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
dbueno has quit ["This computer has gone to sleep"]
Mr_Awesome has quit ["aunt jemima is the devil!"]
<hcarty> flux: http://0ok.org/code/ocaml/moon_buggy.ml -- I "updated" the demo, making it a bit cleaner and hopefully easier to add pieces to -- any thoughts?
<hcarty> I haven't compiled it. I've been #use-ing it from the toplevel
yminsky has quit [Read error: 110 (Connection timed out)]
yminsky has joined #ocaml
Yoric[DT] has joined #ocaml
Associat0r has quit []
Yoric[DT] has quit ["Ex-Chat"]
yminsky has quit [Read error: 104 (Connection reset by peer)]
yminsky has joined #ocaml
<flux> just looking at the diff made me realize I had added a dependency of glMLite to chipmunk, which really doesn't exist..
cygwinports has joined #ocaml
<flux> ah, you've made it oopy
<flux> hm, or more so atleast
<cygwinports> I'm having trouble with findlib; I can't get ocamlfind install to use the stublibs dir
jderque has joined #ocaml
<flux> cygwinports, sorry, no ideas, findlib has worked for me always (even in windows). I guess you've checked /etc/ocamlfind.conf is ok? although I'm not sure how much it affects that issue..
<cygwinports> flux: thx, I think I'll have to dig in to findlib to figure it out
cygwinports has left #ocaml []
jderque has quit [Read error: 110 (Connection timed out)]
thermoplyae has left #ocaml []
ttamttam has joined #ocaml
zmdkrbou has quit [Read error: 110 (Connection timed out)]
filp has joined #ocaml
middayc has joined #ocaml
ygrek has joined #ocaml
leo037 has joined #ocaml
zmdkrbou has joined #ocaml
Mr_Awesome has joined #ocaml
ygrek has quit [Remote closed the connection]
jhome has quit [Remote closed the connection]
<flux> hcarty, btw, if the idea of moon_buggy is to demonstrate the capabilities of the library, perhaps such a released version should have multiple versions: from simple to complex. sort of like a tutorial..
<flux> for basics look at the first version, for advanced stuff check the latest :)
<flux> (this would mean bug fixes etc should be incorporated into previous versions also)
hkBst has joined #ocaml
<middayc> what moon_buggy (I came late .. the first thing I see is "<flux> hcarty, btw, if the idea ..." )
<middayc> sounds like a game-thing?
<flux> it's a demo app of the ocaml bindings for chipmunk physics library
<flux> hcarty> flux: http://0ok.org/code/ocaml/moon_buggy.ml -- I "updated" the demo, making it a bit cleaner and hopefully easier to add pieces to -- any thoughts?
<middayc> wau ... chipmunk inocaml ... that's great
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
<flux> hello
<middayc> ocaml has quite some libs for game-dev now
<middayc> (I just saw allgro binding was also updated yesterday)
<flux> ..by the same guy as the chipmunk bindings :)
<flux> apparently the guy is single-handedly making ocaml an attractive game developing platform; an applaudable goal :)
<Yoric[DT]> :)
<Yoric[DT]> I'll see if any of my students attempt to write a game using OCaml.
<Yoric[DT]> Last year, a student wrote a nice Pacman using only the Graphics library.
<Yoric[DT]> That was impressive, especially for someone who hadn't done much OCaml.
<middayc> aja :) I didn't know it's the same guy .. I just saw news about allegro yesterday on ocaml planet
<middayc> is there any website of the chipmunk ocaml lib?
<middayc> Ook.org doesn't show me anything except this source file
<flux> to run the moon buggy demo, you need to install glMLite too
<flux> if you want those to be ocamlfind-compatible, patch them with http://modeemi.cs.tut.fi/~flux/ocaml/
<rwmjones> flux, screenshots?
<flux> it's very simple, screenshots wouldn't help much, videos maybe :)
<flux> but you can look at other chipmunk videos to get an idea of the library's capabilities
<middayc> do you know if glMLite works on windows?
<flux> I don't know, but I think it's doubtful
<flux> the guy wrote glMLite because lablgl wouldn't work for him..
<Yoric[DT]> Does anyone know why ?
<flux> hm, wait, those don't have videos :)
<Yoric[DT]> I've used LablGL a bit and it was quite nice.
<flux> well youtube should have some
<flux> the sketches-video is cool: http://wiki.slembcke.net/main/published/Chipmunk
<middayc> ( I am very new at Ocaml .. I was just happy that I managed to compile GLCaml and SDLCaml on windows a week ago .. I made a mini tutor : http://itmmetelko.com/blog/?p=74)
<flux> ocaml on windows might be a bit bumpy, but I suppose it's not that difficult after you get it working
<middayc> yea once I installed al things all examples worked which was nice.. glcaml also compiled (I tried it a while back)
<flux> but, off to eat ->
<Yoric[DT]> enjoy
Mr_Awesome has quit ["aunt jemima is the devil!"]
zheng has joined #ocaml
<middayc> I meant lablgl above ("glcaml also ...")
buluca has joined #ocaml
middayc_ has joined #ocaml
seafood_ has quit []
middayc_ has quit [Read error: 104 (Connection reset by peer)]
middayc_ has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
<middayc_> .
robyonrails has joined #ocaml
junis has quit [Read error: 104 (Connection reset by peer)]
junis has joined #ocaml
zmdkrbou has quit [Read error: 110 (Connection timed out)]
dramsay has joined #ocaml
Cirleg has joined #ocaml
<middayc_> yey .. it moves :)
<middayc_> I wrote my first ocaml app and it works :) ... firs I thought about having 2 mutable global data (x,y) and keyPress info but last time you here said (create a new bullet each time) so I did it with just keyPress as mutable and global, then I saw that I don't even need that so it has no global or mutable variables ..
<middayc_> well I know all this is obvious to you folks..
<middayc_> but seems cool to me as long time imperative programmer
<flux> it is a nice feeling to know to have learned something new :)
<flux> hm, s/to have/one has/
<middayc_> yes :)
<middayc_> what??
<middayc_> aha I understand
<middayc_> I intend to make tutorial out of this too... because no sample had "main loop" and keyboard detection and things moving in the basic sdl tutorial at sdlcaml..
<middayc_> I just hope I didn't do things in a very stupid or not ocamlish way
<middayc_> is there any script or app that can generate "decorated" html of ocaml code from ocaml code?
<flux> I think there must be, because there are such htmls around
<middayc_> yes .. :) I saw that moon_buggy is decorated (with retro style)
<hcarty> middayc_: I think that can be done from vim and/or emacs
<middayc_> I am on windows
<hcarty> flux: re: my moonbuggy edits - it definitely makes it less tutorial-like
<flux> hcarty, maybe a bit, but I think it makes it more consistent
<middayc_> if one of those "web code paste" tools support ocaml I could use that
<middayc_> hcarty ... you made the chipmunk and allegro bindings?
<hcarty> middayc_: http://www.gnu.org/software/src-highlite/ -- though I don't know if windows will still be a problem?
<hcarty> middayc_: No no, that was someone else
<hcarty> I just edited a demo file which came with the chipmunk bindings
<hcarty> Several of the pastebin sites out there do support OCaml... http://pastebin.be/ and http://ocaml.pastewith.us/ are two of several
<middayc_> aha, that highliter doesn't say ocaml .. I won't be bothering you with this, I will find something or use no highlightning
<hcarty> It may be listed as Caml rather than OCaml
<middayc_> aha .. ok thanks .. I forgot that they are called pastebin so I couldn't find them on google
<middayc_> aha caml is also on gnu highliter
<middayc_> thanks
<hcarty> middayc_: Glad to help
buluca has quit ["Leaving."]
robyonrails has quit ["Leaving"]
<middayc_> this is the sdl code btw http://pastebin.be/8083 ... if anyone looks at it and notices something strange please tell me (I know just 3% of ocaml right now)
rwmjones has left #ocaml []
<flux> looks fine (although I prefer smaller and otherwise different indentation - the one provided by xemacs). you do have a few excess ;'s there (and infact ;; aren't required in your code, if the functions weren't terminated with ; - but I suppose that's a matter of habbit/taste)
<flux> I think it is very common to indent stuff under a let a = b in .. to be a bit deeper than the let, unless it happens to be a let or an and following
<flux> the program entry point you have down the page is something I use too
<middayc_> aha ... I have to get a gripe where to put ; and ;;
<hcarty> middayc_: ;; is only needed in the toplevel
<middayc_> I sometimes don't understand how compiler knows that one let = ... is finished
<hcarty> As I understand it, it's when it comes to "something that can be returned" - but I don't know the proper terminology
<hcarty> It can take a little while to get a feel for it
<hcarty> At least when coming from a C/C++/etc background
<middayc_> what would you do in this situation ... I need to load a bunch of picture at the begining and I would then need access to them in the draw function? In imperative I would put them into some array and access them by index... is here any different ?
<flux> I would do that too. I might make the array or array elements lazy, though.
<hcarty> I would do the same, or use a Hashtbl and name them, or Map
<middayc_> Do you maybe know .. would naming them with string (in hashtable) be noticably slower than by integers?
<middayc_> lazy ... hm ..I have to do some reading on that
<middayc_> does this mean they would load only when needed / displayed or something else?
<hcarty> I do not know how the performance would change. The impact would likely depend on what else is being done when you access an element
<middayc_> these first experiments are not going to reach any performance limits so I will probably try with hashtables (and then read docs if I can do something like constants for indexed with integer access later)
<hcarty> For a simple project it should be fairly straightforward to switch between the two
<hcarty> middayc_: The code overall looks pretty nice by the way
<middayc_> ok thanks again ... you really helped me ... and this channel (few days ago) helped me understanding the key switch I need to do if I try to do it more FP way ... I read many docs but didn't get it
<flux> middayc_, note that you can use a type bitmaps = Player | Car | Bullet as a key to the hash
<flux> ..or even `Player etc, but that's an advanced topic, sortof
<middayc_> I was just about to ask this but I decided that I will rather go reading some more docs :)
<middayc_> great
dbueno has joined #ocaml
<middayc_> the code is foolesson5.ml from SDLCaml example modified.. before it was one sprite displayed once and then waiting for the key to exit (without the main loop and other things)
asmanur has joined #ocaml
Associat0r has joined #ocaml
zmdkrbou has joined #ocaml
Tetsuo has joined #ocaml
middayc_ has quit []
marmottine has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Morphous_ has joined #ocaml
kelaouchi has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
bluestorm has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
ttamttam has left #ocaml []
filp has quit ["Bye"]
theCarpenter has joined #ocaml
theCarpenter has left #ocaml []
mbishop_ has joined #ocaml
mbishop has quit [Read error: 110 (Connection timed out)]
middayc has joined #ocaml
mordaunt has quit ["Konversation terminated!"]
Yoric[DT] has joined #ocaml
<hcarty> flux, middayc: Moonbuggy in a bubble if you're interested: http://0ok.org/code/ocaml/moon_buggy.ml
<hcarty> Mouse buttons can make it go forward (left button), backward (right) or flip the buggy (middle)
Yoric[DT] has quit ["Ex-Chat"]
Yoric[DT] has joined #ocaml
<flux> fun :)
<flux> how do you make your ocaml #use "topfind" automatically?
<hcarty> .ocamlinit
<hcarty> Put whatever commands you'd like to use automatically in there
<hcarty> ~/.ocamlinit that is
<flux> right, of course
<flux> perhaps it would be better to put the #use -command in the file directly, though
<flux> (like I did)
<hcarty> Yes, you're right - I forgot to add that
<flux> do you know why the buggy seems to to much easier to the right than to the left?
<hcarty> Rear vs front wheel spinning I think
<flux> I suppose the torque makes the left tire have less contact to the ground when going left..
<hcarty> I believe so
<hcarty> I added the #use "topfind";; line
<flux> I already thought out of a "real" game to write with chipmunk-stuff, I wonder if I'll find the time/boredness to do it :)
<flux> a single screen or a scrolling region with one guy running around, with the ropes from Worms :), with every platform being an physics object.. oh, I suppose there should be an actual game there somewhere too :)
_KS has joined #ocaml
piggybox has joined #ocaml
jderque has joined #ocaml
loufoque has joined #ocaml
<loufoque> what's the complexity of List.length? O(1) or O(n) ?
<bluestorm> O(n)
<bluestorm> in doubt you just have to read the implementation
<loufoque> that should be in the documentation
<bluestorm> /usr/lib/ocaml/list.ml if you have a source-respectful distribution
<bluestorm> hm loufoque
<bluestorm> they may have considered it "obvious"
<bluestorm> lists are an algebric data type, nothing more
<bluestorm> i don't think you could get a List.length O(1) without changing the representation
<loufoque> well, the only possible reason I see for not having it is that it may be difficult to maintain with partial sharing and stuff
pattern_ has joined #ocaml
middayc has quit []
<pango_> it seems easy to create a functional list with O(1) length, by adding length in each cell... would waste some memory, though
<RobertFischer> What's the length of a lazy list which hasn't been executed?
<bluestorm> don't have one ?
<RobertFischer> Don't have lazy lists?
<bluestorm> hm
<RobertFischer> Wrong answer.
<bluestorm> don't have length
<bluestorm> i guess haskell people could answer _|_
<RobertFischer> Let me know if you get a good answer.
<pango_> for one, there's no "lazy lists" in the standard lib... Only streams, which are a bit special (destructive)
<bluestorm> you know, the List.length implementation is pretty naive
<bluestorm> pango_:
<bluestorm> let rec li = ()::li;;
<pango_> bluestorm: that's not a lazy list
<bluestorm> i think it is
<bluestorm> i'd bet
<RobertFischer> If you don't have to worry about lazy lists, then I'm a bit surprised the implementation isn't based on a linked list with a (head_ptr,length) tuple as the thing being held.
<pango_> it's infinite, but not lazy
<bluestorm> pango_: it's not evaluated until you ask it
<bluestorm> hm
<bluestorm> actually the head you give gets evaluated
<RobertFischer> Assuming the list is immutable, that tuple would make sharing partials easy and length O(1).
<pango_> bluestorm: nothing's evaluated at all
<RobertFischer> bluestorm: Where's the thunk function?
<pango_> RobertFischer: exactly what I suggested, but waste memory just to make List.length O(1)
<RobertFischer> The current list implementation shares sublists, right?
<pango_> bluestorm: lazy lists look like type 'a llist = LEmpty | LList of 'a * 'a llist Lazy.t
<pango_> RobertFischer: sure
<bluestorm> the current implementation is only an algebraic datatype
<bluestorm> type 'a list = [] | :: of 'a * 'a list
<RobertFischer> How does it know when its collection of nodes end?
<bluestorm> pattern matching ?
<RobertFischer> Let's back up. I've got list1 made of of nodes [a, b, c, d]. I create a sublist which consists of nodes [b, c]. Does list2 use the same [b,c] as list1?
<bluestorm> only if you asked for list2 to be List.tail (List.tail list1)
<bluestorm> creating a new [b ; c] out of nowhere won't share anything
<RobertFischer> Right.
<RobertFischer> That's fine.
<RobertFischer> Except that List.tail(List.tail list1) gives me [b,c,d].
<bluestorm> hm
<RobertFischer> Not [b,c].
<bluestorm> sorry
<bluestorm> you can't share anything with [b, c]
<pango_> RobertFischer: [b; c] is not a "sublist" of [a; b; c; d], [b; c; d] is, however
pattern has quit [Read error: 110 (Connection timed out)]
pattern_ is now known as pattern
<pango_> RobertFischer: elements themselves may be shared, but not the sublist
<RobertFischer> Okay. In that case, the recommendation that pango_ and I put forth would enable more sharing than can currently be done.
<RobertFischer> We'd actually be able to share more partials in a common case than the current implementation.
<bluestorm> hm
<pango_> RobertFischer: interesting... at the price of more complexity however
<bluestorm> how would you implement List.tl then ?
<RobertFischer> Because list2 would be defined as (b; 2).
<bluestorm> what would be "b" size ?
<bluestorm> hm
<RobertFischer> let List.tl list = (list.head.next ; list.size-1)
<RobertFischer> Well, with some more typing noise.
<bluestorm> so you have to allocate for List.tl
<bluestorm> not so great
<pango_> or ([b; c; d], 2)
<RobertFischer> We'd be allocating a tuple and an integer value, yeah. And doing a decrement.
<bluestorm> that's quite heavy
<bluestorm> compared to the current implementation
<RobertFischer> True.
ttamttam has joined #ocaml
<bluestorm> moreover, how would you let the programmer control those audacious sharing capacities ?
<RobertFischer> You wouldn't.
<RobertFischer> They shouldn't want to.
<RobertFischer> Mucking around with implementations is a Bad Idea.
<pango_> I'm not sure it would be very useful in practice either
<bluestorm> how could you write a [b; c] from [a; b; c; d] then ?
<RobertFischer> List.sublist ( list1, 1, 2) or something.
<RobertFischer> Yeah, I'm strating to regret my statement.
<RobertFischer> I'd have to go check my code and see how often I'm doing List.reverse stuff.
<RobertFischer> Because that's the kind of stuff that would go away.
<RobertFischer> Meh. Interesting thinking for a post-lunch slump.
<RobertFischer> But I don't think there's a lot of value in that recommendation.
<pango_> I don't think it'll help much with reverses
<pango_> but yes, I think getting rid of reverses is a good goal ;)
<RobertFischer> A lot of the time, I end up doing reverses as part of generating sublists or processing heads and then tails (dequeue kind of stuff).
<pango_> it requires more complex datastructures that allow both immutability, sharing, and appending at both ends (vlists, for example)
<RobertFischer> Appending at both ends won't happen with this recommendation.
<RobertFischer> But you could feed from both ends of a list very easilly and quickly.
<pango_> or at least a record with two lists, it's not a bad datastructure too
<RobertFischer> Yeah, if you're in a situation where this impl would be a good one, you probably want to do the {front_to_middle; end_to_middle} data structure.
<RobertFischer> Not sure what that's called.
<pango_> one stores the beginning of the overall list, the second stores the end of the overall list, in reverse
<RobertFischer> That's the one.
<RobertFischer> Does it have a name?
<RobertFischer> If not, I'm dubbing it "hacky dequeue".
<pango_> works well to implement FIFOs, but you don't need to only use it that way
<bluestorm> hm
nashdj has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
Snark has joined #ocaml
huh has joined #ocaml
RobertFischer has left #ocaml []
leo037_ has joined #ocaml
huh has quit [Client Quit]
ttamttam has left #ocaml []
huh has joined #ocaml
leo037 has quit [Read error: 110 (Connection timed out)]
<flux> hcarty, hm, it's not that simple that physics stuff after all, I fail add adding a spring between wheels :) (I think I'd need to apply a torque to wheel2 too)
yminsky has quit [Read error: 110 (Connection timed out)]
Cirleg has quit [Remote closed the connection]
Snark has quit [Read error: 113 (No route to host)]
leo037_ is now known as leo037
Snark has joined #ocaml
Snark has quit [Read error: 104 (Connection reset by peer)]
yminsky has joined #ocaml
jderque has quit [Read error: 113 (No route to host)]
zmdkrbou has quit [Read error: 110 (Connection timed out)]
asmanur has quit [Remote closed the connection]
ita has joined #ocaml
loufoque has quit [Read error: 113 (No route to host)]
<hcarty> flux: Yes, I tried adding another two wheels on top of the buggy, so it could roll and still move. It took a lot of tinkering to make it work
_JusSx_ has joined #ocaml
mbishop_ is now known as mbishop
robyonrails has joined #ocaml
|Catch22| has quit [Read error: 110 (Connection timed out)]
dibblego has quit ["Leaving"]
dibblego has joined #ocaml
_KS has quit [Read error: 110 (Connection timed out)]
robyonrails has quit ["Sto andando via"]
piggybox has quit [Connection timed out]
ygrek has quit [Remote closed the connection]
dibblego has quit ["Leaving"]
dibblego has joined #ocaml
marmottine has quit ["Quitte"]
_JusSx_ has left #ocaml []
Yoric[DT] has quit ["Ex-Chat"]
hkBst has quit ["Konversation terminated!"]
|Catch22| has joined #ocaml
Mr_Awesome has joined #ocaml
brooksbp has joined #ocaml
dramsay has quit [Read error: 110 (Connection timed out)]
brooksbp has quit []
Tetsuo has quit ["Leaving"]
bluestorm has quit ["Konversation terminated!"]
zheng has left #ocaml []
zmdkrbou has joined #ocaml