<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>
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