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!)
buluca has joined #ocaml
joshcryer has joined #ocaml
seafood_ has joined #ocaml
psnively has joined #ocaml
psnively has quit []
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
piggybox has quit [Read error: 104 (Connection reset by peer)]
EliasAmaral has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
smimou has quit ["bli"]
CRathman has joined #ocaml
nuncanada has joined #ocaml
EliasAmaral has quit [Connection timed out]
piggybox has joined #ocaml
jwoah12 has joined #ocaml
<jwoah12> I'm getting a syntax error on the end on line 11, meaning it's probably a problem with line 10...any ideas? http://pastebin.com/d1036c080
jwoah12 has quit ["Leaving"]
mrsolo has joined #ocaml
mrsolo has quit ["This computer has gone to sleep"]
buluca has quit [Read error: 113 (No route to host)]
mrsolo has joined #ocaml
jaredw has joined #ocaml
<jaredw> How would I read characters from standard input until ^d is encountered?
authentic has quit [No route to host]
mrsolo has quit ["This computer has gone to sleep"]
seafood_ has quit []
seafood_ has joined #ocaml
CRathman has quit ["ChatZilla 0.9.78.1 [Firefox 2.0.0.8/2007100816]"]
mvitale_ has quit [Read error: 110 (Connection timed out)]
mrsolo has joined #ocaml
nuncanada_ has joined #ocaml
nuncanada_ has quit [Remote closed the connection]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
nuncanada has quit [Read error: 110 (Connection timed out)]
authentic has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
darinm has joined #ocaml
authentic has quit [Read error: 113 (No route to host)]
jaredw has quit ["Leaving"]
darinm has left #ocaml []
bluestorm_ has joined #ocaml
seafood_ has quit []
mrsolo has quit ["Leaving"]
darinm has joined #ocaml
darinm has quit [Remote closed the connection]
asmanur has joined #ocaml
filp has joined #ocaml
piggybox_ has joined #ocaml
piggybox has quit [Read error: 110 (Connection timed out)]
salierix has joined #ocaml
<salierix> The fact that ints are only 31/63-bits sure is annoying...
smimou has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
jlouis_ has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
jlouis has quit [Read error: 110 (Connection timed out)]
<salierix> How do I read an int32 from a file?
<bluestorm_> "a file" ?
<bluestorm_> Int32.of_string ?
<bluestorm_> salierix: is it a binary int32 ?
<bluestorm_> for a binary int, i'd use a routine with input_byte and byte shifting
<Yoric[DT]> The question is essentially: how did you store it in the first place ?
smimou has quit ["bli"]
Tetsuo has joined #ocaml
m3ga has joined #ocaml
m3ga has quit [Read error: 104 (Connection reset by peer)]
<rwmjones> salierix, this is a problem which I'm studying at the moment ... http://et.redhat.com/~rjones/libunbin/
<salierix> bluestorm_, binary int32? What else would it be?
<bluestorm_> you could read a textual representation of an int
<salierix> Oh that's what you meant... yeah it's a binary int32.
buluca has joined #ocaml
piggybox_ has quit [Connection timed out]
piggybox has joined #ocaml
seafood_ has joined #ocaml
mvitale_ has joined #ocaml
seafood_ has quit []
buluca has quit [Read error: 113 (No route to host)]
Jedai has joined #ocaml
gim has quit [Remote closed the connection]
gim has joined #ocaml
jlouis has joined #ocaml
Torment has quit [Read error: 110 (Connection timed out)]
<flux> salierix, read four bytes (characters) and produce the final value from those bytes
jlouis_ has quit [Read error: 110 (Connection timed out)]
<flux> rwmjones, the library looks very nice; also nice that you've bothered to write the web page which seems to give a very nice overview of its capabilities
<bluestorm_> rwmjones: do you know what XenSource is using ocaml for ?
<rwmjones> bluestorm_, all their proprietary enterprise stack is apparently written in it
<rwmjones> XenEnterprise is the name
<flux> rwmjones, are the licencing conditions still under consideration? not finding a copying- or licence-file..
<rwmjones> for libunbin?
<rwmjones> it's basically LGPL, except for standalone programs which are GPL -- standard Red Hat licenses for everything
<flux> plain LGPL is problematic for ocaml program, which doesn't have shared libraries - essentially renders LGPL into GPL
<flux> (hence the often-found exception when people LGPL ocaml libraries)
<rwmjones> sorry I meant LGPL with the linking exception
<rwmjones> I'll change the web page to state this later (on a call at the moment)
<flux> no horry, I don't think I'll really have any use for that now, but perhaps I will at some day :)
<flux> no hurry, even
<flux> also, perhaps a link to the cil web page would be nice, apparently it does a lot of the magic
<flux> I don't think there is much other cil-based C-interoperability-software for ocaml?
<flux> hm, apparently there is a Cil around with a META-file - in redhat, I suppose?
Ian__ has joined #ocaml
Ian__ has left #ocaml []
univac has quit [Read error: 104 (Connection reset by peer)]
<tristram> do you know if it possible to have a gaussian random distribution (easily if possible ?)
<rwmjones> it's a pain in the neck to get it into a reasonable shape for an RPM, because it hard-codes a (stupid) directory structure all over the place
Tetsuo has quit [Remote closed the connection]
szsz_ has joined #ocaml
<hcarty> tristram: ocaml-gsl may have something you can use
<tristram> thks
szsz_ has quit [Read error: 113 (No route to host)]
<salierix> Is it possible to grow an array?
<tristram> no
crathman has joined #ocaml
<unfo-> but if you get Array seeds from the garden shop?
<hcarty> rwmjones: libunbin looks very useful. Thanks for putting it out.
<rwmjones> salierix, no, but extlib has a hairy implementation of a growable array
<rwmjones> salierix, called DynArray - it's hairy because it uses Obj.magic IIRC
<hcarty> salierix: There is also the Vec library (which I have not used) - http://www.dealfaro.com/home/vec.html
<rwmjones> and ^ that one too :-)
<rwmjones> the basic problem as I understand it is that the OCaml allocator doesn't really support growing allocations (ie. no equivalent of realloc)
<bluestorm_> hm
<tristram> salierix: if you want just something that grows consider lists, if furthermore you need fast random acces, well...
<bluestorm_> as there is a compacting GC, i don't see how that could be possible
<bluestorm_> tristram: Map ?
<bluestorm_> hm
<rwmjones> salierix, obstack?
<salierix> obstack?
* Yoric[DT] is getting tired of the Big Language Shootout.
<bluestorm_> manually resized array have an amortized cost of O(1) anyway
<bluestorm_> i guess that would be an acceptable solution
* Yoric[DT] submits samples with compiler flags, they use different compiler flags and suprisingly the samples don't work.
<rwmjones> maybe not actually
* Yoric[DT] will try one last time.
<salierix> Speaking of the language shootout, why does Clean seem to do so well?
buluca has joined #ocaml
<Yoric[DT]> salierix: from what I see, I assume it's floating point arithmetics.
<Yoric[DT]> OCaml is not very good at that...
<salierix> Why doesn't the ocaml interpreter seem to have any history to recall previously entered expressions?
<bluestorm_> salierix:
<bluestorm_> you can use an external tool for that
<bluestorm_> i use rlwrap
<bluestorm_> but ledit does the job too
<flux> rlwrap is perhaps the nicer one; I used to use ledit..
<flux> although it doesn't actually answer the requestion: I suppose because external tools handle the case so nicely that it hasn't been a priority :)
<flux> s/re//
<bluestorm_> i think the main explanation is that GNU readline raise licensing issues
<bluestorm_> but anyway flux is right
<bluestorm_> having an external tool for that is nice
<bluestorm_> flexible and simple, no code bloat
<flux> gnu readline isn't the only option, there is a bsd-licensed competitor; I don't recall its name
<flux> s/competitor/alternative/ :)
* Yoric[DT] uses rlwrap.
<salierix> The rlwrap gentoo package is masked for some reason :\
<flux> I use rlwrap with some other tools also.. like gnuplot.
<mbishop> rlwrap is nice
<bluestorm_> flux: doesn't gnuplot have a native history handling ?
<flux> it does, but its command line editor sucks otherwise
<salierix> Why didn't I hear about rlwrap until now... pretty cool.
<bluestorm_> alias ocaml='rlwrap ocaml' might be a good idea
<flux> you might want to add a flag for saving the history too, it's pretty useful
<salierix> Anyway, to grow an array couldn't I just call Array.append?
<bluestorm_> yes you could
<bluestorm_> but that would'nt modify your first array in-place
<bluestorm_> that's not "growing" : there is a higher overhead
<salierix> Do you mean the elements are copied?
<bluestorm_> yes
<Yoric[DT]> Really, if you want growable arrays, use Extlib.
<bluestorm_> the question is : are those array in an important part of your code ?
<bluestorm_> if you use them 3 times during initialisation, you could even use association list or whatever
<salierix> I'm trying to implement the cult of the bound variable um from the 2006 icfp contest.
<salierix> Hm, actually I could probably use a list...
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
<flux> uh.. I just wrote a function produce_consume (('a -> unit) -> unit) -> (('b -> 'a option) -> 'c) -> 'c, and it's bloody ugly
<flux> btw, who can guess what it does, based on name and types?-)
<bluestorm_> hm
* Yoric[DT] notices that 'b is ignored.
<flux> that's actually a good point!
<flux> it can be ()
<flux> but maybe it's a bug :)
<flux> yes, had a function with parameter where a unit was to be expected; obviously unit worked too
<flux> the purpose of the function is to glue to higher order functions together - yes, it's side-effectful
<bluestorm_> hm
<flux> such as: produce_consume (fun produce_data -> produce_data 4; produce_data 3) (fun receive_data -> Printf.printf "%d\n" (unopt (receive_data ())); Printf.printf "%d\n" (unopt (receive_data ())))
<bluestorm_> is the ('b -> 'a option) an obfuscation of 'a option lazy_t ?
<flux> hm, not really in this case
<bluestorm_> ah, see
<bluestorm_> you want it to be computed numerous times
<flux> I wish I could do that without threads
<flux> well, there are those continuation thingies for ocaml too, but..
<flux> (but they are research-level, and/or don't work with native code)
rwmjones has left #ocaml []
<salierix> Is it possible to add elements to the end of a list?
<Yoric[DT]> @
<Yoric[DT]> But that's a purely functional add, i.e. it takes linear time and returns a new list.
<bluestorm_> you should only add them at the beginning
<bluestorm_> otherwhise, "list" is not the structure you're looking for
<salierix> Couldn't ocaml just store the tail pointer of the list too?
<salierix> They are linked lists right?
<bluestorm_> that wouldn't be a functionnal list anymore
<bluestorm_> but you can code one if you want
<bluestorm_> with an home-made dataype
<Yoric[DT]> Extlib also has one such datatype.
<bluestorm_> type 'a ugly_list = Nil | Cons of 'a * 'a ugly_list ref
<bluestorm_> salierix: maybe you could use Queue
filp has quit ["Bye"]
darinm has joined #ocaml
psnively has joined #ocaml
david_koontz has quit [Read error: 110 (Connection timed out)]
filp has joined #ocaml
darinm has quit [Read error: 110 (Connection timed out)]
asmanur has quit [Connection timed out]
buluca has quit [Read error: 113 (No route to host)]
crathman has quit [Read error: 110 (Connection timed out)]
psnively has quit []
Tetsuo has joined #ocaml
ygrek has joined #ocaml
l_a_m has quit [zelazny.freenode.net irc.freenode.net]
l_a_m has joined #ocaml
asmanur has joined #ocaml
<bluestorm_> hm
<bluestorm_> looks very interesting
zvrba has quit [Remote closed the connection]
david_koontz has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
<flux> that is something I've been intending to do, but my results have not been very satisfying
<flux> I've had the same approach though: select, project, join
<flux> however, expressing joins wasn't very nice. and it didn't have static properties the compiler would be able to check - on the other hand, that allows even more dynamic queries
<flux> but being able to compose the queries is definitely a very interesting thing for me, because I have tons of hand-written sql-expressions; many would be simplified if they could use other queries as part of them
<flux> (it doesn't have any camlp4, which would also be nice)
<flux> that document does give me a few more ideas, though..
<bluestorm_> :p
<flux> I've got the .mli here if anyone cares :-) : http://www.modeemi.cs.tut.fi/~flux/software/sql.mli
ygrek has quit ["Leaving"]
<bluestorm_> flux: that's strangely similar
<bluestorm_> however, his use of polymorphic variant seems very useful to retain typing information
<bluestorm_> see
<flux> I don't think it's that strange it's similar, it stems from the theory.. however, I haven't read the theory that much, perhaps I should :)
<bluestorm_> if you had blogged this just a few days ago, i'd have said "looks very interesting" :-'
<bluestorm_> (sometimes i think 'we' (= the others) could do something like a planet)
<flux> I think my approach may be a bit more pragmatic than his, though.. but he hasn't revealed everything, so it's difficult to say
<flux> I'm thinking all the troublesome queries that don't directly map into a simple cross join etc
<bluestorm_> :p
<flux> also, my system doesn't construct working queries for all situations, so perhaps there is a reason for not attempting to implement everything sql can do :)
<flux> actually what could really simplify my code would be to grab that idea of renaming columns, that has been a real problem for me
<flux> when I'm joining two tables, I still refer to the original names in the select. so if I then again join that with something else, I still need to refer to the original names
<flux> and finally if I join something with a table that's already in the query, I'm in deep trouble
<flux> not to mention the queries can become quite hideous: SELECT * FROM (SELECT site, name FROM site) AS i4g(i4g_0, i4g_1) WHERE (i4g.i4g_0) IN (SELECT i6j.i6j_2 FROM (SELECT * FROM (SELECT client, name FROM client) AS i1g(i1g_0, i1g_1) LEFT JOIN (SELECT host, ip, site, client FROM host) AS i3g(i3g_0, i3g_1, i3g_2, i3g_3) ON ((i1g.i1g_0) = (i3g.i3g_3))) AS i6j(i6j_0, i6j_1, i6j_2, i6j_3, i6j_4, i6j_5)) - it's not very smart..
<flux> well, I might just go ahead and put it to web: http://www.modeemi.cs.tut.fi/~flux/software/ocaml-sql/sql.ml - but it has its problems..
kelaouchi has joined #ocaml
<salierix> Anyone here know anything about CPU architecture?
<tristram> is #øcaml the place to ask about cpu architecture ?
<salierix> Not really, I'm just curious about something.
<flux> about what?
<salierix> I'm curious why CPU designers keep adding more cache to the chips instead of on-die addressable memory.
<flux> I've thought that's because lots of memory takes lots of space, and it is advisable to keep distances short when you are running at 3GHz - and when you don't want to have a very large cpu
Tetsuo has quit [Remote closed the connection]
<flux> also I think the on-die memory is somehow different from your regular system memory. but perhaps someone else knows the specifics, or perhaps some website explains these things.
<flux> and I'm not off to sleep, happy research :)
<salierix> Yeah, there is probably some reason for it.
<flux> uh, s/not/now/, quite a change in meaning..
<bluestorm_> hm
<bluestorm_> i haven't considered it before
<bluestorm_> but when you're running at 3Ghz
<bluestorm_> you actually have to do really small circuits
<bluestorm_> to avoid problems with the "slow" speed of light :)
<salierix> The most disappointing aspect of computers right now is that system memory is so slow.
<salierix> In comparison to the CPU.
<salierix> That and winchester hard drive are still exist.
Yoric[DT] has quit [Read error: 113 (No route to host)]
salierix has left #ocaml []
nuncanada has joined #ocaml
ita has joined #ocaml
asmanur has quit [Remote closed the connection]
piggybox has quit [Read error: 104 (Connection reset by peer)]
kelaouchi has quit [Read error: 110 (Connection timed out)]
filp has quit ["Bye"]
ita has quit ["Hasta luego!"]
szsz_ has joined #ocaml
thermoplyae has joined #ocaml
<thermoplyae> if i make two record types with overlapping names, ocaml gets angry when it tries to type them on its own
<thermoplyae> is there a way to explicitly type them and shut the compiler up?
szsz_ has quit [Read error: 104 (Connection reset by peer)]
<bluestorm_> thermoplyae: afaik, you cannot
<bluestorm_> you have to avoid overlapping names
<bluestorm_> modules could be helpful
<thermoplyae> lame, but modules are a reasonable solution. thanks
<mbishop> Could someone tell me why the prompt prints twice when trying to exec a program that doesn't exist?
<mbishop> my-shell % exec foo
<mbishop> No such program.
<mbishop> my-shell % my-shell %
<bluestorm_> let pid = fork () in
<bluestorm_> :p
<mbishop> heh, what?
<bluestorm_> after forking
<bluestorm_> you'll have two process running
<bluestorm_> i bet both will want to print "my-shell"
<bluestorm_> an easy way to check that would be to add a brutal exit in the "with " case of your "try execvp ..."
<bluestorm_> print_endline "Something is wrong!"
<bluestorm_> end; exit 0
<bluestorm_> that seems to solve the problem
<bluestorm_> of course i don't know what the "good" solution is
<bluestorm_> but there is the problem
<mbishop> perhaps I could just give the pid to Unix.kill ?
<bluestorm_> hm