<chessguy>
i'm not sure i've wrapped my mind around the idea of functional programming yet
<chessguy>
it seems to me it requires a completely different way of thinking about programming, though i could be wrong
m3ga has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- 100,000+ downloads can't be wrong"]
m3ga has quit ["disappearing into the sunset"]
JKnecht has joined #ocaml
ski has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit ["Leaving"]
ski has joined #ocaml
cfkklwww has joined #ocaml
cfkklwww has left #ocaml []
m3ga has joined #ocaml
khaladan has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
love-pingoo has joined #ocaml
Revision17 has joined #ocaml
revision17_ has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
Schmurtz has joined #ocaml
slipstream has joined #ocaml
permanente is now known as profmakx
slipstream-- has quit [Read error: 110 (Connection timed out)]
rillig has joined #ocaml
mikeX has joined #ocaml
smimou has joined #ocaml
Bigb[a]ng is now known as Bigbang
_JusSx_ has joined #ocaml
ramki has quit [Read error: 110 (Connection timed out)]
<_JusSx_>
hi ocaml ppl
<ketty>
hello _JusSx_
mikeX has quit ["bye"]
<love-pingoo>
is there a way to group without naming with OCaml's standard regexps (Str) ?
<pango>
if there is, it's not documented
<ketty>
hey, do people consider ocaml to be good or bad to write gui in?
<love-pingoo>
I couldn't give a good advice
<love-pingoo>
BUT I HATE OCAML REGEXPS
<love-pingoo>
actually I only wrote one simple gui in OCaml, all I can say is that lablgtk is poorly documented
<love-pingoo>
I was much more productive with pyGtk, despite the problems inherent to python
<ketty>
i am currently translating a gtk2-gui written in C into ocaml/lablgtk2...
<ketty>
at least, compared to C lablgtk2 rokks :)
Smerdyakov has joined #ocaml
<love-pingoo>
let re = Str.regexp "\\(a\\(a+\\)a\\|\\(\\(b+\\)\\)\\)"
<love-pingoo>
Str.string_match re "bb" 0
<love-pingoo>
and the matched_groups are ... [(1, "bb"); (0, "bb")]
<flux__>
love-pingoo, btw, there is a cool module for pcre that allows you to write regular expression matches much more neatly..
<love-pingoo>
whereas I explicitely put an extra grouping to get my result in \2 in either cases
<love-pingoo>
flux__: I know but I'd like to avoid the dependency, since I need only a small (but tricky) function
<flux__>
go for the dependency ;)
<flux__>
just to give an idea to others who may not be familiar with it: let separate s = Regexp.match s with | "^(.*/)?([^/]*?)(\.[^.]*)?$" as dir, file, extension -> coalesce [dir; Some ""], file, coalesce [extension; Some ""] | _ -> raise (Invalid s)
<flux__>
(separates a file name into path, name and extension)
<flux__>
((coalesce is a function that returns the first Some of given list unoptionified))
<ketty>
dont you have to do "\\." instead of "\." ?
<flux__>
I'm pretty sure that has worked :)
<flux__>
the failure should be pretty evident :)
<ketty>
# "\.";;
<ketty>
Warning X: illegal backslash escape in string.
<ketty>
you don't get that?
<flux__>
it's a language extension
<flux__>
it can override some rules
<ketty>
nice :)
<pango>
love-pingoo: groups are numbered after their position in the regexp, not after the "patch" that led to the successful match
<pango>
s/patch/path/
<pango>
# Str.matched_group 3 s ;;
<pango>
- : string = "bb"
<pango>
# Str.matched_group 4 s ;;
<pango>
- : string = "bb"
<love-pingoo>
pango: in my case the first group was "bb"
<love-pingoo>
which isn't consistent with your explanation
<pango>
I don't know what group #0 is
<love-pingoo>
I'm afraid the behaviour isn't consistent with anything :p
<love-pingoo>
pango: 0 is for the whole matched string
<pango>
ok
<pango>
then group #n is the group that starts with the nth \( in the regexp
<love-pingoo>
# let re = Str.regexp "\\(a\\(a+\\)a\\|\\(\\(b+\\)\\)\\)" ;;
<love-pingoo>
val re : Str.regexp = <abstr>
<love-pingoo>
# Str.string_match re "bb" 0 ;;
<love-pingoo>
- : bool = true
<love-pingoo>
# Str.matched_group 1 "bb" ;;
<love-pingoo>
- : string = "bb"
<love-pingoo>
# Str.matched_group 2 "bb" ;;
<love-pingoo>
Exception: Not_found.
<love-pingoo>
# Str.matched_group 3 "bb" ;;
<love-pingoo>
- : string = "bb"
<love-pingoo>
# Str.matched_group 4 "bb" ;;
<love-pingoo>
- : string = "bb"
<love-pingoo>
...sorry for the flood
<flux__>
just avoid the Str-module, it's evil ;(
<love-pingoo>
pango: you're right, except that the first group should be "" or Not_found
<flux__>
I've been bitten twice by it
<love-pingoo>
flux__: I'd expect it to be heavy and un-convenient
<love-pingoo>
but it's even inconsistent :(
<love-pingoo>
:))
<pango>
the first group is the same as the group 0, since you embedded your whole regexp in a group
<flux__>
once by the fact that it uses global state and once by that the functions that seem like thread-safe, aren't
<love-pingoo>
pango: oops, sorry, I had forgotten the external group !
<love-pingoo>
shame on me
<love-pingoo>
the non-thread-safe issue will eventually bit me too :(
<flux__>
and it's a devil to find, too
<flux__>
fortunately I ran the software with OCAMLRUNPARAM=b
<flux__>
and noticed the problem of a thread dying
<love-pingoo>
you were lucky that it died
<love-pingoo>
could have kept running with a faulty match
<flux__>
yeah
<pango>
flux__: did you report the bug ? At very least, there should be a warning in the doc
<pango>
the problem is that it's a design error :/
piggybox has quit [" HydraIRC -> http://www.hydrairc.com <- IRC for those that like to be different"]
khaladan has quit [Read error: 104 (Connection reset by peer)]
Tachyon76 has joined #ocaml
<love-pingoo>
ok I give up
<love-pingoo>
what's the wonderful URL for ocaml regexps ?
<love-pingoo>
should I go for the camlp4 extension or the pcre lib ?
* ketty
is allready hooked by the camlp4 extension without ever using it :)
piggybox has joined #ocaml
<zmdkrbou>
love-pingoo: pcre is probably easiest for you :)
<love-pingoo>
I think so, I don't want to make the building of liquidsoap too heavy
<love-pingoo>
bothering with camlp4 params in my makefile system, and so on
<love-pingoo>
but of course the gentoo package for pcre-ocaml is late :(
<ketty>
you could allways use godi...
Schmurtz has quit [Read error: 113 (No route to host)]
<love-pingoo>
that's right, but I still have got very much into that yet
* ketty
very much like godi :)
<love-pingoo>
I made a parallel installation of some ocaml packages using godi, them more or less forgot about them
Tachyon76 has quit ["Leaving"]
<zmdkrbou>
mattam: ping
<ulfdoz>
apropos parallelism: Is there any support for distributed/parallel computing in ocaml?
<ulfdoz>
Or is everything to do by hand (locking, communication, scheduling)....
<smimou>
theres a biding for mpi I think
<smimou>
+'+n
<ulfdoz>
C with mpi sucks. If it compiles it usually doesn't run well or long or is simply buggy. ;)
<pango>
jocaml ?
<ulfdoz>
I remember spending several hours on finding the node, which caused the segfault (was a hpc-line cluster and the error didn't occur with 4 or less nodes).
<smimou>
pango: jocaml is quite dead for now
<Smerdyakov>
ulfdoz, you can use Concurrent ML (Event module) to provide a good interface for distributed operations.
<pango>
yes, I know
<smimou>
but I think there's some kind of underground revival
<smimou>
I've seen some postdoc job offers to make an up-to-date version of jocaml
<ulfdoz>
cool, even part of sml.
permanente has joined #ocaml
chessguy has joined #ocaml
<ketty>
using Obj.magic () as a dummy value when you are prototyping is a very bad idea =)
<pango>
yes, it sometimes fizzles
profmakx has quit [Read error: 113 (No route to host)]
<chessguy>
would it be fair to say that functional programming supports a more top-down approach than, say, imperative programming?
<pango>
top-down sucks
<chessguy>
that's not quite what i asked, but what would you prefer?
<pango>
bottom-up, that usually helps writing reusable code
<ketty>
chessguy: functional programming helps you to abstract away everything that's not important.
<chessguy>
how?
<chessguy>
sorry, i'm still trying to get my mind around the necessary change in thinking to do functional programming
<ketty>
it makes it very easy to write abstract data types..
<ketty>
so instead of manipulating concrete data
<ketty>
you deal with more abstract data...
<ketty>
and you can define how it is manipulated in an abstract way :)