<Camarade_Tux>
rwmjones: maybe mikmatch's META would be a good inspiration for the META (or maybe godi's META for it, not sure they're the same)
<Camarade_Tux>
mfp: I was under the impression the nacl-ocaml part was developped for corefarm in mind
<mfp>
Camarade_Tux: doesn't seem so (diff guy)
<Camarade_Tux>
mfp: I wonder which links I followed to stumble upon corefarm a few days ago...
leoncame1 has quit [Quit: leaving]
det has quit [Ping timeout: 276 seconds]
pimmhogeling has joined #ocaml
leoncamel has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
<flux>
thelema, hm, it appears 0e009f03bbcda28c752b42c9ceaf5de646eafbac removed BatMap.S.min_key. later PMap merge introduced BatMap.min_binding, which appears to be the same but for PMap..
<flux>
from the looks of it it was a mistake. or was there some issue?
munga has quit [Ping timeout: 245 seconds]
rwmjones has quit [Ping timeout: 245 seconds]
_andre has joined #ocaml
oc13 has joined #ocaml
rwmjones has joined #ocaml
det has joined #ocaml
<thelema>
flux: I can't explain the removal, although it seems intentional with the changelog note and all.
<flux>
thelema, "Banging head on walls with git issues." ?
<flux>
or am I misinterpreting, might be as this is the first time I use git annotate+git log this way :)
<thelema>
I agree the comment is odd.
<thelema>
the commit comment.
shr3kst3r has quit [Remote host closed the connection]
shr3kst3r has joined #ocaml
Shoggoth has joined #ocaml
slash_ has joined #ocaml
slash_ has quit [Client Quit]
valross has quit [Quit: Ex-Chat]
thrasibule_ has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
nimred_ has quit [Quit: leaving]
nimred has joined #ocaml
oc13 has quit [Quit: Leaving.]
matthieu has quit [Ping timeout: 265 seconds]
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 264 seconds]
Snark has joined #ocaml
maattd has joined #ocaml
<albacker>
ok so this is the mlpaste.ml for pasting in pastebin.org i coded yestarday (with your help of course : http://pastebin.org/108632 how bad written is it for a 'beginner' ?
<Camarade_Tux>
doesn't look bad (haven't read everything yet)
spearalot has quit [Quit: -arividerchi]
<Camarade_Tux>
I would use List.find rather than code get_format however
<albacker>
i'll think about it.
<albacker>
the last part probably needs more editing in my opinion.
<Camarade_Tux>
for to_str, you might want to use Pervasives.input_line instead
<Camarade_Tux>
and probably a Buffer.t instead of a string ref
<albacker>
i convert each character into it's hex
<albacker>
%26 for & for example, since it would get me into trouble when posting it (line 142 to be more exact)
<Camarade_Tux>
ah, right, I had skipped that, sorry
<albacker>
bue yeah, Buffer would be a better solution since the string i'm returning is very big (sometimes).
<Camarade_Tux>
for windows compat, you might want to check for CRLF linefeeds (\r\n) or set the in_channel as not binary (set_binary_mode ic false) before reading from it (the \r\n-s will be converted to \n)
<Camarade_Tux>
minor: in get_url, no need to use begin and end
<Camarade_Tux>
it's actually not bad for readability but I'm not sure that's what you had in mind
<Camarade_Tux>
and you might want to use the Arg module for parsing arguments, I'm not a big fan of it (it's a bit limited and using refs to set arguments makes it harder to check that one value has been defined) but it should do it
<albacker>
what do you mean 'im not sure that's what you had in mind' ?
<Camarade_Tux>
and in print_help, I would have used List.iter print_endline [ "mlpaste : a tool to paste in pastebin.org"; "usa... ], it saves some typing :-)
<Camarade_Tux>
albacker: why did you use begin+end there?
<albacker>
i thought i had too -_-
<albacker>
they taught me that each time we have multiple lines (function calls) we should put it inside begin and end
<albacker>
i see what you mean by 'readibility' now
<Camarade_Tux>
it's not needed but I found it actually more readable here (in the sense I didn't expect any new variable between the block [ it's not always right, but it _could_ be good practice ] )
<albacker>
ok, buffer should be added, List.find in get_format and.. i was wondering if i can get the Location: line only from here : http://pastebin.org/108639
<Camarade_Tux>
could use regexp from Str
<Camarade_Tux>
know what a regexp is?
<albacker>
yes.
<albacker>
i think the curl.perform prints directly to stdout.
<albacker>
how can i use curl in toplevel?
<albacker>
#use "topfind";; #require "curl";; ?
<Camarade_Tux>
yeah, it should work
<albacker>
no such package Curl;;
<albacker>
and i was playing with it yestarday.. hmm
<Camarade_Tux>
ocurl?
<Camarade_Tux>
you can also use #list;; to see the packages installed (or run: ocamlfind list |grep -i curl)
<albacker>
weird. it doesn't return anything.
<albacker>
i installed it from source code and not from the repos,
_unK has joined #ocaml
<albacker>
it's installed right here : /usr/lib/ocaml/3.10.2/curl
<Camarade_Tux>
how do you compile your program? not with ocamlfind I guess
<Camarade_Tux>
most probably, when you used "make install", it didn't install with ocamlfind which means ocamlfind won't see it
<Camarade_Tux>
you can probably use 'ocaml -I +curl curl.cma' to use it in the toplevel
<albacker>
The external function `helper_curl_version' is not available
<albacker>
this is how i compile the program ocamlc -I +curl curl.cma mlpaste.ml -o mlpaste
Snark has quit [Quit: Ex-Chat]
lokydor has joined #ocaml
slash_ has joined #ocaml
Shoggoth has quit [Quit: Ex-Chat]
yakov has joined #ocaml
<yakov>
hey
jimmyb2187 has left #ocaml []
<Camarade_Tux>
albacker: well, the library is a binding to a C library, it probably needs a .so with that function definition, at this point, without ocamlfind, it's probably better not to try too hard to get it working unless you really need it (actually, it's quite simple but I don't remember very well and I'm a bit tired and really hungry... :-) )
<Camarade_Tux>
hi yakov
jimmyb2187 has joined #ocaml
<albacker>
well 16:04 gotta eat lunch too :) Camarade_Tux
<albacker>
is it possible to "grep" that one line if curl.perform writes directly to stdout?
<Camarade_Tux>
well, a helper script with grep should do it but it's a bit ugly
<Camarade_Tux>
I'm actually surprised this is printed on stdout, there might be something in the documentation about that
<albacker>
there was no proper documentation anyways, i'll read what i can find just to be sure :)
<Camarade_Tux>
well, the .mli ;-)
<albacker>
hard to belive but there were no comments in that file (the .mli)
<Camarade_Tux>
well, the function signatures ;p
<Camarade_Tux>
maybe an optional argument
<Camarade_Tux>
or another function that takes more arguments and let you specify what to do with the server's answer
<albacker>
well that's why i wanted curl in toplevel so i could see the signatures :D
<Camarade_Tux>
and last possibility: curl's documentation itself, that's basically what lablgtk does (it's not that nice actually)
<albacker>
Camarade_Tux, thanks for the help, i'll figure out what's needed.
<Camarade_Tux>
heheh :P
<Camarade_Tux>
:-)
<albacker>
val perform : t -> unit :(
krankkatze` has joined #ocaml
avsm1 has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
<Camarade_Tux>
also, note that you need to use \\n, not \n
<albacker>
Camarade_Tux, server answer in fact is separate lines, so i can do some Str.string_match in every line and print the one i want.
<albacker>
i dont need to acumulate all of them in one string.
<Camarade_Tux>
albacker: yeah, would be even better :-)
boscop has joined #ocaml
mrvn has joined #ocaml
<mrvn>
re
slash__ has joined #ocaml
* mrvn
has been racking his brain on how to extract a range of keys (first-last) out of a B-tree asynchronously without locking or inconsistentcies when a node is split/merged during the lookup.
slash__ has quit [Client Quit]
slash__ has joined #ocaml
<mrvn>
My current solution is to is restart from the top with the next possible key whenever the search gets interrupted.
<albacker>
i should probably try..with it in case it's not found.
f[x] has quit [Ping timeout: 268 seconds]
15SAAIW02 has quit [Remote host closed the connection]
avsm1 has quit [Ping timeout: 245 seconds]
Submarine has quit [Quit: Leaving]
itewsh has joined #ocaml
smimou has quit [Ping timeout: 246 seconds]
smimou has joined #ocaml
inkbottle has quit [Quit: Leaving]
smimou has quit [Ping timeout: 246 seconds]
smimou has joined #ocaml
jcaose has joined #ocaml
lokydor has joined #ocaml
yakischloba has quit [Quit: Leaving.]
Yoric has quit [Quit: Yoric]
brooksbp has joined #ocaml
filp has quit [Quit: Bye]
rwmjones has quit [Ping timeout: 245 seconds]
ttamttam has joined #ocaml
<flux>
hmph, maybe I should've used the ocaml graph module from the beginning, manipulating sets and maps with folds doesn't seem to bring out the code that's the best to read :)
travisbrady has joined #ocaml
rwmjones has joined #ocaml
lokydor has quit [Remote host closed the connection]
ztfw has joined #ocaml
<flux>
seems like a nice library
<mrvn>
flux: I have the same problem with my cps style interface. Complicates code flow and/or indentation. But often you can write things in certain ways to make it looke nice again.
<mrvn>
Define helper functions to factor out code and such.
<flux>
mrvn, monads can help with cps style interfaces, btw
<mrvn>
Got a pointer to a nice implementation?
<flux>
nope :)
avsm has joined #ocaml
<flux>
I've got a few examples on the idea though. actually they are in my thesis! (written in finnish)
<mrvn>
I will never finish reading that
<flux>
well, the example file appears to be only 90 lines long
<flux>
and although the labels are gibberish to you, the type signatures should be clear :)
<flux>
part of the trick is to always have the cps arg as the last parameter
<mrvn>
flux: How would I evaluate the monad up to a point and then suspend it? Like in find when a Node in the B-Tree is missing I start loading it and set the continuation to Pending.
<flux>
mrvn, well, like in the example, you call odota_lukua (wait_read), which returns a special value that eventually returns to the running function
<mrvn>
flux: But normaly find would return a monad. What do I return in the caseof it being suspended?
<flux>
mrvn, as you can see the 'a monad type is a suspension
<mrvn>
Would the signature be: val find : tree -> Key.t -> Value.t monad -> unit ?
<flux>
plain val find : tree -> Key.t -> Value.t monad
<mrvn>
But when I suspend I store the monad in the tree as Pending [monad]. What do I return then?
lokydor has joined #ocaml
maattd has joined #ocaml
maattd has quit [Excess Flood]
<mrvn>
flux: Do I understand your implementation right that you bind one function after another into the monad building one huge function and at the end you IO_Monad.run it?
<flux>
I guess find is a sort of monad running function
maattd has joined #ocaml
<flux>
mrvn, well, sort of, except the function isn't built up-front but continuously
<mrvn>
But nothing gets executed until your "run" it. Then yes, find is a running function
<mrvn>
It has the side effect of loading nodes of the tree if missing too.
<mrvn>
val find : tree -> Key.t -> Value.t monad -> unit. It takes a tree and a key and (eventually) runs the Value.t monad with None | Some value.
<mrvn>
Which, as I notice right now, has some bad type inferences.
<mrvn>
Entry.Leaf.Free.leaf is Entry.Leaf.t
<mrvn>
How do you handle module M = struct type t module N = type m_t = t type t vas as_m : t -> m_t end end?
<flux>
handle?
<mrvn>
That you have to alias the M.t and then the automatic signature gets the types all ugly.
<flux>
yes, well, you handle them by maintaining .mli files manually :)
<mrvn>
flux: but even then it is ugly. I would like val as_m : t -> M.t or t -> .t or something instead of the alias.
Snark has quit [Quit: Ex-Chat]
<mrvn>
Maybe it would be better to rite module M = struct type m type t = m module N = type n type t = n val as_m : n -> m end end?
<mrvn>
I.e. give each type a real name and just alias it to t for users.
Alpounet has joined #ocaml
<flux>
ooh, This is a call for testers concerning an experimental OCaml compiler back-end that uses SSE2 instructions for floating-point arithmetic. This code generation strategy was discussed before on this list, and I include below a summary in Q&A style.
<mrvn>
Does that affect amd64?
<Camarade_Tux>
amd64 already uses sse2, this doesn't change anything
<flux>
oh. never mind then :)
<mrvn>
That's what I was thinking/hoping.
<mrvn>
I would have an interesting project for someone with some free time. Port ocamlopt to x86_32, amd64 in 64bit mode using 32bit pointers / values. Pointers would be zero extended on use.
itewsh has quit [Quit: There are only 10 kinds of people: those who understand binary and those who don't]
ygrek has joined #ocaml
<avsm>
why not just run in 32-bit compat mode on x64?
Associat0r has joined #ocaml
<mrvn>
because x86 is seriously register starved
Associat0r has quit [Client Quit]
<mrvn>
Makes often ~20% difference in speed.
jao has joined #ocaml
avsm has quit [Quit: Leaving.]
<mrvn>
I think I won't get around introducing a lock into my B-tree. :(
<flux>
you're going lockfree? cool!
<flux>
;)
<mrvn>
find, insert and replace are lock free. But split is a problem.
ulfdoz has joined #ocaml
<mrvn>
Each Node has a parent pointer (or ID when on disk). When I split I need to update that pointer. I do that by going through all children and adding the "change parent" function first in the Pending list so the parent is changed before any other functions are run on that node.
<mrvn>
The problem now is that the parent might be split again before all the children have been loaded and updated.
Yoric has joined #ocaml
lokydor has quit [Remote host closed the connection]
<mrvn>
Saying it out loud there seems to be a simple solution. Make Pending have 2 lists, priority and normal. "change parent" gets added to the end of the priority list (or maybe not have a list there but just a new_parent : tree_option).
<mrvn>
I will try that. Thanks for being my sounding board.
maattd has quit [Remote host closed the connection]
enthymene has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Client Quit]
_andre has quit [Quit: *puff*]
Yoric has quit [Quit: Yoric]
yakischloba has joined #ocaml
CcSsNET has joined #ocaml
jcaose has quit [Ping timeout: 256 seconds]
yakischloba has quit [Quit: Leaving.]
lokydor has joined #ocaml
sgnb` has joined #ocaml
sgnb has quit [Remote host closed the connection]
ttamttam has quit [Quit: Leaving.]
Submarine has joined #ocaml
catofzen has joined #ocaml
mrvn has quit [Ping timeout: 258 seconds]
mrvn has joined #ocaml
Submarine has quit [Read error: Operation timed out]
derdon has quit [Quit: derdon]
Yoric has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 252 seconds]
pimmhogeling has quit [Ping timeout: 265 seconds]
fraggle_ has quit [Remote host closed the connection]
sgnb` has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
sgnb has joined #ocaml
<mrvn>
I can do "type a = A of int * int" but why can't I do "type b = B of { x: int; mutable y : int; }"?
<mrvn>
And how safe is this? type b = B of int * int type b_rec = { x: int; mutable y : int; } let set_y (b : b) y = ((Obj.magic b) : b_rec).y <- y let t = B (1,2) let _ = set_y t 3 let t = t;;
<mrvn>
"type b_rec = { x: int; mutable y : int; } type b = B of b_rec" seems like a stupid waste of 3 words.
Alpounet has quit [Ping timeout: 252 seconds]
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
Alpounet has joined #ocaml
Yoric has quit [Quit: Yoric]
ulfdoz has quit [Ping timeout: 264 seconds]
lokydor has quit [Ping timeout: 245 seconds]
ztfw has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 245 seconds]
Alpounet has quit [Ping timeout: 245 seconds]
<albacker>
night
albacker has quit [Quit: Leaving]
Alpounet has joined #ocaml
Alpounet has quit [Ping timeout: 268 seconds]
Alpounet has joined #ocaml
CcSsNET has quit [Ping timeout: 256 seconds]
{newbie} has quit [Quit: {newbie}]
rwmjones has quit [Ping timeout: 256 seconds]
jonafan has quit [Read error: Connection reset by peer]
rwmjones has joined #ocaml
slash__ has quit [Quit: Lost terminal]
Amorphous has quit [Ping timeout: 256 seconds]
Amorphous has joined #ocaml
<det>
mrvn, I guess Ocaml wants a name for every type of record
<det>
type B = B of {a: int; b: string;}
<det>
let f (B b) = b
<det>
what is the type of f ?
<Alpounet>
no need for that B
<Alpounet>
type b = {a: int; b:string} should be fine