vixey has quit [Read error: 110 (Connection timed out)]
buzz0r has quit [Read error: 113 (No route to host)]
seafood has quit []
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
Stefan_vK has joined #ocaml
|jedai| has joined #ocaml
Axioplase_ has quit ["brb"]
AxleLonghorn2 has joined #ocaml
Axioplase has joined #ocaml
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
AxleLonghorn1 has joined #ocaml
AxleLonghorn2 has quit [Read error: 104 (Connection reset by peer)]
AxleLonghorn1 has quit [Read error: 60 (Operation timed out)]
AxleLonghorn1 has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
seafood has joined #ocaml
AxleLonghorn1 has quit [Read error: 110 (Connection timed out)]
AxleLonghorn2 has joined #ocaml
Stefan_vK has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has joined #ocaml
jeddhaberstro has quit []
<xah_lee>
in this statement: functions referring to itself must be declared with “rec”
<xah_lee>
is the "declared" word used properly here?
<xah_lee>
i mean... is it consider a declaration or what's the technical meaning?
<AxleLonghorn2>
I'm not sure what you're asking?
<AxleLonghorn2>
it's supposed to be part of the `let declaration'
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
<xah_lee>
Axioplase: was wondering if "declaration" is the proper word to use in ocaml tech.
<xah_lee>
as opposed to... tag, or parameter of let or something
<xah_lee>
umm.. im trying let rec f n = match n with 0 -> 0 | 1 -> 1 | x -> f (n-1) + f (n-2);; f 55;; it seems to run for 20 sec and still running
<schme>
Maybe you got f -1
<xah_lee>
is that normal or my code is bad or something?
<schme>
Looks like it could loop for infinity to me.
<Axioplase>
trace it!
<xah_lee>
f 33;; returns 3524578 in few sec.
<schme>
Horray.
<Axioplase>
maybe fib 55 is too big…
<Axioplase>
you'd better use a tail recursive version…
<Axioplase>
(or a memoized one)
<xah_lee>
Axioplase: just started learning this week. how to do tail recur or memoize?
thelema has joined #ocaml
<Axioplase>
ha...
<Axioplase>
Tail recursion for fib is a bit tricky. Memoizing is easier: have an extra parameter (an array of length n)
<Axioplase>
Then, when you compute (f n), lookup in the table. If it's there, return that value. If not, do the real computation, store it in the table, and return it
<Axioplase>
this will avoid recomputing the same values a lot of time (because (f n) is computed many times, and the result is always the same)
* thelema
wonders how hard compiler support for option int as a flag value (minint?)
<Axioplase>
Also, when doing recursive functions, test them on small values first :)
<thelema>
the "right way" to do the fib lookup array is: [int option array], but all the boxing is just silly
<xah_lee>
kk. thanks. Will have to do more reading.
* xah_lee
off to shower
<thelema>
the efficient way is to use a flag value (-1) to store [None]
* thelema
wonders how reasonable it'd be to bridge that gap, in camlp4 if possible, in the compiler if necessary
<thelema>
as to tail recursion in fibonacci, write it as a loop and be done. Just iterate up to the target index. the traditional breakdown (fn=fn-1 + fn-2) doesn't compute efficiently.
AxleLonghorn1 has joined #ocaml
AxleLonghorn2 has quit [Read error: 104 (Connection reset by peer)]
tar_ has joined #ocaml
xevz has quit [Read error: 60 (Operation timed out)]
AxleLonghorn1 has quit [Read error: 110 (Connection timed out)]
AxleLonghorn1 has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
xevz has joined #ocaml
|jedai| has joined #ocaml
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
tar_ has quit []
sporkmonger has quit []
tar_ has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
<tar_>
let rec silly = Cons(0, silly);; I learned something new about rec today!
<thelema>
tar_: yup, recursive data structures are possible with let rec.
<AxleLonghorn1>
interesting
<flux>
I'm yet to find any use for that, though :-)
<thelema>
it's not silly - how else to do a circular list? You've got to start with a node that points to itself.
<tar_>
There was something I couldn't do earlier... I think it had to do with a list being involved.
<tar_>
But I've lost that code.
<thelema>
(of course you use mutability)
<tar_>
thelema: huh?
<thelema>
curculaly linked list -- each node has a pointer to the "next" node, and the last node points to the first.
<thelema>
*circularly
<tar_>
I mean the "use mutability" comment
<thelema>
well, you can't share any data between modified versions of such a list, so usually one uses a record with a mutable "next" field, so you can insert a node into the list.
<thelema>
sorry, the "you" wasn't directed at you, tar_
<tar_>
oh
<thelema>
type node = {mutable next : node; mutable prev : node; mutable data : 'a}
<thelema>
umm, not a real type, need ['a node]
<thelema>
let create x = let rec n = {next = n; prev=n; data=x} in n
Stefan_vK has joined #ocaml
<Axioplase>
tar_: you can also try let rec x = 1::x;;
seafood has quit [Read error: 110 (Connection timed out)]
<tar_>
Axioplase: hey hey!
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
<tar_>
Where can I find an interpreter for some language written in OCaml?
<tar_>
er, I guess OCaml, but is there anything smaller?
Camarade_Tux has joined #ocaml
<flux>
I haven't actually looked into these, but perhaps some of these are what you're looking for: http://andrej.com/plzoo/
<tar_>
awesome!
tar_ has quit []
AxleLonghorn1 has left #ocaml []
vovkaii has quit ["Leaving"]
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
ikaros has joined #ocaml
ikaros has quit [".quit"]
ikaros has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
Proteus has joined #ocaml
ikaros has quit [".quit"]
mishok13 has joined #ocaml
mishok13 has quit [Client Quit]
vpalle has joined #ocaml
xah_lee has quit ["banned in #emacs by johnsu01 (john sullivan)"]
pierre- has joined #ocaml
_zack has joined #ocaml
s4tan has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
jli has left #ocaml []
<rwmjones>
gildor, you know unless this snow abates tomorrow (as forecast), there won't be anyone flying from the UK to France ...
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
marmotine has joined #ocaml
gdmfsob is now known as mishok13
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
kelaouchi has joined #ocaml
vpalle has joined #ocaml
hkBst has joined #ocaml
_zack has quit [Remote closed the connection]
_zack has joined #ocaml
pierre- has quit [Read error: 113 (No route to host)]
pierre- has joined #ocaml
kelaouchi has quit [Client Quit]
kelaouchi has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]>
hi
<gildor>
rwmjones: It has started to melt for now, here
<gildor>
rwmjones: I hope this will be ok by tomorrow
* rwmjones
hopes so too!
<gildor>
Yoric[DT]: are you ok with your talks ?
<Yoric[DT]>
You mean with the schedule?
<Yoric[DT]>
(because I'm not ready with my slides yet:))
<rwmjones>
I don't think Markus keeps the janestreet site up to date .. his ocaml.info site has the latest versions
s4tan has quit []
|Jedai| has quit [Read error: 104 (Connection reset by peer)]
|Jedai| has joined #ocaml
<_zack>
.. and indeed they work perfectly, thanks
Yoric[DT] has joined #ocaml
<rwmjones>
gildor, I'm going to get up early tomorrow and check if there are any flights. There were none from Stansted today. 2 inches of snow is way beyond the capacity of this country.
<Yoric[DT]>
hi again
mrvn has quit [Read error: 110 (Connection timed out)]
jonasb_ has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
jonasb has quit [Read error: 110 (Connection timed out)]
|Jedai| has quit [Read error: 104 (Connection reset by peer)]
|Jedai| has joined #ocaml
_Jedai_ has joined #ocaml
schme has quit ["leaving"]
schme has joined #ocaml
^authentic has joined #ocaml
vpalle_ has joined #ocaml
Delemas has joined #ocaml
<Delemas>
I make heavy use of unison, which uses ocaml. There currently is a bug in unison in that it doesn't preserve directory times even if the option is selected. The unison authors claim they need a patch to ocaml before they can fix this. Is anyone here familar with this?
<flux>
sounds like there is a bug or missing functionality in the Unix module, if that is the case
<flux>
I don't see how they couldn't provide their own functionality to replace it, although it would mean adding C code to it
<flux>
but they use librsync already, so perhaps they already have some C code..
<flux>
there could be license incompatibilities in extending the std library that way
<flux>
actually I too have a few issues with unison.. perhaps I should've taken the trip too ;-)
willb has quit [Read error: 110 (Connection timed out)]
<flux>
atleast its error reporting could use a bit beefing up..
willb has joined #ocaml
<Delemas>
It's so close to being ideal here... I'm hoping I can figure something out...
<flux>
is there anything more information available on the problem?
<Delemas>
I found a very old email which I don't have handy and this entry in latest's development BUGS.txt: http://pastebin.ca/1325528
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
<flux>
hmm
<Delemas>
Basically between two Linux boxes where one repository is empty, when synchronization with times preservation is enabled, all the files will have the right times but all the directories will have a date stamp of today/right now.
<flux>
I wonder how the times of a read-only file are updated
hsuh has joined #ocaml
<Delemas>
I really don't care about read only file... As long as you are running as root I think it should work...
<flux>
so is there a special function that does that, because the messages leads one to believe utime/utimes(2) won't work
<flux>
so it doesn't work as root either?
<Delemas>
I ran the syncs as root but it didn't preserve the directory times. It made a huge mess because I was running it on 2TB of data...
<Delemas>
Someone had to write scripts to fix the dir times manually...
<flux>
indeed my directory times aren't synchronized
<Delemas>
I'll see if I can find the details.
<flux>
atleast for one directory
_Jedai_ has quit [Read error: 104 (Connection reset by peer)]
<Delemas>
I haven't even looked at the unison code.
_Jedai_ has joined #ocaml
<flux>
actually I haven't synced with -times, so obviously the times won't get synched :)
Amorphous has quit [Read error: 110 (Connection timed out)]
<Delemas>
If you turn that on you'll at least get the file times synced...
<flux>
but yes, indeed the times don't get synchronized for directories
<Delemas>
hmm you know I'm pretty sure than rsync does it right. Might be able to find the right call in that source code...
<flux>
I guess it doesn't use rsync for other than minimizing operations in copying a single file?
<flux>
when syncing a file it issues utime(2), but when syncing a directory, it doesn't
<flux>
one feature I'd love to have in unison would be support for hard links..
Amorphous has joined #ocaml
jonasb_ is now known as jonasb
Yoric[DT] has quit [brown.freenode.net irc.freenode.net]
_zack has quit [brown.freenode.net irc.freenode.net]
jlouis has quit [brown.freenode.net irc.freenode.net]
willb has quit [Connection timed out]
<flux>
well, atleast ocaml's utimes is just a simple wrapper for an OS function
willb has joined #ocaml
<flux>
and props.ml leads one to believe that files and directories are handled the same..
<flux>
(the only deviation is when operating on read-only files under windows)
jlouis has joined #ocaml
<Delemas>
well fortunately a special case isn't needed. I'm going to see if I can figure out how rsync is setting a directory mtime, which seems to be what I need.
<Delemas>
doing a rsync -t olddir newdir works.
<Delemas>
well rsync -ta really...
<flux>
ah, it was the reading part, not the setting part, that had the special case:
<flux>
let get stats _ = let v = stats.Unix.LargeFile.st_mtime in if stats.Unix.LargeFile.st_kind = Unix.S_REG && Prefs.read sync then Synced v else NotSynced v
<flux>
so I wonder what happened if the first condition was simply commented away.. apparently we'd see the bug then :)
<flux>
(or possibly amended to List.mem stats.Unix.LargeFile.st_kind [Unix.S_REG; Unix.S_DIR]))
_Jedai_ has quit [Read error: 104 (Connection reset by peer)]
_Jedai_ has joined #ocaml
Yoric[DT] has joined #ocaml
_zack has joined #ocaml
<Delemas>
hmm it seems rsync can use one of three ways to set directory times. utimes, lutimes, and using a struct utimbuf. It doesn't seem to treat directories differently...
* Delemas
is confused why an ocaml patch is needed then....
Yoric_ has joined #ocaml
<Delemas>
flux, are you reading ocaml code or unison code there?
<flux>
unison code
<flux>
the relevant (deemed by me) ocaml code was not interesting, it was quite simple
<Delemas>
I'll try to find that in the unison code then....
<flux>
it's in props.ml around line 498
<flux>
(ver 2.13.16)
<flux>
after I changed it it says: if List.mem stats.Unix.LargeFile.st_kind [Unix.S_REG; Unix.S_DIR] && Prefs.read sync then
<flux>
so far so good, but don't come blaming me if you lose your data :-)
_zack has quit [brown.freenode.net irc.freenode.net]
Yoric[DT] has quit [brown.freenode.net irc.freenode.net]
hsuh has quit [Remote closed the connection]
Yoric_ has quit ["Ex-Chat"]
hsuh has joined #ocaml
Snark has joined #ocaml
_zack has joined #ocaml
<Delemas>
I'm going to try applying that patch and see what happens...
_zack has quit [brown.freenode.net irc.freenode.net]
_zack has joined #ocaml
OChameau has quit [Read error: 113 (No route to host)]
Stefan_vK has quit [Read error: 110 (Connection timed out)]
Stefan_vK has joined #ocaml
_Jedai_ has quit [Read error: 104 (Connection reset by peer)]
_zack has quit [brown.freenode.net irc.freenode.net]
_Jedai_ has joined #ocaml
Stefan_vK has quit [Read error: 110 (Connection timed out)]
Stefan_vK has joined #ocaml
seafood has joined #ocaml
authentic has quit [Operation timed out]
AxleLonghorn has joined #ocaml
Cheshire has quit ["This computer has gone to sleep"]
Cheshire has joined #ocaml
mbishop has quit [Read error: 113 (No route to host)]
<Delemas>
woot! I think I fixed it
<Delemas>
flux, you're patch didn't work, but something similar did.