<alexyk>
the folks at c++ have a robot parsing it; would be cool to put an ocaml robot here... we could call it Xav :) Then you'd say, xav: let a = 1;; -- and it'll print the result... May combine with codepad.org which evals already
alexyk has quit []
alexyk has joined #ocaml
<alexyk>
actually, we can just call it caml
alexyk has quit [Client Quit]
alexyk has joined #ocaml
<flux>
alexyk, or maybe it could be called xavierbot..
<alexyk>
is it there already? :)
<flux>
it has been at times
<alexyk>
so did it retire?
<flux>
I guess nobody just isn't running it regularly. also, there were some issues with unintentional activation.
* alexyk
runs out
alexyk has quit []
<flux>
could be fixed with required addressing; it was activated (iirc) with the prefix #
<rwmjones>
flux, patch me baby
petchema__ has joined #ocaml
<flux>
rwmjones, where's the git/darcs repo?-)
<rwmjones>
flux, it's umm nowhere ...
<rwmjones>
actually gildor ^^ ?
petchema_ has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Camarade_Tux has quit [Remote closed the connection]
Camarade_Tux has joined #ocaml
jeremiah has joined #ocaml
middayc_ has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
ygrek_ has joined #ocaml
willb has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<robocop>
It the first time that i'm using regex, and I've got a problem. I would like replace "5+(-2)" by 5+-2
noshadow has left #ocaml []
<robocop>
I write : let f = Str.regexp ".*([+|-]?[0-9]+).*" ;;
<robocop>
and Str.global_replace f "5+(-2)" "\0";; to test.
<robocop>
but i've got : Warning X: illegal backslash escape in string.
<robocop>
- : string = "\\0"
<robocop>
I've you got an idea ?
<Optikal_>
Are you using regex for symbolic manipulation??
_zack has quit ["Leaving."]
<robocop>
what ?
<Yoric[DT]>
robocop: I believe you should use "\\0".
<robocop>
Yoric[DT]: yes, but now, i've got string = "\\0"; and me, i want "5+".
<Yoric[DT]>
Oh, you only want to replace the last occurrence, is that it?
<Yoric[DT]>
Sidenote: I believe I agree with Optikal_'s unsaid suggestion: regexpes are often evil.
<robocop>
Hum, ok.
<robocop>
And, what to you use to replace "-5-2+(-2)+3" by "-5- 2+-2+3"
<robocop>
?
<vixey>
robocop, what's the program for?
<Yoric[DT]>
Frankly, I'd first parse the string and then proceed to rewriting the AST.
<Yoric[DT]>
Just to be sure I'm not bitten by some corner case.
<robocop>
vixey: is for a a lexer. Genlex has got a problem with operator "-" because it replace -x by the integer -x and not by then operator - and the number x.
<vixey>
yeah
<vixey>
you are doing this wrong
<vixey>
make a better lexer
<vixey>
then you don't have to use regex
* Yoric[DT]
agrees with vixey.
<vixey>
isn't camllex suitable?
<Yoric[DT]>
And to write a lexer, you may use regexps, but that's as far as it goes.
<Yoric[DT]>
Don't rewrite your original string, you're going to get bitten sooner or later.
<robocop>
Hum, okey.
<robocop>
thanks for you reponses.
<robocop>
*answers, sorry.
<Yoric[DT]>
:)
fred12 has joined #ocaml
fred12 is now known as cgizmo
jeremiah has quit [Read error: 104 (Connection reset by peer)]
harlos has quit [Read error: 104 (Connection reset by peer)]
<robocop>
While we're at it, lets solve my problem : i would like to get the tokens from the regex matched string. Example :
<robocop>
regex. Exemple : let f = Str.regexp "[0-9]+" ;;
<robocop>
Str.global_replace f "a56" "what should i put there to return 56";;
<robocop>
?
<Yoric[DT]>
It's not global_replace.
<Yoric[DT]>
It's string_match followed by matched_string.
<Yoric[DT]>
And yes, it's ugly.
<robocop>
Hum, okey, thanks you :).
hjpark has joined #ocaml
<hjpark>
is this code safe ? "let input = ref "" in input := read_line ();"
<flux>
safe in what sense?
<Camarade_Tux>
match and use 'Str.matched_string "a56"' ?
<Camarade_Tux>
or Str.global_replace (Str.regexp "[^0-9]+") "a56" ""
<hjpark>
the problem kind of illegal memory access
<flux>
all ocaml code is safe, barring the use of explicitly unsafe functions
<hjpark>
oh
<flux>
I'm not sure what happens if it receives a string larger than 16 megabytes on a 32-bit platform
<flux>
I would expect an exception
<Camarade_Tux>
let's try :)
<hjpark>
input is refer to "" string.
<hjpark>
and input := something -> change "" right?
<flux>
hjpark, ah, well it doesn't actually change the string ""
jeremiah has joined #ocaml
<flux>
hjpark, it creates a new string and replaced the reference in input to point to that new stirng
<flux>
the old empty string is garbage collected
<hjpark>
oh..
<hjpark>
flux: i got it. thx :)
<flux>
in general it cannot do what you're thinking as you are not passing input as a parameter to read_line
<flux>
on another level, references don't copy anything
<flux>
(well, they do copy the pointer, but that's it)
<hjpark>
kinda java ref style
<hjpark>
i solving ACM problem by ocaml, and ocaml is very powerful :)
Camarade_Tux_ has joined #ocaml
Camarade_Tux__ has joined #ocaml
<Camarade_Tux__>
(third try) in case it did not get through, trying to read a 135MB string on 32bit results in : Exception: Invalid_argument "String.create"
Camarade_Tux_ has quit [Read error: 104 (Connection reset by peer)]
Camarade_Tux has quit [Read error: 113 (No route to host)]
Camarade_Tux__ is now known as Camarade_Tux
alexyk has joined #ocaml
Camarade_Tux_ has joined #ocaml
olgen has joined #ocaml
itewsh has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
cgizmo has quit ["ChatZilla 0.9.84 [Firefox 3.0.4/2008111319]"]
alexyk has quit []
<Yoric[DT]>
hjpark: yes, references are more or less equivalent to non-final Java references.
<flux>
hjpark, there is a pitfall compared to java, though: strings are mutable
<hjpark>
oh, that's interesting.
alexyk has joined #ocaml
<Yoric[DT]>
There are notions of immutable strings around but the default string type is mutable.
<Yoric[DT]>
That's something most people believe is an error but it remains for historic purposes.
willb2 has quit ["Leaving"]
<flux>
it would be cool if there were phantom-typed mutable and immutable strings.
<Yoric[DT]>
String.Cap, in Batteries :)
<flux>
batteries documentation is too difficult to google :)
<flux>
yoric[dt], would it break stuff string was redefined to be [< `Read | `Write] String.t?
<flux>
+if
<flux>
I suppose it wouldn't work with other, non-batteries, libraries anymore..
<Yoric[DT]>
Yeah.
alexyk has quit []
olgen has quit []
olgen has joined #ocaml
asabil has joined #ocaml
love-pingoo has joined #ocaml
<flux>
is it really as efficient as String?
Kopophex has joined #ocaml
itewsh has quit ["KTHXBYE"]
<flux>
it doesn't provide the unsafe variants of string indexing
jeremiah has quit [Read error: 104 (Connection reset by peer)]
robocop has left #ocaml []
Stefan_vK1 has joined #ocaml
Gionne has quit ["Leaving"]
jeremiah has joined #ocaml
alexyk has joined #ocaml
<alexyk>
the difference with #c++: I never saw the word "bullshit" here yet :)
<alexyk>
even ocaml traders are more polite than c++ traders
<Optikal_>
ocaml traders?
<alexyk>
optikal: type ocaml in google, then read the AdSense Ad
<Optikal_>
Oh, Jane Street
<hcarty>
alexyk: To be fair, we do have our share of trolls... but the community around OCaml tends to be quite pleasant
<hcarty>
"we" being the folks in #ocaml and on the mailing lists. And the library authors I've dealt with.
<alexyk>
hcarty: this is the most pleasant channel in fact, so far -- and the right size; look as Haskell and C++ scroll by, too crowded; and postgresql has 2,500 messages today -- those DBAs have not much else to do, clearly :) here's size to stay coherent enough
<Optikal_>
All OCaml trolling is done in french
<Optikal_>
=)
<alexyk>
optikal: :)
<Yoric[DT]>
flux: indeed.
<Camarade_Tux_>
Optikal_, nah, don't forget Jon Harrop ;)
<Optikal_>
Votre compilateur pue!
<Optikal_>
Camarade_Tux: I just sent him money
<Optikal_>
talk about feeding the trolls
<Optikal_>
oh well
<alexyk>
Jon Harrop is cool, he only teases Lispers
Stefan_vK has quit [Read error: 110 (Connection timed out)]
* alexyk
wonders what pue means
<Camarade_Tux_>
stinks
<alexyk>
lol
* alexyk
must not go to #c++ and say "votre langue pue"
<alexyk>
google translate: your language sucks big time => votre langue sucks grand temps
jlouis has joined #ocaml
<Yoric[DT]>
Well, that's a tad too literal :)
<Optikal_>
that would involve Big Ben and a vaccum cleaner
<alexyk>
yoric[dt]: what's the closest correct translation?
<Yoric[DT]>
Optikal_: indeed :)
<Optikal_>
votre langue suce beaucoup
<Optikal_>
perhaps
<alexyk>
google translate: s/sucks/stinks/ => votre langue pue gros temps
<alexyk>
is suce as widespread as sucks in colloquial French?
<Yoric[DT]>
Not that much.
<Yoric[DT]>
"pue" would be better
<Yoric[DT]>
But I can't think of any colloquial manner of translating "big time" in that context.
<Optikal_>
"big time" basically means "alot"
* alexyk
wished he learned French to debate French intellectuals in the cafés of Paris
<Optikal_>
No you don't
<hcarty>
Yoric[DT]: Has a decision been made on the hierarchy in Batteries?
<Optikal_>
french intellectuals have a tendency towards postmodernist gibberish
<Yoric[DT]>
:)
<Yoric[DT]>
hcarty: not really.
<alexyk>
optikal: that's the fun part :) and they're paid to do that
<Yoric[DT]>
I guess we're going to go for the non-hierarchy "by default".
<flux>
I guess there are no technical reasons to prefer the hierarchy?
<Yoric[DT]>
Neither choice seems to have any direct technical implications.
<Yoric[DT]>
Hierarchy makes for programs that are a few lines shorter, while non-hierarchy makes sure that we're less likely to end up with module clashes in Batteries.
<Yoric[DT]>
But that's about it.
Kerris7_ has joined #ocaml
<flux>
hierarchy might make a some programs shorter, but others longer?
<Yoric[DT]>
Longer?
<Yoric[DT]>
How so?
<Yoric[DT]>
Sorry, I meant "shorter".
<hcarty>
Yoric[DT]: I would think it would be the other way around? How does the non-hierarchy lead to fewer module clashes?
<flux>
hmm, I'm confused. was the line explaining the difference what you meant?-)
willb has joined #ocaml
<Yoric[DT]>
hcarty: no, I maintain that part.
<Yoric[DT]>
flux: I meant "sorter? how so?"
<flux>
"Hierarchy makes for programs that are a few lines shorter"
<flux>
I'm just responding to what you said
<flux>
you're wondering how hierarchy makes programs shorter although you just said it does?
<hcarty>
Yoric[DT]: That's fine by me - I just don't see how?
<Yoric[DT]>
Oh, sorry, I mixed hierarchy and non-hierarchy.
<Yoric[DT]>
hcarty: sorry, I mixed there, too.
<Optikal_>
?!@#
* Yoric[DT]
might need to catch back on some sleep.
<Yoric[DT]>
Optikal_: yourself.
<hcarty>
Yoric[DT]: Ah, ok. That makes sense
<hcarty>
Lack of sleep can do that to a person :-)
<flux>
well, hierarchy likely leads to people using module aliases, which can reduce code readability
<flux>
because people always pick different aliases :)
<flux>
short but to-the-point names may allow using the original names. it might result in a larger source file, but in the end it might be more usable
<Optikal_>
Just assign each module it's own punctuation symbol
<flux>
I never alias the module List, for example
<Yoric[DT]>
:)
<Optikal_>
its
Kerris7 has quit [Read error: 60 (Operation timed out)]
<flux>
but, off to sleep
<Optikal_>
David's <-- Possessive. It's <-- It is
<Optikal_>
I hate english
<Yoric[DT]>
flux: that's true.
<hjpark>
how to compile with other module?
<hjpark>
i use str.cma
<hjpark>
when i run the ml program with ocaml blah.ml with #load "str.cma", it works
<hjpark>
but, how can i compile with str.cma
<Yoric[DT]>
Add str.cma before your .ml in the command-line.
<Yoric[DT]>
ocamlc str.cma foobar.ml
<hjpark>
oh "before"
<hjpark>
i do ocamlc foobar.ml str.cma
<hjpark>
haha..
<hjpark>
thx
<Yoric[DT]>
no
<Yoric[DT]>
np
mbishop__ is now known as mbishop
ygrek_ has quit [Remote closed the connection]
ikaros has joined #ocaml
sporkmonger has quit []
middayc has joined #ocaml
seafood has joined #ocaml
<vixey>
something like No rule to make target `lib/compat.ml4.ml.d', needed by `lib/compat.cmo'. Stop.
<vixey>
is nonsense, right?
<vixey>
because nothing will be ml4.ml.d, or could it?
<Yoric[DT]>
I strongly doubt anything would have that kind of extension.
middayc_ has joined #ocaml
<alexyk>
optikal: pue beats its every time :)
<Camarade_Tux_>
something's annoying me with my webkit-gtk bindings =/
<Camarade_Tux_>
and I'm starting to wonder how they could work
middayc has quit [Read error: 110 (Connection timed out)]
apples` has joined #ocaml
<Camarade_Tux_>
I thought I was lucky they worked
<Camarade_Tux_>
actually I was extremely lucky they worked ;)
Camarade_Tux_ is now known as Camarade_Tux
<alexyk>
while I'm in the French study mode: so a prpogramming language is "langage", as opposed to human "langue"?
<Camarade_Tux>
'langue' is tongue ; 'langage' is language
<Camarade_Tux>
you can translate directly to langage/langue, with the correspondance I gave, there's no catch, it's really a direct translation in that case
<alexyk>
ok; Weis/Leroy book is called "La Langage Caml," so I assume langage is the right one
petchema__ has quit [Read error: 113 (No route to host)]
ikaros has quit [".quit"]
sporkmonger has joined #ocaml
<Camarade_Tux>
alexyk, in this case, yes ;)
ppsmimou has quit [Read error: 60 (Operation timed out)]
Kerris7_ has quit []
ppsmimou has joined #ocaml
alexyk has quit []
<Yoric[DT]>
Well, time to catch some of that sleep.
<Yoric[DT]>
Cheers everyone.
Yoric[DT] has quit ["Ex-Chat"]
hkBst has quit [Read error: 54 (Connection reset by peer)]
marmotine has quit ["mv marmotine Laurie"]
Kerris7 has joined #ocaml
<hjpark>
is there any math library in ocaml?
<hjpark>
kinda sine cosine,
<hjpark>
oh, i got it. sorry :)
jeddhaberstro has joined #ocaml
<vixey>
what's pa_ifdef.cmo?
<vixey>
I'm sure I heard someone here talking about pa before
<Smerdyakov>
That's just the convention for prefixing camlp4 filenames.
olgen has quit []
willb has quit [Read error: 60 (Operation timed out)]