adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml-lang.org | Public logs at http://tunes.org/~nef/logs/ocaml/
Cyanure has quit [Remote host closed the connection]
gnuvince has joined #ocaml
emmanuelux has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
Zerker has joined #ocaml
TDJACR has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
ulfdoz_ has joined #ocaml
sepp2k1 has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz_ is now known as ulfdoz
xavierm02 has quit [Quit: Leaving]
NaCl_ is now known as NaCl
Neros has quit [Ping timeout: 260 seconds]
Neros has joined #ocaml
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
Neros has quit [Read error: Operation timed out]
<pippijn> how can .annot files be used for .mly files?
Engu has joined #ocaml
<Engu> Hi
Neros has joined #ocaml
<pippijn> hmm, tuareg does it right
<pippijn> how does it do that?
Neros has quit [Ping timeout: 244 seconds]
<pippijn> because the source locations in the .annot file point at the generated file, not the .mly file
Engu has quit [Quit: Page closed]
Engu has joined #ocaml
<Engu> Hi again, is there anyone who could help me with some strange behaviour of the module Graphics ?
Engu has quit [Client Quit]
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
Yoric has joined #ocaml
Yoric has quit [Client Quit]
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
answer_42 has joined #ocaml
Kakadu has joined #ocaml
cdidd has joined #ocaml
paolooo has joined #ocaml
Yoric has joined #ocaml
chambart has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
jewel has joined #ocaml
GnomeStoleMyBike has joined #ocaml
Zerker has quit [Remote host closed the connection]
chambart has joined #ocaml
Cyanure has joined #ocaml
paolooo has quit [Ping timeout: 245 seconds]
Snark has joined #ocaml
ontologiae has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
chambart has quit [Ping timeout: 246 seconds]
chambart has joined #ocaml
tane has joined #ocaml
ontologiae has joined #ocaml
pango is now known as pangoafk
mcclurmc_away is now known as mcclurmc
chambart has quit [Ping timeout: 246 seconds]
iago has joined #ocaml
larhat has joined #ocaml
Neros has joined #ocaml
ontologiae has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
sepp2k has joined #ocaml
<wieczyk> When do you use Objects?
<adrien> when forced to
xavierm02 has joined #ocaml
jpdeplaix has quit [Quit: WeeChat 0.3.7]
jpdeplaix has joined #ocaml
chambart has joined #ocaml
ChristopheT has joined #ocaml
ChristopheT has left #ocaml []
chambart has quit [Ping timeout: 246 seconds]
<xavierm02> hey
<xavierm02> I have a question
<xavierm02> I have a list of ordered elements
<xavierm02> and I want to insert a new one while keeping the order
<xavierm02> how do I do that efficiently?
<Kakadu> xavierm02: zippers?
<wieczyk> let rec insert elem = function
<wieczyk> | [] -> [elem]
<wieczyk> | x::xs -> if x < elem then elem::x::xs else x::insert elem xs
<wieczyk> ?
<wieczyk> something wrong lol
<nicoo> wieczyk: Sounds right
<xavierm02> hm
<nicoo> Need parenthesis though
<xavierm02> so you build a totally new list
<wieczyk> | x::xs -> if x < elem then x::insert elem xs else elem::x::xs
<xavierm02> I wanted to "set" the tail of the list at some point
<wieczyk> this is right :D
<nicoo> xavierm02: No; the tail is reused
<xavierm02> but you rebuild the list up to the inserted element
<nicoo> Yes; this is unfortunately unavoidable (using lists)
<xavierm02> whereas I thought you could keep that piece of list too
<xavierm02> so what would you recommend
<xavierm02> instead of lists ?
<xavierm02> I don't know the numbers so I can't know where to place them if I take an array :/
<xavierm02> I know I'll have like 10 different numbers
<xavierm02> but they can range from 1 to 10 or from 1 to 10000
<nicoo> xavierm02: What kind of operations do you want to support ?
<Kakadu> btw wieczyk's soultion seems to be unefficient
<nicoo> Kakadu: For inserting 1 element in a sorted list, it is about optimal
<adrien> first make it right, then think about making it efficient
<nicoo> adrien: I don't believe xavierm02 need a datastructure that is « sorted lists » though
<nicoo> (That's why I asked what operations he wants on his datastruct)
<adrien> possible too
<xavierm02> Well
<xavierm02> I have an input coming with pairs (old, new) that tell me what level of old doors and new doors this pass can open
<xavierm02> and then I have (age, level) that represent the doors
<xavierm02> and I need to minimize the numbers of passes I need
<xavierm02> ** I do not want the answer
<xavierm02> But
leoncamel has joined #ocaml
<nicoo> xavierm02: I didn't ask what your problem was; I asked what operations you used on the datastructure.
<xavierm02> I want to order the passes by their "old" level
<xavierm02> when I'll get a "door"
* nicoo goes AFK a few minutes
<nicoo> xavierm02: I'll read the log though
<xavierm02> I'll read all passes up to the one that has the "old" level of my door
<Kakadu> this is my code for inserting: http://paste.in.ua/7683/raw/
<xavierm02> because I can't know in advance what index it's at
<xavierm02> so I though since random access was useless
<xavierm02> I'd better go with a list and not an array
<nicoo> Kakadu: You may want to use List.rev_append
<Kakadu> xavierm02: so (old,new) exists if there is a pass from `old` to `new`
<nicoo> And it is unclear it will be more efficient, despite being tail-recursive
<Kakadu> ?
<nicoo> It will avoid stack-overflow, though
<nicoo> xavierm02: You still didn't say what the *operations* on the datastruct are
<adrien> as Xavier Leroy once said, if you're doing it with lists with 150k elements, you're doing it wrong =)
<Kakadu> xavierm02: if starting door is set than it seems to be an exercise about writing Breadth-first search
<xavierm02> nono
<xavierm02> old and new
<xavierm02> are "levels" of door a pass can open
<xavierm02> anyway
<xavierm02> I need a datastructure to:
<xavierm02> - store n numbers and get an ordered array/list/other at the end
<xavierm02> - read all elements up to the element having a given value (so I have no idea what the index is beforehand)
<Kakadu> AFAIR If we take Set from Core it has to_list function which generate list of ordered elements
<nicoo> xavierm02: Ok, so you need insert and iterate ?
<nicoo> Kakadu: Using set is efficient indeed; not producing a list at the end is even nicer
<xavierm02> but a set isnt ordered...
<pippijn> it's not?
<Kakadu> nicoo: but using set is not very good for educational purpose
<xavierm02> is it?
<Kakadu> it is
<pippijn> the ocaml stdlib set is ordered
<pippijn> you need to provide a "compare" for that reason
<xavierm02> I think
<xavierm02> I'll go with putting everything in an array
<nicoo> xavierm02: iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.
<xavierm02> sorting it
<xavierm02> and then removing the useless passes and making the array a bit smaller
chambart has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
wtetzner has quit [Ping timeout: 260 seconds]
wtetzner has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
mcclurmc is now known as mcclurmc_away
mcclurmc_away is now known as mcclurmc
mcclurmc is now known as mcclurmc_away
mcclurmc_away is now known as mcclurmc
toolslive1 has joined #ocaml
toolslive has quit [Ping timeout: 240 seconds]
<wieczyk> What does compare on Hashtbl or Map.t?
<adrien> ENOTPROPERSENTENCE
<wieczyk> What does compare do on Hashtbl.t or Map.t?
<nicoo> wieczyk: You mean « what is the compare function used, element-wise, for Hashtbl or Map » or « what is the order taken on hash-tables and maps »
<nicoo> ?
<nicoo> (Please, do not answer « yes »)
<wieczyk> What does do the compare function used on those collections.
<wieczyk> Hehe.
<nicoo> wieczyk: Documentation doesn't specify
<wieczyk> ok
<wieczyk> Where I can find the INT_MAX and INT_MIN?
chambart has joined #ocaml
<nicoo> wieczyk: max_int and min_int.
<nicoo> But please lookup documentation before asking
jamii has joined #ocaml
pangoafk has quit [Ping timeout: 248 seconds]
gnuvince has quit [Ping timeout: 252 seconds]
pangoafk has joined #ocaml
Neros has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
leoncamel has quit [Ping timeout: 252 seconds]
leoncamel has joined #ocaml
Snark has quit [Quit: Quitte]
Anarchos has joined #ocaml
lolcathost has joined #ocaml
Yoric has joined #ocaml
flux has joined #ocaml
leoncamel has quit [Read error: Connection reset by peer]
leoncame` has joined #ocaml
sepp2k1 has joined #ocaml
pangoafk is now known as pango
sepp2k has quit [Ping timeout: 256 seconds]
clog has quit [^C]
clog has joined #ocaml
lolcathost has quit [Ping timeout: 265 seconds]
<Kakadu> let b = Buffer.create 100 in
<Kakadu> Printtyp.signature Format.(formatter_of_buffer b) [item];
<Kakadu> printf "Describe: %s\n%!" (Buffer.contents b);
<Kakadu> Any ideas why b is empty after this?
<Kakadu> But when I use Format.std_formatter it prints something
<wieczyk> It should not.
<wieczyk> Buffer.create 100 creates an empty buffer
<wieczyk> with capacity 100
<wieczyk> OK, it writes to buffer
<Kakadu> forget, I have understanded my problem
<Kakadu> Printtyp.signature sometimes writes nothing, sometimes writes what I want
<wieczyk> ;]
jewel has quit [Read error: Operation timed out]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
notdan is now known as codan
Tobu has quit [Ping timeout: 260 seconds]
answer_42 has quit [Quit: WeeChat 0.3.9]
Yoric has quit [Ping timeout: 252 seconds]
jamii has quit [Read error: Connection reset by peer]
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 240 seconds]
Kakadu has quit [Quit: Konversation terminated!]
gnuvince has joined #ocaml
foo303_ has quit [Quit: leaving]
avsm has joined #ocaml
Yoric has joined #ocaml
iago has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
Cyanure has quit [Remote host closed the connection]
gnuvince has quit [Ping timeout: 240 seconds]
mcstar has quit [Quit: mcstar]
Cyanure has joined #ocaml
Yoric has quit [Ping timeout: 240 seconds]
Cyanure has quit [Remote host closed the connection]