malc_ has quit [Read error: 145 (Connection timed out)]
MisterC has quit [Read error: 104 (Connection reset by peer)]
pango has quit [Remote closed the connection]
Demitar__ has joined #ocaml
Demitar_ has quit [Read error: 110 (Connection timed out)]
danly has quit ["Leaving"]
bmiller has quit [" "]
yondalf has quit [Read error: 104 (Connection reset by peer)]
pango_ is now known as pangon8
love-pingoo has quit ["Connection reset by pear"]
llama32 has joined #ocaml
mbishop has joined #ocaml
<mbishop>
Is there a collection of blog feeds about ocaml anywhere?
<llama32>
mmmm, feed
yondalf has joined #ocaml
batdog|gone is now known as batdog
yondalf has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has joined #ocaml
falconair has joined #ocaml
falconair has quit [Client Quit]
yondalf has joined #ocaml
ramkrsna has joined #ocaml
<mbishop>
er, what the hell
<mbishop>
ocaml keeps giving me 1346269 for fib 30, but the code seems corrent
<mbishop>
correct*
<mbishop>
let rec fib n =
<mbishop>
if n < 2 then 1
<mbishop>
else fib (n - 1) + fib (n - 2)
<mbishop>
<mbishop>
let _ =
<mbishop>
Printf.printf "%d\n" (fib 30)
dark_light has joined #ocaml
<yondalf>
mbishop: what should be the correct answer?
<mbishop>
832040
<mbishop>
I thin I figured it out though
<yondalf>
ok
yondalf has quit ["leaving"]
danly has joined #ocaml
Mr_Awesome has quit ["and the Awesome Level drops"]
llama32 is now known as llama33
danly has quit ["Leaving"]
llama33 has quit [Read error: 104 (Connection reset by peer)]
llama33 has joined #ocaml
llama33 has quit ["Leaving"]
yondalf has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit ["Leaving"]
yondalf has quit ["leaving"]
Demitar__ is now known as Demitar
jajs has joined #ocaml
_JusSx_ has joined #ocaml
david_koontz has joined #ocaml
piggybox has quit []
velco has joined #ocaml
pangon8 has quit [Remote closed the connection]
love-pingoo has joined #ocaml
pango has joined #ocaml
ikaros_ has quit ["Leaving"]
ikaros has joined #ocaml
ikaros has quit ["Leaving"]
ikaros has joined #ocaml
ikaros has quit [Client Quit]
ikaros has joined #ocaml
slipstream-- has joined #ocaml
llama33 has joined #ocaml
<llama33>
grrrr
<llama33>
the page on xwiki.com used to actually create a wiki has a typo in it's source that turns half the page into a comment, rendering the site useledd
<llama33>
*useless
<llama33>
sorry, a tad off topic :)
jajs has quit [Remote closed the connection]
slipstream has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
Skal has joined #ocaml
llama33 has quit [Read error: 145 (Connection timed out)]
marian-o has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
lde has quit [Read error: 110 (Connection timed out)]
pcc has joined #ocaml
_fab has quit [Remote closed the connection]
llama33 has joined #ocaml
<llama33>
how do i create a closure/function without using let? like if i'm just passing it to another function...
<llama33>
or is something like "let f x y = ... in f" the only option?
<pango>
fun x y -> body
<llama33>
ah, thanks
<pango>
# fun x y -> x + y ;;
<pango>
- : int -> int -> int = <fun>
<llama33>
type foo = Bar of int | Taco;; <-- here, it seems 'Bar' and 'Taco' aren't functions, but something special... is there a way to pass them around like functions?
<flux__>
hm, can ocaml threads run when the process is in C-code?
<pango>
they're constructors, and no, they can't be partially applied in OCaml (they could in caml light, however)
<llama33>
damn... is there any particular reason they aren't just done as functions?
<flux__>
I need to change all my database activity to be asynchronous :-o
<flux__>
(if that is the case)
<pango>
flux__: from what I understand, yes (but maybe C code must explicitly release the master lock ?)
<flux__>
is that easy to do?
<pango>
llama33: because they have different properties
mikeX has joined #ocaml
<llama33>
pango: explain?
<pango>
flux__: All I know is that mldonkey uses a C thread for hashing files in background, so it must be doable
ramkrsna has quit [Read error: 131 (Connection reset by peer)]
<pango>
llama33: a workaround is to pass (fun x -> Constructor x) function around
<pango>
s/function/functions/
<llama33>
unfortunately that just makes more complicated what i'm trying to simplify
<pango>
I wouldn't know how to explain the theorical difference between constructors and functions... I'd like to say they don't return values, but are part of the returned values
llama32 has joined #ocaml
<llama32>
damnit
<llama32>
stupid dialup
<haelix>
:)
mikeX has quit ["leaving"]
<pango>
I wouldn't know how to explain the theorical difference between constructors and functions... I'd like to say they don't return values, but are part of the returned values
llama33 has quit [Read error: 145 (Connection timed out)]
jacobian has joined #ocaml
<jacobian>
Supposing I have a Map.Make (String)
<jacobian>
And I have keys of type (Map.Make (String)).key
<jacobian>
How do I make that back into a string?
<jacobian>
Or is it already?
<flux__>
it is
_fab has joined #ocaml
tomppa has joined #ocaml
<jacobian>
ok, I'm silly :)
<jacobian>
woohoo it works!
<jacobian>
First not totally trivial ocaml program
dark_light has quit [Read error: 110 (Connection timed out)]
* llama32
tends to jump in at the [too] deep end :)
postalchris has joined #ocaml
<llama32>
3am
* llama32
instantly snaps to sleep
velco has quit [Read error: 110 (Connection timed out)]
velco has joined #ocaml
<llama32>
hmm, how do i make say the List module part of the current namespace?
velco has quit [Client Quit]
<llama32>
i thought it was "with List" but this gives me syntax error
<llama32>
and import & using don't exist :)
<zmdkrbou>
open List
<llama32>
ahhhhh, thanks
<zmdkrbou>
(but using List.foo etc. is cleaner :p)
kral has joined #ocaml
<llama32>
yes but when im using ((hd (tl (tl (tl raw)))) ..., it gets a bit easier on the eyes
<llama32>
btw is there a quicker way of doing that
<llama32>
the likes of lisp's cadddr and such?
<zmdkrbou>
hd (tl (tl (tl <your list>))) is exactly List.nth <your list> 4
<zmdkrbou>
which is better for your eyes :)
<llama32>
ahhhhhhh
* llama32
didn't even think of trying nth :)
<pango>
I don't remember using hd and tl more than once or twice in my programs...
<pango>
use pattern matching!
<jacobian>
I didn't even know they existed! :)
<zmdkrbou>
pango: if the goal is the get the 4th element of a list ... (the problem would be : why does he want to do such a strange thing ? :p)
<pango>
zmdkrbou: because he's using OCaml like Lisp
<pango>
zmdkrbou: that style is fine in Lisp
<zmdkrbou>
:s
<llama32>
and what is the list delimiter? ie, to make a list of one element, i do element :: what?
<zmdkrbou>
[]
<mattam>
[x] doesn't work ?
<zmdkrbou>
[1] is 1 :: []
<llama32>
ah
<llama32>
note to self: lists work exactly the same as in lisp. stop asking stupid questions.
<llama32>
pango: the lisp way works and i'm familiar with it... it'll do :)
<pango>
llama32: it's both less readable, and often less efficient
<pango>
because match takes care of optimizing away redundant deconstructions
<llama32>
hmm, well i'll take a look at it [later :)] in the morning when i'm more awake, but for now, this works :)
Smerdyakov has joined #ocaml
<pango>
llama32: I suggest you have a look at list.ml, how "standard" list iterators are implemented... To give you some taste of pattern matching (on lists, in that case)
<llama32>
hmm, will do - thanks
<llama32>
but for now, i'm off to dream of hideous things like a parrot trying to eat java bytecode
bmiller has joined #ocaml
danly has joined #ocaml
smimou has joined #ocaml
love-pingoo has quit ["Leaving"]
kral has quit [Remote closed the connection]
mikeX has joined #ocaml
<jacobian>
How do I compile with str.cma using ocamlopt on debian?
<jacobian>
using ocamlc I was just doing: ocamlc str.cma prog.ml
tomppa has left #ocaml []
<mikeX>
str.cmxa
<jacobian>
Ha!
<jacobian>
That brings it down to 2 seconds!
<jacobian>
thank you mikeX
<jacobian>
7.0 minutes in Python -> 2 seconds in ocaml
<mikeX>
: )
<jacobian>
and the ocaml code is shorter
<jacobian>
(but only by 10 lines)
<mikeX>
what is it about?
<jacobian>
Its a suffixtree
<jacobian>
Modified a bit for finding the longest common substring of N documents
<jacobian>
The current one was too slow to run, it was dragging our server down
<jacobian>
I heard ocaml was fast, so I thought I'd give it a wirl
<jacobian>
And just to be obtuse I wrote it in a purely functional style, (modulo I/O)
<jacobian>
It only does I/O at the begging and end anyhow
<mikeX>
nice : )
bluestorm has joined #ocaml
<mikeX>
well if you write it in imperative style it might be even faster
<dan2>
ocaml is very fast
<pango>
mikeX: depends
<mikeX>
well that's why I said 'might' : )
revision17_ has joined #ocaml
<dan2>
ocaml is a pretty fantastic language
<dan2>
the problem is that its C interface blows
<jacobian>
Maybe the problem is that C's ocaml interface blows :)
<jacobian>
well the algorithm is purely "additive" in that I'm always just adding new info, and not deleting it
<jacobian>
So I wouldn't be suprisde if I didn't get a big win from writing it imperatively
<jacobian>
of course I might, who knows, but at 2 seconds I don't care! :)
<cypher23>
jacobian, is it tail-recursive?
<jacobian>
nope
<jacobian>
now that you mention it
<jacobian>
the main time waster isn't
<cypher23>
well, then it probably can be improved, the question is wether it's worth it. as you said, it's already fast enough for you
<pango>
how deep does it recurse ?
<jacobian>
it shouldn't be very deep
<cypher23>
jacobian, and btw., you have never used the erlang C interface. THAT blows :)
<pango>
then unless it might, don't waste time on making in tailrec
<pango>
s/in/it/
<jacobian>
It should be as long as the number of shared words-strings
<jacobian>
between 2 english documents
<jacobian>
...from blogs, I can't imagine that would exceed 100 (a quote from a newspaper or something)
<jacobian>
The overlap should be fairly rare
<jacobian>
It would probably significantly reduce the worst case scenario though
<jacobian>
2 identical documents
<mikeX>
: ********
<mikeX>
oops
<mikeX>
ahahahahah
* mikeX
swears never to split windows in irssi again
revision17 has quit [Read error: 110 (Connection timed out)]
<jacobian>
cypher23: I was just trying to make a joke out of what dan2 said, by pointing out that it's C's fault that inter-language communication is such a terrible pain.
<cypher23>
ah.
<cypher23>
never mind then :)
jacobian has quit ["leaving"]
jajs has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
dan2 has quit [Remote closed the connection]
mikeX has quit ["leaving"]
smimou has quit ["bli"]
llama32 has quit [Read error: 104 (Connection reset by peer)]
jajs has quit [Remote closed the connection]
bmiller has quit [Read error: 110 (Connection timed out)]
bebui has quit ["Changing server"]
bebui has joined #ocaml
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
Oxyd has joined #ocaml
pcc has left #ocaml []
jacobian_ has joined #ocaml
mnemonic has joined #ocaml
<mnemonic>
hi
malc__ has joined #ocaml
joshcryer has joined #ocaml
marian-o has quit [Read error: 145 (Connection timed out)]
<jacobian_>
hi
Oxyd has quit ["Vanitas vanitatum et omnia vanitas."]
david_koontz has quit ["Leaving"]
Skal has quit [Read error: 104 (Connection reset by peer)]
bmiller has joined #ocaml
mnemonic has quit ["leaving"]
<_JusSx_>
yo
_JusSx_ has quit [Client Quit]
bluestorm has quit ["Konversation terminated!"]
dark_light has joined #ocaml
malc___ has joined #ocaml
malc___ is now known as clam
clam has quit [Client Quit]
malc__ has quit [Read error: 110 (Connection timed out)]