<darinm>
Is there a mirror for GODI somewhere? http://godi.camlcity.org/ has been down for me for several hours
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
_jeremiah has joined #ocaml
_jeremiah has quit [Remote closed the connection]
ulfdoz has quit ["deprecated"]
darinm_ has joined #ocaml
darinm_ has quit [Remote closed the connection]
darinm has quit [Read error: 104 (Connection reset by peer)]
ulfdoz has joined #ocaml
jeddhaberstro has quit []
<flux>
yziquel, you need to compile protection first
<flux>
apparently vixey wasn't kidding when he said it's nocaml day today..
<flux>
yziquel, for that stage it's sufficient to have protection.cmi, but during the linking stage you will need to put protection.cmo before chain.cmo anyway
ulfdoz has quit ["deprecated"]
ulfdoz has joined #ocaml
ygrek has joined #ocaml
okagawa has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
okagawa has left #ocaml []
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
GustNG has joined #ocaml
det has joined #ocaml
Morphous is now known as Amorphous
itewsh has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
Camarade_Tux has joined #ocaml
* Camarade_Tux
wonders if camlcity.org and caml.inria.fr are dead for everyone...
marmotine has joined #ocaml
<Camarade_Tux>
this is the first time I see somebody with an ipv6 address !
<flux>
and why would you see anway, unless the reverse mapping is broken..
<Camarade_Tux>
I meant on irc ;)
<flux>
camarade_tux, how do you know a person is using ipv6?
<flux>
I mean, if the answer is "they have an address like a:b:c:d:e:f", it is just because their dns is broken
<flux>
if the dns works, they look no different from other ipv4 ircers
<flux>
I would like to point me as an example, but unfortunately I appear to be connected via ipv4 :)
<Camarade_Tux>
flux, because I noticed (i=marmotti@2a01:e35:2f43:ae90:219:d2ff:fe4a:b2d4), that terribly looks like ipv6, but I've never used an ipv6 network so if you tell me that's because of the dns, I'll trust you
<flux>
camarade_tux, if everything is configured properly, it looks like everyone else. well, except it never looks like 1.2.3.4 :)
<Camarade_Tux>
right, forgive me, it was a bit early in the morning ;p
<Camarade_Tux>
and that caml.inria.fr and camlcity.org do not respond just kills me !
itewsh has quit [Remote closed the connection]
Linktim has joined #ocaml
<flux>
tried them in the morning, (08:18) didn't work for me either
<Camarade_Tux>
my problem is that my livecd creation scripts needs them, it's 99% ready, and maybe even worse, it's maybe finished but I have no possibility to test it !
tomh has joined #ocaml
<flux>
sucks
<flux>
critical services should be mirrored :)
ozy` has joined #ocaml
pierre- has joined #ocaml
<Camarade_Tux>
I can't believe godi is not designed to have mirrors
Linktim_ has joined #ocaml
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
<gildor>
flux: what about proposing INRIA to mirror their site on mirror.ocamlcore.org ?
<maxote>
my question is what's doing INRIA?
<maxote>
i'm his british brother
<gildor>
(and also godi)
Linktim has quit [Read error: 113 (No route to host)]
<maxote>
** server can't find mirror.ocamlcore.org: NXDOMAIN
<maxote>
anyone had stoled its IP
<maxote>
/stoled/stolen
<flux>
maxote, I suppose the idea is to create a new service..
<flux>
gildor, sounds reasonable
<flux>
gildor, although if it's all the same, something like inria.mirror.ocamlcore.org could work better with urls (just change the host)
<maxote>
is there the only center? is not there more? why too centric?
<flux>
I guess humps would be also nice to be mirrored - it's under inria.fr too, and it's down now
<maxote>
the root of evil of XXXX.inria.fr is inria.fr
<maxote>
*** Can't find inria.fr.: No answer
Submarine has joined #ocaml
<flux>
perhaps the websites would work if someone knew their ips
filp has joined #ocaml
<Camarade_Tux>
I can ping caml.inria.fr and I've always been able to
<Camarade_Tux>
the ping is excellent also
<Camarade_Tux>
64 bytes from brion.inria.fr (128.93.11.23): icmp_seq=1 ttl=53 time=52.6 ms
<Camarade_Tux>
and same for ocaml-programming.de
<Camarade_Tux>
64 bytes from kundenserver.de (82.165.77.28): icmp_seq=1 ttl=52 time=60.7 ms
<Camarade_Tux>
except that kundenserver.de is not providing anything
<flux>
you might have caml.inria.fr cached
<flux>
never mind, I can also resolve caml.inria.fr
<maxote>
why this problem? any reason od this outrage?
<maxote>
/od/of
<flux>
I think they just have something flaky there :)
<flux>
this is not the first time inria.fr is down..
<flux>
so apparently the error responses are filtered or there is some other imaginative routing happening
<maxote>
i will discover why they wanted this outrage, for my newspapers.
<Camarade_Tux>
methinks it's a chinese conspiracy to prevent ocaml from reigning of the world
<Camarade_Tux>
but of course, that's just my personnal opinion -_-
<maxote>
no ocaml, then i will move to Stanford ML '97
<maxote>
Camarade_Tux, no, it's not a chinese conspiracy, the inria.fr is responsing me from its national land that i did through ssh from london
<maxote>
it's national filtered
<maxote>
err
<maxote>
it's international filtered
<maxote>
wtf EU?
<Camarade_Tux>
maxote, I tried both from France (Lyon and Paris) and from California, and it never worked
<Camarade_Tux>
well, it answers pings, but http is dead
<maxote>
INRIA = The French National Institute for Research in Computer Science and Control <-- uncontrolled? wtf?
<maxote>
i remember some french authors picked papers from Cambridge / Oxford for its own researching
<maxote>
the famous LCF
<Camarade_Tux>
NB : inria.fr will never load, www.inria.fr will
<Camarade_Tux>
anyway, I guess we'll have to wait for monday
pierre- has quit [Read error: 60 (Operation timed out)]
pierre- has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
pierre- has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit [Remote closed the connection]
Yoric[DT] has joined #ocaml
pierre- has joined #ocaml
<Yoric[DT]>
hi
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
<Camarade_Tux>
hi Yoric[DT]
ygrek_ has joined #ocaml
jlouis has quit [Read error: 104 (Connection reset by peer)]
ygrek has quit [Remote closed the connection]
jlouis has joined #ocaml
<yziquel>
flux: following up on our nightly conversation: I did compile protection.cmo before compiling chain.cmo. What is weird is that even when removing chain.ml from the whole business, I'm able to load protection.cmo into the toplevel, but not the .cma generated out of it. I'm wondering if recursive modules work out fine when pulled into a .cma library. For instance, when compiling protection.cmo and then chain.cmo, and looking at the whole busine
<gildor>
rwmjones: I need your authorization to mirror wiki.cocan.org
ched has joined #ocaml
<ched>
Hi, I've got a problem. How to create an array (or a list) with an entry for example like this : 12 34 12 4 7 43
<ched>
With N integers
<ched>
separates by spaces
<ched>
(sorry my english is very ugly :-°)
<ched>
a loop with read_int() doesn't work
<Camarade_Tux>
ched, you can't specify the separator, that makes no sense
<Camarade_Tux>
separators only exist for strings
<Camarade_Tux>
not integers
<ched>
yes
<ched>
It's my entry
<ched>
I want for example with this entry : 5 4 3 2 1
<Camarade_Tux>
ah, ok, got your problem the other way round and swapped input with result ;)
<ched>
[|5;4;3;2;1|]
<ched>
Camarade_Tux, It's not surprising, I speak english like a spanish cow :D
<Camarade_Tux>
ched, no, your sentence was alright but, it's my fault ;)
<Camarade_Tux>
anyway, an easy way is probably to use Str.split which will give you a string list and then you could List.map with int_of_string
<Camarade_Tux>
Str is not included by default so you'll have to add str.cma or str.cmxa in the command-line
<Camarade_Tux>
- : int list = [12; 34; 52; 67; 39]
<ched>
\o/ Thanks a lot !
<Camarade_Tux>
ched, yw
<Camarade_Tux>
gildor, nice start, you don't happen to have a copy of inria's website, do you ? =D
<gildor>
Camarade_Tux: nope
<gildor>
Camarade_Tux: will add it ASAP
<gildor>
rwmjones: could you add a Disallow of calendar pages in robots.txt of wiki.cocan.org ?
<gildor>
Camarade_Tux: what is really good is that the two website are linked together
<gildor>
Camarade_Tux: if you have a link in ocaml-tutorial to wiki.cocan.org, you will stay in mirror.ocamlcore.org
Jedai has quit [Connection reset by peer]
<Camarade_Tux>
gildor, that's nice
Jedai has joined #ocaml
<Camarade_Tux>
we should also maybe try to gather some of the documentation available and make a big archive of it so it's easily available even without internet access
longh has joined #ocaml
Camarade_Tux has quit ["Leaving"]
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
myki has joined #ocaml
<myki>
Hello. As an assignment I had to prepare two versions of merge function (as used in mergesort), one tail recursive, another not, and compare their performances. I came up with that: http://pastebin.com/f1aff1778 and I'm amazed that tail recursive version is about 10%-15% slower. Removing List.rev (although the function doesn't work properly) seems to help just a little - it's called at most 3 times.
<Smerdyakov>
I think you have the wrong idea of precedence order between function calls and binary operators.
<Smerdyakov>
(Your two functions have different behavior because of that.)
<myki>
Smerdyakov: In which lines? in 16,17 I have to reverse just _ss, as acc is already sorted corectly
ygrek_ has quit [Remote closed the connection]
<Smerdyakov>
OK, my mistake.
<Smerdyakov>
I suggest using [List.rev_append], since [@] does a [List.rev] internally anyway.
<Smerdyakov>
I'm pretty sure that your [merge_tail] outputs a list in reverse order compared to [merge]. Is that what you expect to happen?
<myki>
In 25 line it's supposed to be merge_tail instead of just merge, however I've just tested both functins on 10 element lists and both returned the same, properly sorted one
<Smerdyakov>
Yeah, if you reverse the inputs before calling [merge_tail].
<myki>
yes
<Smerdyakov>
It makes perfect sense that [merge_tail] would be slower. Why did you think it would be faster?
<myki>
Smerdyakov: I've always been told that tail-recursive functions are internally translated to iterative versions, hence with lower stack overhead due to recursive calls, are faster
<Smerdyakov>
But your tail-recursive function does much more allocation.
<Smerdyakov>
(When you include the list reverse that has to happen somewhere
<Smerdyakov>
)
<myki>
Smerdyakov: Any ideas how may I improve it? I've tried to apply it to regular lists and then I had either to reverse results or do partial_results@[x] in each call.
<Smerdyakov>
The only reason to want to tail-recursify this function is to get around ridiculous OCaml stack size limits that are much smaller than heap limits.
<myki>
Is it the case, that succint tail-recursive version can't be written - as in map?
<Smerdyakov>
No such problems with SML/NJ or MLton.
<Smerdyakov>
Tail recursion is useful when the size of your accumulated value can be bounded as asymptotically smaller than the size of the call stack.
<Smerdyakov>
In this case, the two sizes are identical asymptotically.
<myki>
Ok, so probably that's what I had to learn from that exercise. Thanks for your help.
Camarade_Tux has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
dondy has joined #ocaml
tadej_ has joined #ocaml
pierre- has quit [Read error: 110 (Connection timed out)]
<tadej_>
hi guys, i'm having problems with printing in ocaml. I want to print a list, but I don't know how
pierre- has joined #ocaml
<tadej_>
could anyone please hel
<tadej_>
*help
<olegfink>
tadej_: you might want to look at the List module documentation
<tadej_>
OK I'll try that now
<thelema>
tadej_: if you use batteries, there's a List.print function
<Camarade_Tux>
thelema, ^^
<Camarade_Tux>
now we just need godi to work again, errmm...
<thelema>
Camarade_Tux: because of 3.11?
<olegfink>
hm, is there a 'user' 3.11 changelog or release notes?
hsuh has joined #ocaml
<thelema>
olegfink: as opposed to a 'developer' changelog?
<tadej_>
is anyone else having difficulties opening caml.inria.fr webpage?
<Camarade_Tux>
tadej_, everybody
<thelema>
tadej_: yes, it seems down.
<Camarade_Tux>
thelema, because ocaml-programming.de is half down, you can't get any file from it
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
<olegfink>
thelema: sort of, because the only changelog I have seen is cvs log
<yziquel>
hi out there. Anyone would be willing to help me out with a recursive module compilation issue. The code is at http://yziquel.homelinux.org/ocaml/
<yziquel>
?
LeCamarade has joined #ocaml
<thelema>
yziquel: why do you need the wierd structure of protected.ml?
<yziquel>
because protected, unprotected, and protected_value are mutually recursively defined.
<yziquel>
I used a recursive module because defining these function with a let rec ... and ... and ... gave wrong typing.
Amorphous has quit [Read error: 104 (Connection reset by peer)]
<thelema>
really?
<yziquel>
typically (Mutex.t, Condition.t) ref protected instead of 'a ref protected as first argument of protected_value.
<yziquel>
there's "wrong" and wrong...
<thelema>
ah, I think I see why it would infer that.
<yziquel>
they call themselves recursivel on the (Mutex.t, Condition.t) ref protected part of the 'a protected type...
<thelema>
exactly
<yziquel>
That's why I used recursive modules. To get around this issue.
<yziquel>
But then, compiling seems rather problematic.
<yziquel>
when loading the .cma file in the toplevel, I get Reference to undefined global `Protection'.
<yziquel>
But the .cmo file loads correctly.
<thelema>
if you just want it to work, you could handle the inner parts of the recursion with a separate function.
<thelema>
and that function would get the Mutex.t, condition.t ref protected
<yziquel>
I tried that... copying the file to the ocaml/ folder.
<thelema>
and the outer function could stay 'a ref protected
<yziquel>
It didn't work out the way i would have liked it.
<yziquel>
See file broken-protection.ml
<yziquel>
The Badly_typed module doesn't compile. It says I cannot define recursive stuff in this way...
<thelema>
your editor seems to create unicode - be aware ocamlc only likes latin1
<yziquel>
??? its vi...
<Camarade_Tux>
yziquel, vi or vim ?
<yziquel>
vim, sorry.
<yziquel>
Nevertheless, i do not think that unicode is an issue here...
<Camarade_Tux>
:set encoding=latin1
<Camarade_Tux>
but I've never had troubles, :set encoding=latin1 is maybe written in one of the ocaml.vim files
<yziquel>
Could there be a way to fool the type computation mechanism? put a 'b instead of the Mutex.t * Condition.t. Let the functions' type be computed. They would give a 'b protected typing. Then, restrict the signature of the module to 'a * ((Mutex.t * Condition.t) ref protected....
<yziquel>
?????
Amorphous has joined #ocaml
<yziquel>
But that would be really fooling the type-checking mechanism!
<yziquel>
thelema: I do not really understand what this piece of code should do differently.
Torment has quit [Read error: 104 (Connection reset by peer)]
<thelema>
there's a mutually recursive core, but then there's wrapper functions (not recursive) that call into the core to handle the mutex.t * condition.t case
<yziquel>
But isn't there a way not to code the same thing twice? That's what I tried to do with my broken-protection.ml file...
<Smerdyakov>
darinm, it is for me.
<thelema>
probably like try/finally, this case you've got to write the code twice.
<thelema>
(for different reasons)
darinm has quit [Read error: 104 (Connection reset by peer)]
darinm has joined #ocaml
<thelema>
go ahead and push on the ocaml dev team to fix whatever bug in the compiler gets hit by your recursive case.
<yziquel>
Argh! the ocaml magic somewhat faints...
<yziquel>
I'll push the ocaml team as soon as I can. I think the recursive modules should be the way to go to code this...
pierre- has quit [Read error: 104 (Connection reset by peer)]
<yziquel>
Is there an "official" irc channel where they can be reached?
<Smerdyakov>
Hahaha!
<yziquel>
Smerdyakov: what's so funny?
<Smerdyakov>
You have to understand that OCaml is a research tool that happens to have practical users.
<thelema>
yziquel: yes, #ocaml on freenode.net :)
<thelema>
once caml.inria.fr is up again, you can file a bug in the bug tracker
<Smerdyakov>
There aren't really members of the team who do bug fixes who wouldn't rather be doing new research.
<yziquel>
Smerdyakov: I know that. But I remember stumbling on a channel on another server, where they seemed to be hanging around. Maybe that was in a dream.
<darinm>
thelema: any idea when caml.inria.fr will be back up?
<yziquel>
Smerdyakov: I have a vague idea of how inria and the french universities work...
<vixey>
I think that you sshould do this without recursive modules
<yziquel>
vixey: yes, I will do it with the code written twice, as thelema pointed out. Or trying the type-checking mechanism... but recursive modules should be allowed to go into a .cma, methink...
<yziquel>
vixey: you won.
<vixey>
I didn't win, I was just right all along :p
pierre- has joined #ocaml
<yziquel>
is the caml-list@inria.fr down too?
darinm has left #ocaml []
<vixey>
yziquel: Are you sure fixing the problem with recursive modules is beyond your ability?
<Camarade_Tux>
yziquel, that would explain why it's been suddenly so quiet, especially after yesterday
<yziquel>
vixey: i'm rather sure that it's a compiling issue. .cmo works, .cma doesn't.
<yziquel>
vixey: and i know nothing of how ocaml compiles things... (except user-knowledge).
dondy has quit [Remote closed the connection]
filp has quit ["Bye"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
myki has quit ["leaving"]
<thelema>
yziquel: I wonder if changing your type will help...
<thelema>
type ('a, 'b) protected = Protected of 'a * ('b ref protected * Mutex.t) | Unprotected of 'a
Submarine has joined #ocaml
<thelema>
hmm, why the extra ()?
<thelema>
Protected of 'a * 'b protected * Mutex.t
<thelema>
double hmm -- what's the return type on protected_value? 'a, right?
<thelema>
then the line [ let (mut, cond) = ~(protected_value locking_data) in] forces its return type to be mutex*condition ref
<thelema>
which restricts the 'a
toots has joined #ocaml
<toots>
hi all !
<thelema>
hi
<toots>
I have a question on Bigarrays used in C
<toots>
may I use the *data in a non blocking context ?
<toots>
or do I need to copy it too
LeCamarade has quit [Read error: 113 (No route to host)]
* thelema
doesn't use Bigarrays or C
<Camarade_Tux>
and I can't remember unfortunately
<yziquel>
thelema: yes, protected_value should be 'a protected -> 'a (without the optional arguments).
<thelema>
but you're using it as if it returns a (mut, cond) ref
<toots>
right, thanks
<toots>
I shall ask to the mailling list then
<thelema>
toots: if you wait a bit, someone might answer.
<toots>
yes yes :)
<Camarade_Tux>
(and the mailing-list died yesterday so you'll need to wait for it to resurrect)
<yziquel>
thelema: that's an interesting idea, but perhaps the type inference would say: well, protected_value locking_data, therefore, type ('b, _) protected -> 'b, and as we use it with ('a, 'b) protected -> ???, we would have 'a = 'b, and the type of protected_value would be ('a, 'a) protected -> 'a...
itewsh has joined #ocaml
<Camarade_Tux>
toots, but possibly you wouldn't have to copy the array, just protect it with CAMLparam1()
<yziquel>
thelema: in the code, yes, I'm using it only in this context. But in chain.mli, I'm using it in another context (Chain.t ref protected -> Chain.t ref).
<yziquel>
in chain.ml, sorry.
<toots>
Camarade_Tux: Thanks
<toots>
I will try
<thelema>
type ('a,'b) protected_int =
<thelema>
| Protected of 'a * (('b,'b) protected_int * Mutex.t)
<thelema>
| Unprotected of 'a;;
<thelema>
type 'a protected = ('a, ((Mutex.t, Condition.t) ref)) protected_int
<thelema>
This is what I'm trying now. Maybe you can take the ball and run with it.
<thelema>
I've got to go.
<yziquel>
thx a lot.
<Camarade_Tux>
toots, I can not guarantee that but that should be enough, anyway, try and if over a few runs you don't segfault, it's almost certainly good
<toots>
yea that's what I was wondering :)
<Camarade_Tux>
but once caml.inria.fr is back up, ask on the mailing-list
* Camarade_Tux
poofs, see you
Camarade_Tux has quit ["Leaving"]
<thelema>
if it's just copying a pointer, that shouldn't be much overhead for safety.
<thelema>
optimize later.
<Yoric[DT]>
thelema: mfp: I have a question regarding [Rope].
<Yoric[DT]>
What is the point of the STRING module?
<Yoric[DT]>
Why not directly use UTF8?
<mfp>
Yoric[DT]: it's been a while, but IIRC it was just in order to reuse the code for Ropes to build Vect
<Yoric[DT]>
What I mean is module [STRING] only has a few lines, all of which look like [let foo = UTF8.foo].
<mfp>
hmm I don't remember writing any of the UTF8 stuff
<mfp>
in that case, module STRING = UTF8 would have done
<Yoric[DT]>
That may have been thelema.
<yziquel>
any pointers on how to use ocamldsort?
pierre- has quit [Read error: 104 (Connection reset by peer)]
Jedai has quit [Read error: 110 (Connection timed out)]
GustNG has quit [Read error: 110 (Connection timed out)]
<Palace_Chan>
it's been down since yesterday :( is there a .mem or .find function in the List module like there is for Hashtbl ?
det has quit [Remote closed the connection]
det has joined #ocaml
<flux>
yes
<flux>
debian/ubuntu?
<flux>
there's .mem
<flux>
do you use emacs?
itewsh has quit [Read error: 110 (Connection timed out)]
<Palace_Chan>
ah yes with tuareg mode
<Palace_Chan>
C-c h ?
<flux>
yes
<flux>
List. C-c h
<flux>
man, I should build a profile of people on the channel so I could just give the answer without intermediate questions ;)
pierre- has joined #ocaml
itewsh has joined #ocaml
GustNG1 has quit [Read error: 104 (Connection reset by peer)]
<flux>
I'm guessing also the mailing list is down, as the last mail from the list is at 20:30 local time on friday
pierre- has quit [Read error: 104 (Connection reset by peer)]
<Palace_Chan>
has it been down before like this ?
<flux>
it has
<flux>
I remember a few times
Snark_ has joined #ocaml
<maxote>
ocaml failed the 24/7 reignity
<maxote>
err
<maxote>
inria failed the 24/7 reignity
<flux>
I'm guesing that if it goes down during a weekend, monday is the next day someone's going to fix it
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<Palace_Chan>
i'm getting a syntax error in something like: if List.mem (varstr,_) cxt.tc_binds where the latter is a list of tuples and i just want to check if varstr has a "binding"...anything jump out as syntaxtically wrong ?
<vixey>
you are writing a typechecker?
<Smerdyakov>
Palace_Chan, sure. [_] is not a legal expression.
<Smerdyakov>
Palace_Chan, [_] is only for patterns.
<Palace_Chan>
ironically i am...(ironic because ocamls typechecker still destroys me 90% of the time)
<vixey>
for what language?
<Palace_Chan>
Smerdyakov, ah ok, so how may i check in a list of tuples if there is a tuple of the form (a, anything) ?
snhmib has joined #ocaml
<Palace_Chan>
vixey, a play language similar to C and Ocaml
<vixey>
so have you implemented first order unification
<vixey>
like Prolog ?
<Smerdyakov>
Palace_Chan, you don't know how to write this period, or you don't know how to write it as a one-liner?
<Palace_Chan>
vixey, nope
<vixey>
How are you writing this then?
<Palace_Chan>
vixey, i'm just filling up parts in a function following provided inference rules - dont know very much about the subject
<Palace_Chan>
Smerdyakov, prolly the latter
<Smerdyakov>
Palace_Chan, OK, I suggest writing this in any way you can manage, then thinking about how to use functions from the standard library to simplify that code one step at a time.
<Palace_Chan>
i think using .find with a made up function i might be able to do it, but it would be pretty ugly
<vixey>
A nice way to do typing like that is take your AST and stick a logic variable at every node in the tree, then you can fold over it unifying the typing rules into it
<Smerdyakov>
Palace_Chan, yes, that is what I was thinking of. However, it _is_ your lucky day, as the [List] module has association list functions included. Read the manual page for details.
<vixey>
so it's like 3 lines of code for HM type checker
<vixey>
(once you re-implement half of Prolog :)))
<Palace_Chan>
vixey, interesting
<Palace_Chan>
Smerdyakov, ill check it out
<Palace_Chan>
Smerdyakov, ahhh mem_assoc, yes it is my lucky day
<vixey>
do you know the unification algorithm though?
Quadrescence has left #ocaml []
ygrek_ has joined #ocaml
<Palace_Chan>
vixey, heard of it
<Palace_Chan>
brb, gotta get breakfast
xavierbot has joined #ocaml
<xavierbot>
Objective Caml version 3.12.0+dev0 (2008-10-15)
GustNG has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]>
Mmmhh....
<Yoric[DT]>
Parsing unicode is a tad difficult.
<vixey>
so if you have actually loaded up some huge ocaml program and you are in the toplevel.. how can you investigate things like types of functions and so on?
Asmadeus has quit [Remote closed the connection]
Asmadeus has joined #ocaml
<vixey>
do I ask too much of the toplevel?
pierre- has quit [Read error: 110 (Connection timed out)]
<Smerdyakov>
Just evaluate the function's name as an expression.
Snark_ has quit ["Ex-Chat"]
<vixey>
I don't really know why it is not in scope
<vixey>
when I try that
<Yoric[DT]>
mfp: are you still around?
<vixey>
is there any list of all the directives about?
<flux>
vixey, there's an enhanced toplevel around
<flux>
can't recall its name though
<Yoric[DT]>
I think it's on the Forge.
<vixey>
I just want to use the normal toplevel
<flux>
vixey, well, to determine the type of a function, you just type its name
<flux>
as toplevel will tell the type of all expressions you enter
<vixey>
it's not in scope though
<flux>
"not in scope" meaning what?
<flux>
if it's in another module, you can use Module.foo..
<olegfink>
flux: let _ = let a = 2 in ()
<olegfink>
you won't get a's signature from toplevel
<flux>
in that case you want to use ocamlc -dtypes
<flux>
and use your editor to retrieve the type
<flux>
toplevel won't help there
<flux>
I guess it'd be difficult to build such a feature
<flux>
how would you refer to that a?
<flux>
atleast emacs' tuareg mode can make use of the generated .annot-files, and there's an extension (or whatever they call them) for vim also
<Yoric[DT]>
Tuareg can do that?
<Yoric[DT]>
Nice.
<flux>
well, not actually
<flux>
it uses caml-types
<flux>
which comes with the official ocaml-mode
<flux>
yoric[dt], I take it you don't use emacs then?
<Yoric[DT]>
I actually do.
<Yoric[DT]>
I just never knew about that.
<flux>
I mean, querying the type of expression under type is a feature I could not live without :-)
<flux>
C-c C-t
<flux>
s/type/cursor/2
<Yoric[DT]>
"C-c C-t is undefined"
<Yoric[DT]>
Or is that in the toplevel part of Tuareg?
<flux>
you need to have files caml-types.el(c) around
<flux>
it comes with ocaml-mode
<flux>
tuareg can just wire the keys to use that
<flux>
so if you don't have it, C-c C-t won't work either
GustNG has joined #ocaml
* Yoric[DT]
will try and get that installed at some point.
<Yoric[DT]>
ocaml-mode is not installed, indeed
<Yoric[DT]>
Installing now.
<Yoric[DT]>
Will try later, though.
<flux>
I recommend that indeed
tadej_ has quit [Read error: 60 (Operation timed out)]
<flux>
it's missing half the ocaml experience IMHO :)
<Yoric[DT]>
:)
<Yoric[DT]>
Thanks for the tip.
tomh has joined #ocaml
Asmadeus has quit [Read error: 60 (Operation timed out)]
GustNG1 has quit [Read error: 110 (Connection timed out)]
Asmadeus has joined #ocaml
toots has quit [Read error: 113 (No route to host)]
GustNG1 has joined #ocaml
Camarade_Tux has joined #ocaml
ygrek_ has quit [Remote closed the connection]
<Yoric[DT]>
thelema: ping
GustNG2 has joined #ocaml
GustNG3 has joined #ocaml
delamarche_ has joined #ocaml
Associat0r has joined #ocaml
GustNG4 has joined #ocaml
delamarche has quit [Connection timed out]
<vixey>
is there any backups of the ocaml manual
<Camarade_Tux>
vixey, I think I have some on my disk, hold on a bit
<Camarade_Tux>
vixey, I have a 495 page pdf, does it look like what you want (includes stdlib doc and everything)
<Camarade_Tux>
okay, I have the 3.10 version, uploading right now
GustNG has quit [Read error: 110 (Connection timed out)]
<Smerdyakov>
If you use Debian and install the ocaml-doc package along with ocaml, you always have on your hard disk the full manual matching your installed version.
<vixey>
I would use debian if it actually booted on my hardware :/
* Camarade_Tux
's ftp is stuck
vixey has left #ocaml []
vixey has joined #ocaml
<vixey>
Is there any way to just print out an object like how the toplevel can?
GustNG1 has quit [Read error: 110 (Connection timed out)]
<Smerdyakov>
No.
<Camarade_Tux>
vixey, Peng Zang has written something for this I think
<Smerdyakov>
You need to do something special at type definition sites. You can't do it after-the-fact.
GustNG3 has quit [Read error: 110 (Connection timed out)]
GustNG2 has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux>
vixey, sorry for rapidshare but since my ftp doesn't behave correctly...
<Yoric[DT]>
Let me wish all of you a pleasant night.
<Yoric[DT]>
Bye
Yoric[DT] has quit ["Ex-Chat"]
<Camarade_Tux>
vixey, I *had* to find it, I couldn't have slept otherwise ;)
olegfink has quit ["WeeChat 0.2.6"]
itewsh has joined #ocaml
olegfink has joined #ocaml
olegfink has quit [Remote closed the connection]
ulfdoz has quit [Read error: 104 (Connection reset by peer)]
<yziquel>
is Hashtbl thread-safe?
<flux>
yziquel, I would expect it not to be. it is difficult to write such modules in a thread-safe way that would also give good performance.
<Camarade_Tux>
yziquel, it uses mutation so not really
<flux>
perhaps an immutable datastructure such as Map will help you.. but you still need to locking if _you_ use mutation
<Smerdyakov>
Camarade_Tux, OCaml supports mutable thread-safe data structures.
_zack has joined #ocaml
<Camarade_Tux>
my definition of thread-safe is "no unexpected behaviour", if the hashtable is shared and modified by one thread and read by an other one at the same time, it will most probably not be that safe or I am missing something ?
<yziquel>
what I'd need is some hashtbl.t-like data structure that executes a piece of code as soon as it is empty. Can Hashtbl "easily" be modified to suit this behaviour???
<yziquel>
(In a thread-safe way, of course...)
<Smerdyakov>
Camarade_Tux, you have strange definitions.
<Smerdyakov>
Camarade_Tux, you can guard any data structure with a lock.
<Camarade_Tux>
yziquel, I don't know if Hashtbl has a fast way to know if its empty
<yziquel>
I'd need "as soon as"...
<flux>
yziquel, well, you can easily build a new structure that uses Hashtbl.t and keeps track of the number of elements in
GustNG has joined #ocaml
<flux>
yziquel, and while doing that it would use Mutexes to protect the data structure
<Camarade_Tux>
Smerdyakov, that's how *I* understand thread-safe and yes, you can use mutexes but that's not the most elegant solution :)
<Smerdyakov>
Camarade_Tux, there are also plenty of lock-free data structures that are thread-safe.
<Smerdyakov>
(Mutable, I mean)
<yziquel>
flux: indeed. however i do not like very much the idea of mingling integers with an otherwise integer-less data structure. But perhaps I'm trying to be too pretty...
<flux>
but lock-free data structures need some other primitives then, generally not available in high-level programming languages such as ocaml..
<yziquel>
hmm... i'll have to scratch my head somewhat more...
<flux>
yziquel, btw, Batteries' Hashtbl has is_empty, which you might be able to use. but if Batteries is too alpha for you, you can check out if ExtLib has the same function (it likely does)
<flux>
I don't think there is a reasonable way to extend a module in the way you want, without writing a new module that implements the behavior in the terms of another one
GustNG4 has quit [Read error: 110 (Connection timed out)]
Submarine has quit [Remote closed the connection]
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
GustNG has quit [Read error: 110 (Connection timed out)]