rwmjones changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.1 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
mwc has quit [Remote closed the connection]
Snrrrub has joined #ocaml
mwc has joined #ocaml
mwc has quit [Client Quit]
mwc has joined #ocaml
pattern has quit ["ZNC by prozac - http://znc.sourceforge.net"]
pattern has joined #ocaml
evn_ has joined #ocaml
stugy has quit [Remote closed the connection]
jlouis_ has joined #ocaml
Snrrrub has quit [Read error: 110 (Connection timed out)]
jlouis has quit [Read error: 110 (Connection timed out)]
stugy has joined #ocaml
AxleLonghorn has joined #ocaml
coucou747 has quit [Remote closed the connection]
coucou747 has joined #ocaml
bzren has quit ["Ex-Chat"]
|Catch22| has joined #ocaml
ardor has joined #ocaml
<ardor> Hello
seafood_ has quit []
mwc has left #ocaml []
thermoplyae is now known as thermo_
menace has quit []
thermo_ is now known as thermoplyae
<coucou747> bye
coucou747 has quit ["bye ca veut dire tchao en anglais"]
ardor has quit []
middayc has quit []
Jedai has quit [Read error: 110 (Connection timed out)]
Jedai has joined #ocaml
Snrrrub has joined #ocaml
evn_ has quit []
AxleLonghorn has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has joined #ocaml
authentic has joined #ocaml
evn has quit []
catch22 has joined #ocaml
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
jonathanv has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
jonafan has joined #ocaml
jonathanv has quit [Read error: 110 (Connection timed out)]
szell has joined #ocaml
m3ga has joined #ocaml
seafood_ has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
szell` has quit [Read error: 110 (Connection timed out)]
mwc has joined #ocaml
teip has joined #ocaml
coucou747 has joined #ocaml
seafood_ has quit [Read error: 110 (Connection timed out)]
goalieca has joined #ocaml
authentic has quit [Read error: 113 (No route to host)]
jlouis has joined #ocaml
teip has quit ["Leaving."]
jlouis_ has quit [Read error: 110 (Connection timed out)]
jlouis has quit [brown.freenode.net irc.freenode.net]
mwc has quit [brown.freenode.net irc.freenode.net]
neale has quit [brown.freenode.net irc.freenode.net]
petchema has quit [brown.freenode.net irc.freenode.net]
prince has quit [brown.freenode.net irc.freenode.net]
jdavis_ has quit [brown.freenode.net irc.freenode.net]
<AxleLonghorn> so, I'm looking at the manual
<AxleLonghorn> about the Str module
jlouis has joined #ocaml
mwc has joined #ocaml
neale has joined #ocaml
petchema has joined #ocaml
prince has joined #ocaml
jdavis_ has joined #ocaml
goalieca has quit ["Ex-Chat"]
<AxleLonghorn> and it says the function search_forward is regexp -> string -> int -> int.
<AxleLonghorn> however, the interpreter only asks for 1 int
seafood_ has joined #ocaml
<AxleLonghorn> am I missing something? or is the documentation off?
<AxleLonghorn> wait
<AxleLonghorn> nevermind
<AxleLonghorn> I'm crazy
* AxleLonghorn slaps forehead.
* AxleLonghorn forgot about the return type.
coucou747 has quit ["bye ca veut dire tchao en anglais"]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
Jedai has quit ["KVIrc 3.2.4 Anomalies http://www.kvirc.net/"]
<AxleLonghorn> does anyone know how OCaml's regular expression syntax works?
<pango> yes
jlouis has joined #ocaml
Jedai has joined #ocaml
<AxleLonghorn> I got started with Java's regexps
<AxleLonghorn> but I'm pretty sure it's not the same syntax
<AxleLonghorn> in Java, it'd be "[0-9]+|x|\(|\)"
<pango> there's a mathematical notion of regular expressions, but lots of different implementations in computing languages
<AxleLonghorn> can you translate?
jlouis_ has quit [Read error: 110 (Connection timed out)]
<pango> with Str, in a program source, I think it would translate to "[0-9]+\\|x\\|\\(\\|\\)"
<AxleLonghorn> why the double \\?
<pango> (Str syntax uses single \s, but since \s need to be backquoted in source, you get lots of pairs)
<flux> hm, does java have special regexp quoting support?
<AxleLonghorn> damn
<AxleLonghorn> thank you
<AxleLonghorn> well, in java atleast | don't need a \ in front of it
<AxleLonghorn> er, doesn
<AxleLonghorn> doesn't
<pango> see previous message
thelema has joined #ocaml
<pango> there's a pcre binding too (in fact I think there's several). it fixes several shortcomings of Str (for example non-thread safety), but the API is a bit more complex
catch22 has quit []
bluestorm has joined #ocaml
ciscbrain has joined #ocaml
marmottine has joined #ocaml
<flux> bluestorm, btw, there is a slight problem using for example @(): a@(1::[]) is already legal.. I suppose code using % that way would be quite a bit more rare, though
<bluestorm> :p
LordMetroid has joined #ocaml
seafood_ has quit []
thermoplyae has quit ["daddy's in space"]
Yoric[DT] has joined #ocaml
AxleLonghorn has left #ocaml []
seafood_ has joined #ocaml
bzren has joined #ocaml
ttamttam has joined #ocaml
Mr_Awesome has joined #ocaml
l_a_m has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
<bluestorm> the implementation is a bit acrobatic
<bluestorm> there may be a simpler way to do that, but at least it works :p
<bluestorm> i've kept the simple "_" idea
seafood_ has quit []
<bluestorm> i think that when you begin to specify locations with numbers, you quickly want real names instead, and then the slight syntaxic overhead of "fun ... ->" is worth the additional clarity
<bluestorm> (moreover, '_' looks nice, while '$1' is an ugly bashism)
<bluestorm> hm, got to go
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
ygrek has joined #ocaml
ita has joined #ocaml
coucou747 has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
<flux> bluestorm, surprisingly small
<flux> for me, atleast
Linktim_ has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
ciscbrain has quit []
Linktim- has joined #ocaml
authentic has joined #ocaml
ygrek has quit [Excess Flood]
ygrek has joined #ocaml
middayc has joined #ocaml
ttamttam has left #ocaml []
Jedai has quit [Read error: 104 (Connection reset by peer)]
olleolleolle has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
patraic has joined #ocaml
Linktim_ has joined #ocaml
hkBst has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Linktim- has quit [Read error: 110 (Connection timed out)]
authentic has left #ocaml []
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
LordMetroid has quit ["Leaving"]
Linktim- has quit [Read error: 110 (Connection timed out)]
evn has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
orbitz has quit ["moving PC"]
hkBst has joined #ocaml
thelema has joined #ocaml
marmottine has quit ["Quitte"]
middayc has quit []
bzren has quit ["Ex-Chat"]
hkBst has quit [Read error: 104 (Connection reset by peer)]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
thermoplyae has joined #ocaml
hkBst has joined #ocaml
pango has quit [Remote closed the connection]
<hcarty> bluestorm: What is the purpose of the pa_holes extension?
<bluestorm> hcarty: lighter lambda expressions
<bluestorm> (\ _ / 2 ) stands for (fun x -> x / 2)
<Smerdyakov> Why not follow Haskell and use (/ 2)?
<bluestorm> because it's difficult :]
<thelema> Smerdyakov: (\ Tag _)
<Smerdyakov> Actually, you're even doing the easy case/.
<Smerdyakov> Already expressible in standard OCaml with ((/) 2).
<bluestorm> hm
<bluestorm> nope, ((/) 2) is (\2 / _)
<Smerdyakov> Right, sorry.
<Smerdyakov> What makes the Haskell way hard?
<bluestorm> thelema: you can use (\ _.field) too
<thelema> bluestorm: yep.
<bluestorm> Smerdyakov: i'm using camlp4, and (with my limited knowledge) i can't implement that kind of things easily
<Smerdyakov> Peculiar... it seems trivial.
<bluestorm> i guess the difficulty there is to handle the binary operators in all generality
<Smerdyakov> Isn't there a token type for binary operators?
|Catch22| has joined #ocaml
<bluestorm> i don't think so
<bluestorm> let me check that
hkBst has quit [Read error: 104 (Connection reset by peer)]
pango has joined #ocaml
<bluestorm> i think there isn't, with camlp4 at least
hkBst has joined #ocaml
<bluestorm> one would have to add a set of specific rules for this construction
<bluestorm> but it doesn't seem difficult
<bluestorm> anyway Smerdyakov, pa_holes is more general than that (although i like this haskell syntax too)
<bluestorm> moreover, you can do things that really are not easy to do in a point_free style
<bluestorm> let array_of_string str = Array.init (String.length str) (String.get str)
<bluestorm> is (\ Array.init (String.length _) (String.get _))
Morphous has joined #ocaml
ofaurax has joined #ocaml
<thelema> bluestorm: no it's not.
<bluestorm> hmm
<thelema> (unless there's no support for (\ _ + _)
<bluestorm> (fun x -> x + x) ?
<thelema> fun x y -> x + y
<bluestorm> there is not support for that :)
<thelema> one hole per (\, I guess
<bluestorm> yes
<bluestorm> and i've seen no way to have a (fun x y -> x + y) by combining holes
<thelema> but even in the longer example, how much typing do you really save? And how much clarity do you lose?
Amorphous has quit [Read error: 110 (Connection timed out)]
<bluestorm> i don't think you lose clarity actually
<Smerdyakov> bluestorm, that last example is just ridiculous, as that's (+).
<bluestorm> of course
<bluestorm> but (fun y x -> x / y) may have been useful
<thelema> Okay, (fun acc rec -> acc + rec.number_field)
<bluestorm> (maybe you'll say that a "flip" combinator can do that as well)
<thelema> let (%&%) f y x = f x y ?
<bluestorm> thelema: i could do a numbered-hole thing, (\ $1 + $2.number_field), but _then_ you lose clarity and typing
<bluestorm> hm
<bluestorm> i'm not sure using an infix operator is such a good idea :p
<thelema> (/) %&% 24 6
<bluestorm> hmm
<bluestorm> i'd bet it doesn't work
<bluestorm> # (/) %&% 24 6;;
<bluestorm> This expression is not a function, it cannot be applied
<bluestorm> (underlining 24)
<bluestorm> of course ((/) %&% 24) 6 would work
<bluestorm> but flip (/) 24 6 seems better
<bluestorm> (and easier to read)
<bluestorm> and it's easier to partially apply it
<thelema> still intentionally misdirectional.
<bluestorm> (precisely because we can't do ((/) %&%) for now)
<bluestorm> hm, misdirectonal ?
<thelema> too confusing to reorder arguments this way -- labels better.
<bluestorm> labels are not that great when combined with partial application
<thelema> I'd say "better than this flip proposal"
<bluestorm> hm, maybe
<bluestorm> but i'm a bit annoyed that for example you can't compose labelled function in all generality (or can you ?)
AxleLonghorn has joined #ocaml
<ikatz> is the %&% syntax part of the pa_holes extension?
<bluestorm> isn't
<thelema> ? because labels get in the way of ...
<thelema> ikatz: I just made up the monstrosity called %&%
<ikatz> thelema: oh ok :)
<bluestorm> it's a standard ocaml infix operator :]
<thelema> bluestorm: you say that like it's part of the language. + is a standard ocaml infix operator. %&% is garbage
<bluestorm> right
<bluestorm> s/standard/legal/
<ikatz> yep... i see now
<thelema> better.
<bluestorm> btw, (\ f ~label:_ ) works
<bluestorm> looks like a not that bad compromise to make labelled functions composable
<neale> anybody want to lend a pair of eyes to critique some newbie code?
<thelema> neale: sure
<neale> I feel somewhat bewildered by the Ocaml/C interface
<neale> also I'm not very happy with the architecture of this implementation, but I figured I should start out simple.
<thelema> your enum that includes caml_POLLIN -- the values start at 0, no
<neale> yes, if you don't specify an inital value for an enum you get 0
<neale> I'll make that explicit, thanks.
<thelema> the caml values start at 1.
<neale> haha, really?
<neale> okay then ;)
<thelema> yup, 0 tags arrays and tuples
<neale> wait, are you sure?
<thelema> I'd be happy for someone else to confirm, but I'm pretty sure.
<neale> I thought I tested this and it was doing the right thing.
<neale> so I have this test code
<neale> open Poll
<neale> let _ =
<neale> poll [(0, [POLLIN; POLLOUT]); (1, [POLLIN; POLLOUT])] (100)
<neale> and strace gives:
<neale> poll([{fd=0, events=POLLIN|POLLOUT, revents=POLLOUT}, {fd=1, events=POLLIN|POLLOUT, revents=POLLOUT}], 2, 100) = 2
dabd has joined #ocaml
<neale> so I think it's 0-offset.
<mfp> tags start at 0, but if it's a constant constructor it's represented as a 31/63-bit integer, so in C you see Val_int(0) = 1
LordMetroid has joined #ocaml
<mfp> now, for block values, you'd get Tag_val(v) = 0
<neale> this is a variant
<neale> I'm not sure where they fall in.
<mfp> is it a Whatever of foo? if so, Tag_val applies
<neale> no, it's just a Whatever :)
<mfp> then it's represented as Val_int(0) = 1
<thelema> maybe it's only for whatever of foo that the counting starts at 1...
<neale> actually I'm doing Int_val(foo) and it appears to be returning 0.
<mfp> sure
<neale> okay that makes sense to me.
<mfp> Int_val(Val_int(0)) = 0
flux has quit [brown.freenode.net irc.freenode.net]
Morphous has quit [brown.freenode.net irc.freenode.net]
olleolleolle has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
rogo has quit [brown.freenode.net irc.freenode.net]
romanoffi has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
<neale> so you're saying I could skip Int_val if I give a 1 offset
Morphous has joined #ocaml
olleolleolle has joined #ocaml
coucou747 has joined #ocaml
rogo has joined #ocaml
guyzmo has joined #ocaml
flux has joined #ocaml
romanoffi has joined #ocaml
dwmw2_gone has joined #ocaml
Hadaka has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
<mfp> if you keep in mind that subsequent values increase by 2 ... ;)
<neale> I'll stick with Int_val then :)
<mfp> 1 3 5 = Val_int(0), ..., Val_int(2)
<neale> right, literals are packed into a word somehow
<mfp> # type t = A | B of int;;
<mfp> # Obj.tag(Obj.repr(B 1));;
<mfp> - : int = 0
<neale> I saw that, thought "crazy", and then resolved to try and not have to know about that until I was more comfortable writing C bindings.
<mfp> # (Obj.magic A : int);;
<mfp> - : int = 0
<mfp> Obj.tag is caml_obj_tag ->
<mfp> }else if (Is_young (arg) || Is_in_heap (arg) || Is_atom (arg)){
<mfp> return Val_int(Tag_val(arg));
<thelema> neale: your append function actually does prepend
<neale> haha
<neale> so it does.
<neale> prepend is simpler with cons cells.
<neale> I'll just rename it "cons" :)
<thelema> in C, you can cheat and do an actual append because the 'next' pointer is mutable
<thelema> I worry about "result = append(result,v)" Why aren't you returning v itself?
<thelema> oops, n/m
<thelema> so your return type is (fd * event list) list?
<neale> yes.
<neale> type event = POLLIN | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL
<neale> external poll : (Unix.file_descr * event list) list -> int -> (Unix.file_descr * event list) list
<neale> = "ocaml_poll"
Linktim has joined #ocaml
Linktim_ has joined #ocaml
jlouis has joined #ocaml
flux has quit [brown.freenode.net irc.freenode.net]
Linktim has quit [brown.freenode.net irc.freenode.net]
romanoffi has quit [brown.freenode.net irc.freenode.net]
rogo has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
olleolleolle has quit [brown.freenode.net irc.freenode.net]
Morphous has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
Linktim has joined #ocaml
Morphous has joined #ocaml
olleolleolle has joined #ocaml
coucou747 has joined #ocaml
rogo has joined #ocaml
guyzmo has joined #ocaml
flux has joined #ocaml
romanoffi has joined #ocaml
dwmw2_gone has joined #ocaml
Hadaka has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
Linktim has quit [Connection timed out]
flux has quit [brown.freenode.net irc.freenode.net]
romanoffi has quit [brown.freenode.net irc.freenode.net]
rogo has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
olleolleolle has quit [brown.freenode.net irc.freenode.net]
Morphous has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
delamarche has joined #ocaml
Morphous has joined #ocaml
olleolleolle has joined #ocaml
coucou747 has joined #ocaml
rogo has joined #ocaml
guyzmo has joined #ocaml
flux has joined #ocaml
romanoffi has joined #ocaml
dwmw2_gone has joined #ocaml
Hadaka has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
olleolleolle has quit []
flux has quit [brown.freenode.net irc.freenode.net]
romanoffi has quit [brown.freenode.net irc.freenode.net]
rogo has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
Morphous has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
olleolleolle has joined #ocaml
Morphous has joined #ocaml
coucou747 has joined #ocaml
rogo has joined #ocaml
guyzmo has joined #ocaml
flux has joined #ocaml
romanoffi has joined #ocaml
dwmw2_gone has joined #ocaml
Hadaka has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
Linktim- has joined #ocaml
LordMetroid has quit ["Leaving"]
TheLittlePrince has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
seafood_ has quit []
Linktim_ has joined #ocaml
TheLittlePrince has quit [Client Quit]
cygnus_ has quit [Read error: 110 (Connection timed out)]
mpc has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
cygnus_ has joined #ocaml
Linktim_ has quit [Remote closed the connection]
olleolleolle has quit []
ita has quit [Read error: 104 (Connection reset by peer)]
goalieca has joined #ocaml
dwmw2_gone is now known as dwmw2_GVA
middayc has joined #ocaml
dwmw2_GVA is now known as dwmw2_AVF
ofaurax has quit ["Leaving"]
bluestorm has quit [Remote closed the connection]
Mr_Awesome has quit ["aunt jemima is the devil!"]
mpc has quit []
mpc has joined #ocaml
mpc is now known as wennefer
wennefer has quit [Client Quit]
mpc has joined #ocaml
mpc has quit [Client Quit]
mpc has joined #ocaml
ita has joined #ocaml
mpc has quit [Client Quit]
Yoric[DT] has quit ["Ex-Chat"]
mpc has joined #ocaml
evn has quit []
dwmw2_AVF is now known as dwmw2_gone
evn has joined #ocaml
LordMetroid has joined #ocaml
LordMetroid has quit ["Leaving"]
ygrek has quit [Remote closed the connection]
AxleLonghorn has left #ocaml []
ita has quit ["Hasta luego!"]
l_a_m has quit [Remote closed the connection]
mwc has left #ocaml []