seafood has quit [Read error: 104 (Connection reset by peer)]
shortc|desk has quit [Read error: 110 (Connection timed out)]
seafood has joined #ocaml
shortcircuit is now known as shortc|desk
TypedLambda has quit [Read error: 110 (Connection timed out)]
Proteus_ has quit [Read error: 110 (Connection timed out)]
Proteus_ has joined #ocaml
netx has quit [Remote closed the connection]
sporkmonger has quit []
Axioplase has quit ["/quat"]
sporkmonger has joined #ocaml
sporkmonger has quit [Connection timed out]
ofaurax has quit ["Leaving"]
filp has joined #ocaml
filp has quit ["Bye"]
netx303 has left #ocaml []
filp has joined #ocaml
filp has quit [Client Quit]
asmanur has joined #ocaml
pants1 has joined #ocaml
mishok13 has joined #ocaml
Kopophex has quit ["Leaving"]
asmanur_ has joined #ocaml
Yoric[DT] has joined #ocaml
asmanur__ has joined #ocaml
munga has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
rwmjones has joined #ocaml
asma has joined #ocaml
asmanur_ has quit [Read error: 110 (Connection timed out)]
asmanur__ has quit [Connection timed out]
FoolOfSoul has joined #ocaml
letrec has joined #ocaml
<letrec>
Hi! How do I read a full line (terminated by \n) in ocaml? Scanf.scanf "%s" only reads a word.
<asma>
read_line ()
<letrec>
Ok, looks simple :)
<asma>
(with Scanf, you can also do Scanf.scanf "%[^\n]")
Snark has joined #ocaml
Jedai has joined #ocaml
guillem_ has joined #ocaml
vbmithr has joined #ocaml
<letrec>
I'm defining rr as: let rec rr () = (let s= read_line () in print_string s); rr (). It works fine in interactive mode. But assume I have a file myfile.txt if, on Linux, I do: cat myfile.txt | ./a.out , then it doesn't work as expected: the \n are not taken into account??
<letrec>
So the read_line () call returns more than one line??
<letrec>
What do I do wrong?
<asma>
letrec: what does happen ?
<asma>
(btw, i think read_line () does not include the '\n' in the string returned)
hkBst has joined #ocaml
OChameau has joined #ocaml
sponge45 has joined #ocaml
asma has quit [Remote closed the connection]
asmanur has joined #ocaml
TypedLambda has joined #ocaml
ygrek has joined #ocaml
bluestorm has joined #ocaml
hectorpal has joined #ocaml
<hectorpal>
hi all. Anybody familia with module Unix
<hectorpal>
ok. the problem is than a process reports getppid() 1 when it was created from another program that was, for sure, still alive
Demitar has quit [Remote closed the connection]
Demitar has joined #ocaml
<rwmjones>
no one's aware of an ocaml module called Bitstring?
hectorpal has left #ocaml []
asmanur has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
piggybox has joined #ocaml
<tsuyoshi>
no.. for a second I thought you were asking about bitmatch and I was thinking "didn't you write that...?"
<rwmjones>
tsuyoshi, -> caml-list
<bluestorm>
if you're considering conflict issues, could you not have a globale Bitmatch module ?
<bluestorm>
-e
<rwmjones>
no, see caml-list
<bluestorm>
seen
<bluestorm>
quite humoristic from an exterior perspective :-'
<bluestorm>
rwmjones: that bind(len * 8) is interesting but it seems a bit dangerous, because of the implicit confusion with the former "len" ; wouldn't a (bind len*8 as bit_len) be more prudent ?
<rwmjones>
bluestorm, it binds the pattern (the first part of the field), so is just equivalent to let len = len * 8 in (*rest of code*)
<bluestorm>
(similarly, you could use : offset as crc_offset)
<rwmjones>
making anything more complicated is quite hard, given camlp4 etc
<bluestorm>
hm
<bluestorm>
i see, implementation complexity
<bluestorm>
the "patterns" package might be helpful there, though i've not tried it yet
<rwmjones>
yeah, jeremy wanted to integrate bitstring into the patterns package
<rwmjones>
but I'm using all this to get actual real work done, so not much time for polishing
<bluestorm>
:p
asmanur has joined #ocaml
asmanur has quit [Remote closed the connection]
asmanur has joined #ocaml
guillem_ has quit [Remote closed the connection]
<letrec>
Gents, I thought != and <> were equivallent for basic types?
<letrec>
For string it is not the case, I'm confused
vixey has left #ocaml []
vixey has joined #ocaml
marmotine has joined #ocaml
Associat0r has quit []
<rwmjones>
letrec, only for unboxed types (ie. int)
<rwmjones>
definitely not for string which is boxed
filp has joined #ocaml
<letrec>
rwmjones: ok, thanks. I lost 1 hour on this, that's something one should know upfront :)
filp has quit [Client Quit]
<rwmjones>
just don't use != at all .. it's very rarely needed
RobertFischer has joined #ocaml
<rwmjones>
ugh ... now begins the tedious process of renaming and copying everythig
<rwmjones>
everything
<letrec>
rwmjones: What are you doing? I'm curious...
sporkmonger has joined #ocaml
Linktim has joined #ocaml
redocdam has joined #ocaml
pango_ has quit [Remote closed the connection]
Proteus_ has quit [Read error: 110 (Connection timed out)]
Proteus_ has joined #ocaml
coucou747 has quit [Client Quit]
peck has joined #ocaml
pango_ has joined #ocaml
_andre has joined #ocaml
<_andre>
hello
<_andre>
is there a way to use a record with mutable fields as hash table keys and not lose them when a field update is done?
<_andre>
(other than using Hashtbl.replace after the update)
<bluestorm>
i don't understand what you want to do
<bluestorm>
(of course using a proper name without overriding Hashtbl would be a better idea)
<_andre>
yeah
<_andre>
thanks a lot bluestorm
<bluestorm>
you're welcome
szell has joined #ocaml
mishok13 has quit [Read error: 104 (Connection reset by peer)]
sporkmonger has quit [Read error: 110 (Connection timed out)]
seafood has quit []
TypedLambda has quit []
szell` has quit [Read error: 110 (Connection timed out)]
redocdam has quit []
<_andre>
bluestorm: maybe you can help me again :)
<bluestorm>
?
<_andre>
i was defining a graph type like this:
<_andre>
type ('a, 'b) t = ('a, ('a, 'b) Hashtbl.t) Hashtbl.t
<_andre>
but now instead of the normal Hashtbl, i want the "things indexed by the id field"
<_andre>
erm, s/indexed/hashed/
<_andre>
is it possible to specify something like that?
<_andre>
ie, letting it work on whichever records, as long as theres an id field?
<bluestorm>
hm
<bluestorm>
_andre: do you want to keep polymorphism on the keys ?
<bluestorm>
or your specific type from before ?
<_andre>
ideally the graph should be general, so i'd like to keep the keys polymorphic
<bluestorm>
if you don't need polymorphism, module Recordtbl = Hashtbl.Make(Record), and then type 'a graph = ('a Recordtbl) Recordtbl
<bluestorm>
hm
<bluestorm>
then you should try something like
<bluestorm>
hm
ygrek has quit [Remote closed the connection]
<bluestorm>
are you sure a Hashtable is the more appropriate structure for a graph ?
<bluestorm>
i'd have tried an array, or a dynarray at least
<bluestorm>
_andre: actually i'm not sure what your representation mean
<_andre>
it's a hash where the keys are vertices and the values are hashes, of which they keys are also vertices (the neighbors) and the values are the edge label
<bluestorm>
ok
<_andre>
i didn't use an array to avoid having to keep a map between a vertex and its position in the array
<bluestorm>
but you still want your edge to have mutable data attached ?
<bluestorm>
i think the indexed array is actually the simplest representation
<_andre>
actually all this problem is because the vertex type i used is a record, and it has mutable fields
<_andre>
so when i change one of those fields, it "vanishes" from the graph
<bluestorm>
or even type ('v, 'e) graph = { vertices : 'v array; edges : (int * 'e) list array }
<bluestorm>
(list or map or hashtable, any associative type would do the job)
jlouis has quit ["Leaving"]
jlouis has joined #ocaml
<bluestorm>
you have a mapping but it is simple
<bluestorm>
with the precedent approach i think you would need a whole functor layer, plus encapsulated vertices construction...
<bluestorm>
(you can change the array with a Dynarray.t of Extlib for extensibility)
<bluestorm>
hm
<_andre>
well, one of the reasons for using hash tables is that i have to remove from the graph all vertices which don't belong to its strongly connected component
<_andre>
and removing from an array would leave "holes"
<bluestorm>
type ('a, 'b) graph = { mutable vertex : 'a; mutable neighbors = ('b * ('a, 'b) graph) list } would do the job too, but is probably a bit more tricky
<_andre>
that looks like the inductive graphs i tried to use before in haskell... it *was* tricky :p
<_andre>
i wouldn't mind the functor layer, i just don't know how to do it...
<bluestorm>
basically, instead of value-level polymorphism you'd have functor-level polymorphism : you would need to create an instance of the functor for each type specialisation
<bluestorm>
(as we currently do with Map and Set)
<_andre>
ok, so i'd have something like Graph.Make which would in turn use Hashtbl.Make giving it the right way to do the hashing
<_andre>
what i can't see is how to specify that the vertex type can be any record as long as it has an id field
<bluestorm>
the idea of HashMutable is to make the enhanced (edge + key information) type abstract, so that you can't build a value without using the Foo.build function
ygrek has joined #ocaml
<_andre>
bluestorm: it's a bit over my head, i'm reading on functors to see how i'd use that :)
rwmjones has quit ["Closed connection"]
rwmjones has joined #ocaml
<bluestorm>
well
<bluestorm>
module Test = struct type t = int ref end
<bluestorm>
module HTest = HashedMutable(Test)
<bluestorm>
module GTest = Graph(HTest)
mishok13 has joined #ocaml
<bluestorm>
you only have to provide a type, then add a HashedType interface with the HashedMutable functor, and then build a graph from it
<bluestorm>
and you have to create your edges with something like
<bluestorm>
let edge = HTest.build (ref 2)
<bluestorm>
s/edge/vertex/
letrec has quit [Read error: 104 (Connection reset by peer)]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
sporkmonger has joined #ocaml
<_andre>
bluestorm: module Graph should actually implement the functions in Hashtbl.S, right?
<_andre>
so that i can use GTest.create and such
filp has joined #ocaml
filp has quit [Client Quit]
OChameau has quit ["Leaving"]
_andre has quit ["Lost terminal"]
Linktim_ has joined #ocaml
redocdam has joined #ocaml
redocdam has quit []
Linktim has quit [Read error: 113 (No route to host)]
LordMetroid has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
sporkmonger has quit []
msinhore has quit ["Leaving"]
Snark has quit ["Ex-Chat"]
redocdam has joined #ocaml
tomh has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
ygrek has quit [Remote closed the connection]
mbk has left #ocaml []
dfsfdsdfsfdf has joined #ocaml
<Jeff_123>
Does anyone know where internal types in caml are registered with ocamlc? I'm trying to get a couple of my own types to be built-in. I think I have the parsing and c functions there, but I'm not sure how to get it into the built-in table of types.
_andre has joined #ocaml
<Jeff_123>
oooo I might have found it
nuncanada has joined #ocaml
<Jeff_123>
grr nope
Linktim_ has quit ["Quitte"]
redocdam has quit []
Yoric[DT] has quit ["Ex-Chat"]
redocdam has joined #ocaml
asmanur has quit [Remote closed the connection]
det has quit [Read error: 110 (Connection timed out)]