znutar has quit [Read error: 60 (Operation timed out)]
Skal has quit [Read error: 60 (Operation timed out)]
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]
MisterC has quit ["Client exiting"]
mrsolo has quit [Read error: 104 (Connection reset by peer)]
Revision17 has quit [Connection timed out]
Revision17 has joined #ocaml
Revision17 has quit [Connection timed out]
Smerdyakov has joined #ocaml
ayrnieu_ has joined #ocaml
ayrnieu has quit ["Reconnecting"]
ayrnieu_ is now known as ayrnieu
UziMonkey has joined #ocaml
sebell has joined #ocaml
mlh_ has quit [Read error: 110 (Connection timed out)]
mlh_ has joined #ocaml
sebell has quit [brown.freenode.net irc.freenode.net]
Smerdyakov has quit [brown.freenode.net irc.freenode.net]
pango has quit [brown.freenode.net irc.freenode.net]
whee has quit [brown.freenode.net irc.freenode.net]
Amorphous has quit [brown.freenode.net irc.freenode.net]
mw has quit [brown.freenode.net irc.freenode.net]
sebell has joined #ocaml
Smerdyakov has joined #ocaml
pango has joined #ocaml
whee has joined #ocaml
Amorphous has joined #ocaml
mw has joined #ocaml
sebell has left #ocaml []
monochrom has quit ["good morning, sweet dream"]
Smerdyakov has quit []
sebell has joined #ocaml
sebell has left #ocaml []
kothog has joined #ocaml
zwnj has joined #ocaml
Snark has joined #ocaml
pango has quit [brown.freenode.net irc.freenode.net]
whee has quit [brown.freenode.net irc.freenode.net]
Amorphous has quit [brown.freenode.net irc.freenode.net]
mw has quit [brown.freenode.net irc.freenode.net]
pango has joined #ocaml
whee has joined #ocaml
Amorphous has joined #ocaml
mw has joined #ocaml
pango_ has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
Pita has joined #ocaml
<Pita>
I would like to do the following 1) create a byte buffer, 2) write an object into the buffer, 3) write the buffer into a binary file. How do I get started on this? Information on the ocaml site and the O'reilley book surprisingly does not cover this.
ramkrsna has joined #ocaml
<Pita>
ramkrsna: hi
<ramkrsna>
pita : Hi
<Pita>
I asked this question before you arrived
<Pita>
I would like to do the following 1) create a byte buffer, 2) write an object into the buffer, 3) write the buffer into a binary file. How do I get started on this? Information on the ocaml site and the O'reilley book surprisingly does not cover this
<Pita>
IE, I would like very fast object IO to disk
<Pita>
That module has not been updated for sometime now. Is it solid?
<Schmurtz>
no idea
<Schmurtz>
I never used it
mlh_ has quit [Client Quit]
ramkrsna has quit [Remote closed the connection]
<Pita>
Schmurtz: where to find documentation if I would like to do this part myself?
<Schmurtz>
I think you'll to write glue code in C
<Schmurtz>
your C code will be able to fill a structure
<Schmurtz>
try to ask on ocaml lists, you'll get a better chance to have a good answer
<Pita>
tanks
<Pita>
thanks
__DL__ has joined #ocaml
zwnj has left #ocaml []
Pita has quit []
_shawn has joined #ocaml
det has quit [Read error: 110 (Connection timed out)]
det has joined #ocaml
UziMonkey has quit [Remote closed the connection]
Revision17 has joined #ocaml
UziMonkey has joined #ocaml
<mattam>
pango_ has quit [Remote closed the connection]
threeve has joined #ocaml
vezenchio has joined #ocaml
zigong has joined #ocaml
beleg has joined #ocaml
Demitar has joined #ocaml
zigong has quit [Remote closed the connection]
BenoitXVI has joined #ocaml
Pita has joined #ocaml
kothog has quit [SendQ exceeded]
<Pita>
is there a limitation of int?
<Pita>
size limitation of int?
<Pita>
can I store e.g., 64 bits value inside an int?
<vezenchio>
int is limited to 31 bits on 32bit systems and to 63 bits on 64 bit systems
<vezenchio>
you want Int64
<vezenchio>
look it up in the documentation
Skal has joined #ocaml
Demitar has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
ayrnieu has quit [Remote closed the connection]
ayrnieu has joined #ocaml
<Pita>
How would I write 0xFFFFFFFF in INT64? the literal doesn't support beyond 32bits?
Demitar has joined #ocaml
aesope has joined #ocaml
aesope has quit [Client Quit]
<Schmurtz>
0xFFFFFFFFl for Int32
<Schmurtz>
0xFFFFFFFFFFFFFFFFL for Int64
<Schmurtz>
.......n for Nativeint
<Schmurtz>
Pita (just for highlight)
<Pita>
Thanks!
<Pita>
i am starting to really like ocaml
<Schmurtz>
it's really a good language
<Schmurtz>
and not so difficult to use, with a classical syntax (not like lisp)
<Pita>
it has lisp component
<Pita>
really cool
<Pita>
i am finding the type inference really cool
<Pita>
wonder why it's not more popular (e.g., like python or ruby)
<Pita>
syntax not as bad as people cliam
<Pita>
in fact syntax is very good
<Schmurtz>
because, it require a lot of time to implement
<zvrba>
Pita: python is dynamically-typed
<zvrba>
it does its type-inference at runtime
<Schmurtz>
ocaml is the fruit of a research program so, it includes complicated algorithms
<zvrba>
hm... doesn't history of type inference actually go to sml?
<Schmurtz>
perhaps, but sml was also made by researchers ?
<Pita>
what u mean lot of time to implement?
<Pita>
i thought i put things together very quickly
<Schmurtz>
Pita, it's easier to do dynamic type checking
<Schmurtz>
or pure static checking without inference
<zvrba>
Pita: doing type-inference at runtime is very complicated. you have to analyze expressions.. uf. complicated
<zvrba>
I once learned a prolog unification algorithm which I believe is simpler than type inference. and it wasn't trivial in words,let alone to implement
<Schmurtz>
zvrba, all type-checking is done at compile time
<Schmurtz>
at runtime absolutely no checks are required
<Schmurtz>
type inference is done at compile time in order to do the static type ckecking
<zvrba>
Schmurtz: yes, I'm aware of that. I'm just making a comparison to unification
BenoitXVI is now known as Gueben
<Schmurtz>
ok
Gueben is now known as Gueben\0
Gueben\0 is now known as Gueben
Pita has quit []
<haelix>
Schmurtz: to carry that discussion some further
<haelix>
I think that Perl is really really difficult to implement
<haelix>
( and beside this, there's nothing like a Perl standard)
<haelix>
it seems fully defined by it implementation
<Schmurtz>
perhaps
<haelix>
Still, it is very popular
<Schmurtz>
because it's a very old language
<haelix>
To me, the small popularity of Ocaml is explained by the fact that this is a functional language, and that's about all.
<haelix>
but it seems to me that it is a popular language
<haelix>
oopps
<haelix>
a popular _functional_ language
<Schmurtz>
ocaml is also a langage with strong type checks at compile time
<Schmurtz>
so program written with ocaml don't have very much bugs, in the contrary to C
<haelix>
well... isn't C more popular than Ocaml ?
znutar has joined #ocaml
<Schmurtz>
when your code compiles, remaining bugs are often algorithm bugs
<haelix>
I know, all typing problems have been eliminated
<Schmurtz>
haelix, because C is more popular, so people leran C, so C is more popular
<haelix>
and btw, I know all this. I only mean to say that ocaml unpopularity has nothing to do with its quality
<Schmurtz>
ocaml is not unpopular, it's just unknown
<haelix>
it depends on the geek-ecosystem you are living in :-)
<Schmurtz>
I'm a french student, and ocaml is teach in many french engineer schools ;)
<Schmurtz>
so it may be different in other ocuntries
<haelix>
and how many of these students will use it in their future work ?
<Schmurtz>
not very much, because compagnies want you to use C or Java
<haelix>
(i'm french too, btw)
<Schmurtz>
:)
<haelix>
I only had an introductory course (12 hours) on the Ocaml thing
<haelix>
And now am striving to get a better grasp of it
<haelix>
my feeling is that, for some thing, it is well-fitted
<haelix>
but sometimes, when your bug is an algorithmic bug...
<haelix>
brwoou... hard to debug
<haelix>
it is even hard to read in the code.
<haelix>
But, I'm still trying !!!
<Schmurtz>
the same algorithmic bug is hard to debug in C
* haelix
thinks of an answer
<Schmurtz>
;)
<zvrba>
I've noticed that with Ocaml I don't need debugger that much as with C/C++
<zvrba>
even if it's an algorithmic bug, I usually find it jus tby reading the code
<zvrba>
i guess it has to do with bottom-up and interactive development
<zvrba>
i first test each function before using it as component in others...
<Schmurtz>
the ocaml debugger also not very good
<haelix>
Schmurtz zvrba: would you say that you have reached the point where "reading" ocaml is easy ?
<Schmurtz>
it depends of who write the code
<zvrba>
haelix: well... I can easily read my own code :)
<Schmurtz>
and it's easy to write unreadable ocaml code
<zvrba>
yes, it depends who wrote the code. but that you can say of _any_ language
<haelix>
zvrba: but... I can hardly read mine :-))
<Schmurtz>
(fun x y -> x + 2*y) (1+3) (-1)
<zvrba>
haelix: then you have a BIG problem. not really Ocaml-related :)
<zvrba>
2
<Schmurtz>
good answer
<zvrba>
yeah.. it actually took me that long to do the math with negative integers than comprehending what is going to happen :)
<Schmurtz>
and with List.fold (fun c (a,b) -> a+c,b+a+2*c) [1;2;3;1;4;2] (2,-9) ?
<zvrba>
ok, I know what it's doing, I can't calculate it :)
<zvrba>
i don't need exercise in basic arithmetic, you know :)
<haelix>
haelix: List.fold ?
<Schmurtz>
I use fold function very much, and many people can't read me
<Schmurtz>
fold_left
<zvrba>
Schmurtz: yes, I've found it to be very useful too
<zvrba>
nad even .iter for side-effects
<Schmurtz>
but hard to read if you are not used to use it
<zvrba>
many "hand-written" recursions can be rewritten into fold
<haelix>
well people I know who ate OCaml at amssive dose in "prépa" are very fluent with fold
<zvrba>
if you can think of a proper "state" that is maintained through the 2nd argument of the "folding function"
<zvrba>
most of the time I can spot where fold is a good tool
<zvrba>
but.. I'm pretty mathematecally-minded ... I find functional programming rather natural
<zvrba>
I didn't have to get used to type inference because I'm used to function domains and codomains
<zvrba>
and function compositions
<Schmurtz>
for me, folding is just iterating with a global variable
<Schmurtz>
I even use folding non array-like structures (graph for example)
<haelix>
is this snippet of SML code obvious to you :
<haelix>
fun tok t =
<haelix>
let fun f (s,h::r) = if h=t then SOME (h::s,r) else NONE
<haelix>
| f _ = NONE
<haelix>
in List.mapPartial f
<haelix>
end
<haelix>
(sorry, I can't find the CAML equivalent I had made some time ago)
<zvrba>
Schmurtz: graph?
<Schmurtz>
yes ;)
<zvrba>
you mean like nodes and edges?
<Schmurtz>
yes
<zvrba>
haelix: I don't know what mapPartial does
<zvrba>
Schmurtz: how did you implement the graph? array of neighbours or lists?
<Schmurtz>
with deepfirst transerval
<haelix>
zvrba: given a list of elements that can be Something of 't | Nothing
<Schmurtz>
I use a array of neighboors on each node
<haelix>
it returns a list of 't
<haelix>
all the elements that are something
<zvrba>
haelix: it can't return a list of 't. it can return 't option list :)
<Schmurtz>
type vertex = {
<Schmurtz>
mutable neighboors: vertex list;
<Schmurtz>
};;
<haelix>
no, it filters the elements
<haelix>
zvrba: ^^
<zvrba>
Schmurtz: ok.
<Schmurtz>
it's better for graph traversal
<haelix>
zvrba: oh no... it applies f to all the elements of the list that are Something
<zvrba>
Schmurtz: in what way better? I'mean I would do Array.iter or List.iter to traverse a list of neighbours
<Schmurtz>
using List.partial, filter... is also a way to explain what you do
<haelix>
anyway, thanks for the feedback,
<haelix>
I have to go
<Schmurtz>
it's easier to read that the equivalent recursive function
<Schmurtz>
bye haelix
<zvrba>
haelix: ok, I don't know what mapPartial does. so I can't see
<zvrba>
why f takes a pair as an argument
<zvrba>
because in ordinary Ocaml I'd write it as
<zvrba>
let f = fun Some x -> ... | None -> ...
<zvrba>
s/fun/function/
<zvrba>
and I think there's filter
<Schmurtz>
you may use fun
<zvrba>
so combine List.Map (List.filter (function which selects only Some))
<zvrba>
and apply fun Some x -> (transform function) | _ -> assert false
<zvrba>
and you end up with a list of trasformed x's which are not None
<Schmurtz>
which is not very hard to read : map a function f on the result of the filter ff
<zvrba>
Schmurtz: exactly :)
<Schmurtz>
it's the reason why I use it much
<zvrba>
I have to say I like Ocaml much better than SML
<Schmurtz>
I've never used SML
<zvrba>
I've never actually tried to work with SML.. I was discouraged from it by the bunch of implementations
<zvrba>
ok, have to go...
<zvrba>
later..
<Schmurtz>
++
beleg has quit [Remote closed the connection]
Purice has joined #ocaml
builder has joined #ocaml
vezenchio has quit [Read error: 104 (Connection reset by peer)]
vezenchio has joined #ocaml
vezenchio has quit [Read error: 104 (Connection reset by peer)]
vezenchio has joined #ocaml
vezenchio has quit [Read error: 104 (Connection reset by peer)]
vezenchio has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]