smimou changed the topic of #ocaml to: OCaml 3.08.3 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/
Demitar has joined #ocaml
cjohnson has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
dm has quit [Read error: 60 (Operation timed out)]
araujo has joined #ocaml
Smerdyakov has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
<Smerdyakov> Begin conversation... now!
<shrimpx> hi
<Smerdyakov> Heyhey.
Herrchen has joined #ocaml
<Smerdyakov> I'm coming to you live from Redmond. :)
<shrimpx> haha awesome
<shrimpx> intern?
<Smerdyakov> You are going to start at UW in the fall?
<Smerdyakov> Yes
<shrimpx> congrats
<shrimpx> yep i am
<shrimpx> moving to seattle end of august-ish
<Smerdyakov> Right when I move out. ;)
<shrimpx> i just got my marius@cs.washington.edu a few minutes ago
<shrimpx> ah
<shrimpx> Smerdyakov: you're working on the slam project?
<Smerdyakov> No
batdog|gone is now known as batdog
batdog has quit []
batdog has joined #ocaml
Herrchen_ has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit [""Killer freaks from Jersey""]
batdog is now known as batdog|gone
batdog|gone is now known as batdog
bk_ has joined #ocaml
mlh_ has joined #ocaml
Snark has joined #ocaml
cjohnson has quit [""We live like penguins in the desert...""]
dm has joined #ocaml
mlh_ has quit [Client Quit]
Gueben has joined #ocaml
Gueben has quit [Read error: 54 (Connection reset by peer)]
Gueben has joined #ocaml
vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]
smimou has joined #ocaml
_JusSx_ has joined #ocaml
vodka-goo has joined #ocaml
gim has joined #ocaml
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
TeXitoi has joined #ocaml
TeXitoi has quit [Read error: 131 (Connection reset by peer)]
TeXitoi has joined #ocaml
Msandin has joined #ocaml
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
TeXitoi has joined #ocaml
_JusSx__ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
BleSS has joined #ocaml
<BleSS> where get info. about its libraries?
<BleSS> what kind of program is possible build with ocaml? i.e. artifitial intelligence, 3d game engine, graphic aplications, ...
<TeXitoi> for the web site
<TeXitoi> for existing projets
<ulfdoz_> Or simply www.ocaml.org
<BleSS> is it possible binding with gtk+ ?
<BleSS> ada is known for being a language very secure, it's used in systems of airplanes, trains, etc, ocaml is so secure too?
<ulfdoz_> I wonder, whether I missunderstand the question.
<BleSS> ada is a language very secure, what about ocaml?
<dan2> BleSS: ada is very nice, and very strongly typed like ocaml
<TeXitoi> BleSS: there is lablgtk for gtk
<cjohnson> blah
<BleSS> dan2, but programming in ada is horrible, and very heavy
<dan2> very true
<BleSS> if 500 lineas are necessary for building a program in python, java needs 1000 lines, and c 2000 lines, and in ocaml? would it be as java?
<dan2> programming in ocaml is a piece of cake
<TeXitoi> ocaml is easy to use (for me ;-))
<dan2> BleSS: probably 250 - 500
<dan2> BleSS: whats the program?
<BleSS> then, well :)
<BleSS> dan2, I want to know what can be programmed with this language
<dan2> BleSS: whatever you want
<ulfdoz_> BleSS: Your are perhaps interested in this, to get a compare between some languages: http://shootout.alioth.debian.org/
<dan2> ocaml and python are general purpose languages really
<dan2> ocaml also tops most of the charts on shootout
<BleSS> i see than ocaml is very fast, is it possible build embedded software?
<dan2> BleSS: that depends on your requirements
<BleSS> ok
<BleSS> i've seen that eiffel is a very good language, what do u think about that language? i'm in doubt of learning eiffel or ocaml
<dan2> never done eiffel
<dan2> BleSS: btw, whats the embedded platform?
<ulfdoz_> BleSS: In doubt try both, and use whatever is better for your purpose.
<BleSS> dan2, linux
<Gueben> eiffel is powerful and easy to use
<dan2> BleSS: architechture?
<BleSS> ppc
<mflux_> memory consumption can be more difficult to control in garbage collected languages vs. for instance C
<dan2> BleSS: ^ is going to be the most difficult decision
<dan2> BleSS: how much memory do you have
<BleSS> dan2, where? in my desktop system where i programming
<dan2> on your embedded system
<BleSS> ah, 4 M
<BleSS> i think that is 2M
<dan2> mflux_: the ocaml garbage collector is quite good I think
<mflux_> ocaml runtime already takes 1 megabyte?-o
<dan2> mflux_: what if he natively compiles it
<mflux_> dan2, yeah, but stuff still isn't released immediately after you're done with them, and if you have multiple processes all running gc's of their own - although maybe in such low memory situations it would be better to use threads
<mflux_> is PPC a supported platform?
<mflux_> for native building
<TeXitoi> yes
<mflux_> does it give any memory savings? one could even expect bytecode version would require less resources
<dan2> whoa
<dan2> when did caml.inria.fr get a new face?
<pango_> few months ago
<dan2> mflux_: surely enough, he could just reduce the runtime to what he needs no?
<pango_> looking at channel logs, I'd say march
<mflux_> dan2, yes, that will help a lot
<dan2> theres probably not much involved in taking stuff out of the runtime
<dan2> ocaml needs more libraries... it needs to advertise more to the general public
<dan2> ocaml seriously is a very decent language
<ulfdoz_> Is the runtime linked in static or shared into the native code?
<dan2> static I'm sure
<ulfdoz_> One could save additional memory by linking it shared, so that you avoid to load the runtime more than once, when running several apps.
<dan2> right
<ulfdoz_> Unfortunately even linux does not seem to be that smart.
<dan2> if you compile -fPIC
<dan2> it does
<dan2> but PIC code is much slower
dm has quit ["Leaving"]
<mflux_> then there is that ocaml libraries cannot be shared if you generate binaries
<mflux_> so in embedded platforms you want to use bytecode (and use ocaml for linking) or use a single binary that does everything?
<dan2> or create an ocaml runtime loader thingy
* Demitar seems to remember this discussion from the mailing list... several times. ;-)
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
xidaux has joined #ocaml
xidaux is now known as DeadNigger
* DeadNigger plays Aphex_Twin_-_Drukqs_Mix_(Mixed_by_ThinkToy)_192k.mp3
cjohnson has quit [""We live like penguins in the desert...""]
BleSS has left #ocaml []
DeadNigger is now known as dodecahedron
Purice has joined #ocaml
Purice has quit [Read error: 104 (Connection reset by peer)]
cognominal has quit ["Leaving"]
cognominal has joined #ocaml
cognominal has quit [Client Quit]
cognominal has joined #ocaml
cognominal has quit [Client Quit]
cognominal has joined #ocaml
dodecahedron has quit ["leaving"]
Msandin has quit [Read error: 110 (Connection timed out)]
vezenchio has joined #ocaml
pango__ has joined #ocaml
pango_ has quit [Read error: 60 (Operation timed out)]
pango__ is now known as pango
Boojum has joined #ocaml
Snark has quit [Read error: 60 (Operation timed out)]
Skal has joined #ocaml
Boojum is now known as Snark
mattam has quit [Read error: 104 (Connection reset by peer)]
mattam has joined #ocaml
Smerdyakov has joined #ocaml
Herrchen is now known as Herrchen_
senko has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
<senko> hi, is there a way to test if there is something to read in an in_channel?
<Smerdyakov> I suggest using the Event module of the threads library instead, with threads sending channel input to channels.
<Smerdyakov> Then you can use nice select's instead of manual polling.
<senko> ok...
<senko> found Unix.set_nonblock
<Smerdyakov> I mean, sending file channel input to Event channels.
<Smerdyakov> Yeah, but Concurrent ML style is just nicer in general. Who wants to use Unix unnecessarily? :)
<senko> agree :)
cognominal has quit [Remote closed the connection]
cognominal has joined #ocaml
<mflux_> besides select wouldn't be of much use with channels that are read-buffered
<Smerdyakov> How do you mean?
<mflux_> say you select on a buffer, use a buffered read which reads everything from it when you've requested only one character..
<Smerdyakov> So?
<mflux_> so select will report there's no new input arriving
<mflux_> while the buffers would contain some
<mflux_> Unix.select that is
<mflux_> I don't remember if there's a peek operation for in_channels though, it would solve that problem
<Smerdyakov> I'm talking about Event.select.
<mflux_> yeah, I was talking about the original problem
<senko> yes, that was the problem i had...
<mflux_> if you want to use select, don't use buffered input
<senko> i want to use a hypothetical peek function :)
<mflux_> you could just implement buffers yourself
<mflux_> with some neat framework set up you can bind all the code running around select nicely (using continuation passing style) - much more convenient than the traditional C-program running in a select loop
<Smerdyakov> mflux_, you don't like my CML suggestion?
<mflux_> no, it's ok
<mflux_> well.. it's difficult to stop a thread doing 'read' on something
<Smerdyakov> So?
<mflux_> so that's something that can be more easily handled with Unix.select
<mflux_> but the concurrent ml synchronization/message passing primitives are great
<Smerdyakov> It's no problem if you have a thread per buffered channel.
<mflux_> and their lifetime is as long as the descriptor's?
<Smerdyakov> Yes
<mflux_> this is a little cps io-framework I played with quite some time ago, and is far from complete: http://modeemi.cs.tut.fi/~flux/public_html/software/ocaml/ioframework.ml
<mflux_> monads could be more convenient
<Smerdyakov> mflux_, link doesn't work
<Smerdyakov> mflux_, is there an interface description for that, or do I have to decipher the source code? :D
<Snark> good night
Snark has left #ocaml []
_JusSx_ has joined #ocaml
_JusSx__ has quit [Read error: 110 (Connection timed out)]
bk_ has joined #ocaml
Msandin has joined #ocaml
eyda|mon has joined #ocaml
<eyda|mon> Can someone explain to me why I get a failure in this code here? http://rafb.net/paste/results/Z7Wa2x40.html
<TeXitoi> eyda|mon: there isn't the modif function
<TeXitoi> and 2 times sumlista
<eyda|mon> there's some redudancy there I didn't spot
<eyda|mon> it should look like this
<TeXitoi> think problems with paste
<eyda|mon> check this one?
<TeXitoi> let a = List.hd intlist in
<TeXitoi> this raise the exception
<TeXitoi> List.hd
<TeXitoi> with an empty list
<eyda|mon> why?
<TeXitoi> because there is no head in an empty list...
<eyda|mon> ohhh
<TeXitoi> see the doc
<eyda|mon> no, I got it
<senko> otherwise you would get an infinite loop...
<eyda|mon> thanks
<TeXitoi> welcome
_JusSx_ has quit ["leaving"]
<eyda|mon> let rec sumlista intlist res modi=
<eyda|mon> let cur = (modif modi) in
<eyda|mon> match intlist with [] -> res
<eyda|mon> | x::xs -> sumlista xs ((x * cur) :: res) cur;;
<eyda|mon> :)
<TeXitoi> it smell better ;-)
Rearden has joined #ocaml
<dan2> how do I access the last element
<dan2> of a list
<eyda|mon> List.tl
<Smerdyakov> Surely you know how to write a function to do that.
<dan2> I know
<eyda|mon> nm :P
<dan2> Smerdyakov: its kinda crappy that ocaml lists only let you get it by going through the list
<Smerdyakov> dan2, that follows from how list is defined.
<TeXitoi> dan2: list is like that
<TeXitoi> try queue
Skal has quit ["Client exiting"]
<Smerdyakov> dan2, you can define your own data type that supports some operations more efficiently.
<eyda|mon> ok, so I just posted my sumlista function, but it's actually giving me a list in the reverse order than what I had wanted... short of just using List.rev, how could I have written it to give it to me the right way around the first time?
<TeXitoi> List.rev is the good answer, or use non terminal recursive function
<eyda|mon> so is List.rev the common solution? or is the non terminal recursive?
<eyda|mon> I'm not sure what the non-terminal rec function would look like
<TeXitoi> List.rev the common solution
<eyda|mon> do you have an example?
<TeXitoi> a think as:
<TeXitoi> | x::xs -> (x * cur) :: (sumlista ...)
<eyda|mon> good thing i'm actually operating on the list twice, so I don't even need to do the List.rev, I guess it gets straightened out on it's own :)
<eyda|mon> oh
<eyda|mon> thnks
<TeXitoi> but terminal recursion is better
<eyda|mon> faster?
<TeXitoi> better for memory
<Smerdyakov> There's no fundamental reason what TeXitoi just suggested isn't a good idea, but the ocaml compiler will give you problems if you use that strategy on large lists.
<eyda|mon> Smerdyakov: you refer to List.rev ?
<Smerdyakov> The area of memory used to store the call stack is separate and smaller than the area used for everything else.
<Smerdyakov> eydaimon, no, you SHOULD use rev.
<eyda|mon> ah, perfect
<eyda|mon> I was worrying about interesting through the list again would be more expensive than just putting it in the correct order to begin with
<pango> eyda|mon: getting alternative factors could be achieved differently...
<eyda|mon> pango: please suggest
<pango> eyda|mon: handling list members in pairs, or use two reciprocal recursive functions
<eyda|mon> i have a hard time seeing a solution using either of those. still a neophyte I'm afraid
<pango> do you always want 2x factor for the first list member ?
<eyda|mon> yes
<pango> (mmmh well actually no, you start with 1x)
<eyda|mon> I noticed that later. it should be sumlista a [] 1;;
<eyda|mon> (so I do start with 2)
<pango> # let rec sumlista intlist res =
<pango> match intlist with
<pango> | [] -> List.rev res
<pango> | [x] -> List.rev (x*2 :: res)
<pango> | x :: y :: q -> sumlista q (y :: 2*x :: res) ;;
<eyda|mon> pretty clever
<eyda|mon> basically you're not doing anything to the thing that
<eyda|mon> is multiplied by 1 because you don't need to, correct?
<pango> it's specialization. There's only two cases, each one can be optimized, and they occur at known times, and that can be optimized too
<eyda|mon> so you're not using the option of handling in pairs nor two reciprocal recursive funcs, because it's specialized
<eyda|mon> but it's clever because it's specialized :)
<pango> above code handles list in pairs... hence x :: y :: q to get the two first elements
<eyda|mon> ah, you could have done y*3 if I was alternatving between 2 and 3 instead of 2 and 1
<eyda|mon> ok, got it
<eyda|mon> silly to overlook that
<pango> the [x] case only happens for odd numbered lists
<eyda|mon> then I thought I understood it and I don't. why does [x] match odd number and not even?
<eyda|mon> I thought it only matched a list with one member
<pango> sure, the last member of list with a odd number of elements
<pango> s/a/an/
<eyda|mon> well, if a list only contains one member, it's odd by definition... but would [x] match [1;2;3] which is also odd?
<pango> no, upon first call, [1;2;3] would match x :: y :: q, with x = 1, y = 2, q = [3]
<pango> [x] will match [3] on first recursive call
<eyda|mon> ok, good, then I got it
<eyda|mon> thnks much
mlh_ has joined #ocaml
Smerdyakov has quit ["I'm gone!"]
<pango> for completeness :
<pango> # let rec sumlista2 intlist res = match intlist with
<pango> | [] -> List.rev res
<pango> | x :: xs -> sumlista1 xs (x*2 :: res)
<pango> and sumlista1 intlist res = match intlist with
<pango> | [] -> List.rev res
<pango> | x :: xs -> sumlista2 xs (x :: res) ;;
__DL__ has left #ocaml []
Msandin has quit [Read error: 60 (Operation timed out)]
<eyda|mon> and there the two reciprocal recursives
<eyda|mon> now will ocaml be able to optimize that as if it was a regular recursive function?
Gueben has quit ["plouf"]
<eyda|mon> regular tail recursive i should say
<pango> just as much... ocamlopt does very little optimization anyway
<pango> only some inlining afaik
vodka-goo has quit [Read error: 60 (Operation timed out)]
vodka-goo has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
Smerdyakov has joined #ocaml