<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>
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];