chickenzilla has quit ["J'y trouve un goût d'pomme."]
oriba has joined #ocaml
dira has joined #ocaml
<dira>
I`m new to F.
<dira>
*I`m new to F.P. , and I`v always wondered how is it possible to model state in functional way , like how do you program push down automata to check number of parentheses ? or how do you model logic circuit in functional way where it pertains Flip-Flops as object with state?
<mrvn>
you push the state as argument to the functions
<mrvn>
and return the new state
hkBst has quit [Read error: 104 (Connection reset by peer)]
<mrvn>
let check str = let rec check num_open = function [] -> num_open | '('::xs -> check (num_open + 1) xs | ')'::xs when num_open = 0 -> raise (Invalid_argument("too many closing )")) | ')'::xs -> check (num_open - 1) xs in let left_open = check 0 (string_to_char_list str) in if left_open > 0 then raise (Invalid_argument("Too many ("))
<dira>
mrvn: That`s nice , thanks
<mrvn>
totaly from the top of my head. You have to fix errors yourself.
<dira>
sure , just wanted the general image , thanks
<dira>
which IDE do you suggest for ocaml ? I`v seen plugins for eclipse , which one do you suggest?
<mrvn>
I'm using xemacs with tuareg mode
slash_ has quit ["leaving"]
angerman has joined #ocaml
ofaurax has quit ["Leaving"]
oriba has quit ["Verlassend"]
<Yoric[DT]>
'night
Yoric[DT] has quit ["Ex-Chat"]
kaustuv has quit [Read error: 113 (No route to host)]
angerman has quit []
bhampkl has quit [Remote closed the connection]
ched_ has quit [Read error: 110 (Connection timed out)]
ched_ has joined #ocaml
angerman has joined #ocaml
ched__ has joined #ocaml
ched_ has quit [Read error: 101 (Network is unreachable)]
caligula__ has quit ["Konversation terminated!"]
bzzbzz has quit ["leaving"]
angerman has quit []
angerman has joined #ocaml
angerman has quit [Client Quit]
seafood has quit []
jeddhaberstro has quit []
Demitar has joined #ocaml
AxleLonghorn has joined #ocaml
wsmith85 has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has joined #ocaml
angerman has joined #ocaml
sysop_fb has joined #ocaml
Moca has joined #ocaml
schme has quit ["leaving"]
schme has joined #ocaml
_zack has joined #ocaml
kaustuv has joined #ocaml
ttamttam has joined #ocaml
kaustuv has left #ocaml []
angerman has left #ocaml []
hkBst has joined #ocaml
ttamttam has left #ocaml []
sysop_fb has quit []
chickenzilla has joined #ocaml
Snark has joined #ocaml
dira has quit ["ChatZilla 0.9.84 [Firefox 3.0.7/2009021910]"]
dartelin has joined #ocaml
<dartelin>
hello
<dartelin>
i have a problem
<dartelin>
how can i check if 2 lists are of the same length without using List.length ? i have to use pattern matching
<Camarade_Tux>
dartelin, pattern match the two lists at the same time as in 'match l1, l2 with', I'll let you find the match clauses though
<dartelin>
yes, but what should the pattern look like ?
<mrvn>
I prefer (l1, l2) to make the tuple more visible.
slash_ has joined #ocaml
<mrvn>
dartelin: I give you the thrid pattern : _ -> false
chickenzilla has quit ["J'y trouve un goût d'pomme."]
zerny has joined #ocaml
schmx has joined #ocaml
schme has quit [Read error: 110 (Connection timed out)]
oriba has quit [Read error: 104 (Connection reset by peer)]
|jedai| has joined #ocaml
|jedai| is now known as jedai
dartelin has quit [Read error: 148 (No route to host)]
Yoric[DT] has joined #ocaml
<Yoric[DT]>
hi
tclineks has left #ocaml []
<flux>
hey, I figured a succinct way other than using List.length: List.map ignore a = List.map ignore b :)
<tsuyoshi>
why would you want to avoid List.length anyway
<flux>
looked like homw work to me
<flux>
mrvn, so your fuse bindings work now, it's the filesystem you're working on now?
<mrvn>
flux: They work more and more. I'm adding bindngs as I implement the code in my FS.
<flux>
mrvn, what kind of fs are you writing?
<mrvn>
Similar to btrfs. Spanning multiple disks with configurable redundancy and checksumming and COW operations.
<mrvn>
Everything is stored in one big B-Tree and every change creates a new root. Verry functional.
<flux>
I've been thinking something similar, except it would be backed by regular filesystem
<flux>
(possibly on multiple nodes and multiple networks)
<flux>
perhaps not that similar after all :)
<mrvn>
Why on filesystems?
<flux>
because it is easier?-)
<flux>
and you can put it on a regular fs without explicit partitioning/voluming
<mrvn>
flux: look at glusterfs.
<mrvn>
Only thing glusterfs doesn't have is a raid5/6 plugin.
schmx has quit ["Lost terminal"]
schme has joined #ocaml
_zack has left #ocaml []
Associat0r has joined #ocaml
<tsuyoshi>
every change creates a new root? isn't that kind of slow?
<mrvn>
tsuyoshi: not every change is synced to disk.
<mrvn>
So on disk a change can contain quite a few write requests or mkdir or rm.
<mrvn>
If something writes 1G of data and then the system crahses I don't mind loosing that 1G. Only if the file is fsync()ed or close()ed and the filesystem has reported the data as correctly written must the file be crash resistant.
<mrvn>
And if there wasn't a fsync() or close() in a while the FS will sync the root as well so not too much data is kept on the fly.
<mrvn>
(or for too long)
<mrvn>
The nicest thing about having a new root all the time is that creating a snapshot just means keeping the root around.
Associat0r has quit []
<tsuyoshi>
so you can have multiple changes but only save one root, on the last change?
<tsuyoshi>
I imagine that would be a little tricky to do right
<mrvn>
tsuyoshi: why? Every in-memory root represents a consistent snapshot of the filesystem at that time. Any one of them can be saved to disk to give a valid filesystem on disk.
<mrvn>
The thing that makes this easy is the copy-on-write semantic. Anything that changes something reads the relevant block into memory, allocates an empty block on the disk, changes the in memory data, flags the block as dirty and tells the parent about the new location (which makes the parent dirty too as something there changes).
<tsuyoshi>
yeah.. that sounds slow to me
<mrvn>
Two things are tricky: 1) finding blocks that are no longer referenced and 2) make this fast.
<tsuyoshi>
don't you basically need to garbage collect that
<mrvn>
yep
<mrvn>
or ref-count.
<tsuyoshi>
oh, this is a nice quote
<tsuyoshi>
"Haskell is the Ron Paul of programming languages."
<mrvn>
If I don't allow hardlinks between directories than I have a non-cylic directed graph. Afaik ref-counting is enough for that.
<bjorkintosh>
it's a stupid one.
<mrvn>
tsuyoshi: I have a sample implementation in C for the FS without any preallocation and delayed write tricks and it manages ~5MB/s. I need at least twice that to saturate my 100MBit network when fetching files.
<tsuyoshi>
you did it in c first?
<mrvn>
yes. I had no fuse bindings for ocaml.
<tsuyoshi>
so what turned out to be harder, doing the fs in c, or doing the bindings?
<mrvn>
tsuyoshi: getting C not to leak memory or use uninitialized/obsolete pointers.
<tsuyoshi>
yeah.. that's what c is like
<mrvn>
tsuyoshi: One thing I already know. I will never get this to run with more than 27MB/s. Less counting the redundany. The checksumming alone clocks at 27MB/s on the slow cpu my fileserver has.
<mrvn>
1.2GHz VIA Eden isn't that powerfull.
<flux>
iirc I got only 2 MB/s with ocaml-based reed salomon -algorithms :)
<mrvn>
flux: hehe. I'm not going to do sha1 checksumming in ocaml.
<flux>
(which give you m data devices and n redundancy devices, any n devices can fail to recover the data of m devices)
<mrvn>
flux: for that I have to convert ras into libras and add ocaml bindings.
<flux>
there's a redundancy library around? nice
<mrvn>
Package: ras
<mrvn>
Description: Adds redundancy files to archives for data recovery.
<mrvn>
Ras is a program that adds m extra files to a set of n files, such that the contents of the n original files can be regenerated from any n of the n+m original files and extra files.
<flux>
is it internally in library form?
<flux>
or do you need to librariefy it first
<mrvn>
Nope. But that shouldn't be too hard.
<flux>
indeed
<mrvn>
And maybe find someone to write an SSE2 version of it or something for speedup.
<mrvn>
So say I do get 10MB/s then I have ~40% cpu for sha1 checksumming and ~40% for reed salomon which leaves ~20% for updating the B-tree and read/write.
<mrvn>
That will be really hard to get.
<flux>
it is times like these you'd like ocaml to have support for multiple cores?
<flux>
;)
<mrvn>
flux: well, sah and reed salomon will be done in C and can run in their own thread. If only I had cores.
<flux>
ah, right, it should be relatively easy to make it use more cores then
<mrvn>
A simple matter of calling leave_blocking_section(); before the library and enter_blocking_section(); after.
<flux>
well, keep it in mind, but worry about the optimizations later
<mrvn>
Which I do in all my bindings for anything that takes time.
<mrvn>
flux: It would be nice if I could get access to the kernels raid5/raid6 algorithm somehow. That would automatically pick the best for the cpu and maybe even utilize an hardware engine.
<flux>
I don't think they expose them at that level
<flux>
you could just copy the implementations, though
<mrvn>
No. that would need a new kernel interface similar to fuse. Would be generally usefull though. For the aes and other crypto algorithms too.
<flux>
also the raid6 of kernel doesn't support (or atleast didn't support the time I last looked) a custom number of redundancy devices, but that might not bother you
<mrvn>
flux: raid6 is for exactly 2.
<flux>
it does use the same algorithms that would work for any number of devices, though
<flux>
but it just isn't written to support them
<mrvn>
Most people don't have that many disks.
Alpounet has joined #ocaml
Associat0r has joined #ocaml
ofaurax has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
jeddhaberstro has joined #ocaml
Associ8or has joined #ocaml
Associat0r has quit [Connection timed out]
wsmith85 has joined #ocaml
AxleLonghorn has quit [Read error: 110 (Connection timed out)]
Alpounet has quit [Read error: 104 (Connection reset by peer)]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
Alpounet has joined #ocaml
ertai_ has quit ["leaving"]
ertai has joined #ocaml
wsmith85 has quit [Read error: 110 (Connection timed out)]
peper has joined #ocaml
<peper>
hello
<peper>
foo#blah ~a ~b
<peper>
what does ~ mean here?
<hcarty>
peper: Labeled arguments. ~a is an argument with the label "a"
wsmith85 has joined #ocaml
<Alpounet>
foo is an object, blah a method
<peper>
hcarty: so ~a, is short for ~a:a ?
<hcarty>
peper: Yes
<hcarty>
peper: ~a:foo would pass foo as the ~a argument instead
<hcarty>
But if you have a value with the same name as a label, then you can use that shorthand
wsmith85 has quit [Read error: 60 (Operation timed out)]
<peper>
yeah, i get it now. wasn't aware of the shortcut form
<peper>
anyway
<peper>
let triangle = [(x - 10, y - 10); (x + 10, y - 10); (x, y+20)] in
<hcarty>
In the tests (or maybe test) directory in the source tree
<peper>
ah i see
<peper>
hcarty: is there an example for using it with lablgtk?
<hcarty>
Yes
<peper>
ah the tests seem to be using lablgtk
<peper>
hmm Unbound value Cairo.move_to
<peper>
i have added -I +cairo cairo.cmxa
ttamttam has joined #ocaml
<hcarty>
peper: You may have to play around with it a bit on your system. An official release of the bindings has never been made. The build system may have a few bugs lurking around.
r0bby has quit [Read error: 104 (Connection reset by peer)]
r0bby has joined #ocaml
<peper>
hcarty: hmm, it installs the files as i showed you. not sure what;s wrong
<peper>
can i somehow see what are the installed files defning?
<peper>
i.e. checkt whether Cairo.move_to is there
ttamttam has left #ocaml []
<peper>
can i make ocamplopt error if it doesn't find a library?
<peper>
i'm not sure whether it doesn't load cairo or the lib itself is broken
<peper>
hcarty: hmm i can't get it working ;/ any hints on how to use opengl with lablgtk?
<hcarty>
peper: If the compiler doesn't find the library then it should give you an error
<hcarty>
The problems I have had with the Cairo bindings have all been compile time problems, and mostly with the native code compiler
<peper>
hcarty: i tried names like foo and it still didn';t
<hcarty>
You could try ocamlc rather than ocamlopt
<hcarty>
I haven't used any of the OpenGL bindings with lablgtk
<hcarty>
Cairo.move_to should be there ... you can check the sources to be sure, but unless something very strange happened it should be there
<peper>
and how do i tell ocamlc to use cairo?
<peper>
it's in the sources, but i still can't get it working
<hcarty>
peper: I'm not sure what to suggest then. It works here, and the Debian and Fedora packages work
Snark has quit ["Ex-Chat"]
<hcarty>
Perhaps taking a peak at their source packages may offer some ideas
<flux>
peper, do you have ocamlfind installed?
<flux>
although I cannot compile at the moment because my cairo installation is broken ;-) I believe this should work: echo let _ = Cairo.move_to > foo.ml; ocamlfind ocamlc -package -cairo -linkpkg foo.ml
<hcarty>
That may not be any better, but I think the Cairo bindings depend on the Bigarray library
<flux>
my META-file for Cairo lists bigarray, but it could well be hand-built or otherwise non-standard
ttamttam has joined #ocaml
<peper>
bigarray,cairo worked!
<peper>
ta
<bjorkintosh>
is ocamlfind not a debian package?
<hcarty>
flux: I don't think the OCaml Cairo bindings come with a META file. The Debian folks wrote one, and I think Fedora based theirs off of the Debian one
<animist>
bjorkintosh: ocamlfind could be found in ocaml-findlib package