<kig>
returns the last index of the match, which is quite useless
Associat0r has joined #ocaml
Palace_Chan has joined #ocaml
kelaouchi has quit [Client Quit]
nimred has joined #ocaml
<sgnb>
kig: what would you expect?
<kig>
i should make it return the first index of the match as well, by carrying the start index in the state list
nimred has quit [Client Quit]
<kig>
and then make execute_nfa take the starting index and that gives find_all_indexes, extract_matches, split, replace
kelaouchi has joined #ocaml
Associat0r has quit [Connection reset by peer]
Associat0r has joined #ocaml
ched has joined #ocaml
kelaouchi has quit [Client Quit]
kelaouchi has joined #ocaml
kelaouchi has quit [Client Quit]
kelaouchi has joined #ocaml
Stefan_vK1 has joined #ocaml
kelaouchi has quit ["leaving"]
Stefan_vK has quit [Read error: 110 (Connection timed out)]
kelaouchi has joined #ocaml
ikaros has joined #ocaml
slash_ has joined #ocaml
Axioplase is now known as Axioplase_
Axioplase_ has quit [Read error: 104 (Connection reset by peer)]
buzz0r has joined #ocaml
<buzz0r>
Anyone ever used p2caml for creating a Python module in ocaml? (or Pycaml) I have nooooooo idea how to do this, since there is a big lack of documentation for it. Maybe someone else tried it alrady?
pierre- has quit [Read error: 110 (Connection timed out)]
buzz0r_ has joined #ocaml
<buzz0r_>
Anyone ever used p2caml for creating a Python module in ocaml? (or Pycaml) I have nooooooo idea how to do this, since there is a big lack of documentation for it. Maybe someone else tried it alrady?
<buzz0r>
oh sry!
Palace_Chan has quit ["Palace goes to sleep"]
buzz0r has quit ["Ex-Chat"]
buzz0r_ has quit ["Ex-Chat"]
buzz0r has joined #ocaml
hkBst has joined #ocaml
kelaouchi has quit ["leaving"]
kelaouchi has joined #ocaml
avsm has joined #ocaml
Camarade_Tux has joined #ocaml
Proteus_ has quit [Read error: 110 (Connection timed out)]
ikaros has quit [".quit"]
Snark has joined #ocaml
seafood has joined #ocaml
avsm has quit []
pango has joined #ocaml
seafood has quit []
<slash_>
is there a way to convert a builtin float into a builtin int
<slash_>
?
<ttamttam>
truncate
<ttamttam>
float_of_int
<ttamttam>
int_of_float
<slash_>
thank you
<ttamttam>
;-)
_dez has joined #ocaml
mattc58 has joined #ocaml
munga_ has joined #ocaml
avsm has joined #ocaml
love-pingoo has joined #ocaml
kelaouchi has quit ["leaving"]
kelaouchi has joined #ocaml
Snark has quit ["Ex-Chat"]
thelema has quit [Read error: 110 (Connection timed out)]
Waleee has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
willb has joined #ocaml
s4tan has joined #ocaml
|jeremiah has joined #ocaml
willb has quit [Read error: 60 (Operation timed out)]
buzz0r has quit ["Ex-Chat"]
Associat0r has quit [Connection timed out]
willb has joined #ocaml
vuln has joined #ocaml
Cheshire has joined #ocaml
<slash_>
is there acutally a way to increment a var in ocaml?
<Cheshire>
yes
<slash_>
(which isn't a reference)
<Cheshire>
no
<love-pingoo>
let x = x+1 in ...
<love-pingoo>
but it's not incrementing the variable per se
<love-pingoo>
although it might be what you're looking for
<slash_>
well i cannot use 'in' in my case
<slash_>
i have a loop
<love-pingoo>
then you're really thinking of incremening in place
<love-pingoo>
either break the loop into a recursive function and pass the state as argument, or use a reference
<slash_>
i'll go for a reference
<love-pingoo>
the first choice can be much more efficient with the ocaml compiler
<Cheshire>
slash_, you could pass parameters instead of have a single reference in scope sometimes
<Cheshire>
so instead of ...; loop you can do ...; loop (iteration + 1)
tab_ is now known as tab
<Cheshire>
I hope that makes sense
<slash_>
wait, is loop some function/keyword?
<slash_>
i was talking about a while-loop
<Cheshire>
slash, loop being the name of a function
<slash_>
ahh
<Cheshire>
you can use a local function called loop instead of a while loop
<slash_>
well, that could work
<kig>
instead of while (foo) { foo = f (); } -> let rec aux f foo = if not foo then () else aux f (f foo)
pango has quit [Remote closed the connection]
<tab>
love-pingoo: do you have some benchmarks for your statement ? (recursive function faster than while loop)
<love-pingoo>
tab: I did some several times, but have none available
<love-pingoo>
but just compute the factorial, or fibonacci, using a while, a loop, and a tail-recursive loop, and it will show
<love-pingoo>
(don't bother about the result of fact being 0 for high values, just look at the computation time)
<hcarty>
rwmjones: ping
<love-pingoo>
jhamza: ocaml is such that every reference assignment is costly (for the GC) and it optimizes very well (recursive) functions
<jhamza>
love-pingoo: so ?
<jhamza>
actually this code gives false ; my mistake
jeddhaberstro has joined #ocaml
<love-pingoo>
jhamza: so, that's two good reasons for prefering functions for loops if you want efficiency
<love-pingoo>
ocaml is biased towards it
<kig>
http://gist.github.com/58809 the asm doesn't seem to differ all that much, except that recursion is jumpier
<jhamza>
love-pingoo: i don't really understand what you mean ; what would you have written ?
<kig>
(which might be just me writing the aux less optimally)
pango has joined #ocaml
<jhamza>
and instead of what ?
<love-pingoo>
well, that may not be a good example, maybe I was just thinking loop versus tail-rec loop
<love-pingoo>
kig: when you run them, how do they compare
<love-pingoo>
?
<kig>
jhamza: i think love-pingoo is talking to tab or someone else
* love-pingoo
not so good at reading assembly
<kig>
love-pingoo: well, the way the assembly might compare
<kig>
aaa
<love-pingoo>
jhamza: oh yeah, sorry, I meant tab:
<love-pingoo>
:)
<kig>
neither has indirection and both have about the same amount of instructions
<jhamza>
love-pingoo: ok :)
<kig>
the recursive version has two jumps per iteration, the iterative only one but i don't know how much difference that makes
<love-pingoo>
yeah, they seem very similar
<love-pingoo>
I think that when you do an assignment r := v, ocaml has to walk through v, which is nothing for an int, but becomes significant with large datastructures
caligula__ has quit [Read error: 104 (Connection reset by peer)]
caligula__ has joined #ocaml
s4tan has quit []
thelema has joined #ocaml
sporkmonger has joined #ocaml
Stefan_vK has joined #ocaml
<flux>
nope
<flux>
it just makes r point to v
<flux>
no walking is done
<flux>
I think the only case when ocaml walks some data structure without explicit code is (=)
<love-pingoo>
flux: there is something with the garbage collector, to update old/new generations
<kig>
jhamza: that code you pasted returns false here
<flux>
well yeah, gc does quite a bit of walking
<flux>
ah
<flux>
that was what you were talking about :-)
<flux>
now that I look back for reference :)
<love-pingoo>
I'm trying to find some detailed doc about that, but if doing x:=v does require walking through v, it sucks for many algorithms
<flux>
well, it wouldn't do it immediately
<flux>
wouldn't that imply let rec loop n l = if n < 1000 then loop (n + 1) (n::l) else l would also behave inefficiently
<love-pingoo>
flux: walking through an int can easily be optimized
<flux>
I would actually just expect that GC walks over mostly everything every now and then, but then again, I haven't really taken a look how GCs are written
<love-pingoo>
even if it's postponed, it has to be done before any other gc operation
<love-pingoo>
i'm not an expert either, but I heard it from two gurus, and it once optimized my code a lot
<flux>
isn't that why they say it's bad to have a GC'd process larger than physical memory - GC is going to kill it with virtual memory IO?
<flux>
you can do explicit GCing and dump the related counters to inspect its behavior
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
tar_ has joined #ocaml
<tar_>
If I have a language I know is type-safe, is there any way I can use that to write an interpreter in OCaml for it that doesn't need (match v with IntData i -> ... | _ -> raise "impossible!") in the interpretation loop?
<Cheshire>
tar_, if you just omit the _ -> raise ... case?
<tar_>
Similarly for the stack.. you know it won't be empty when you need a value from it, but you can't avoid having to pattern match it before taking off a value
munga_ has quit ["Ex-Chat"]
<tar_>
Cheshire: There are plenty of data types that it could be, but there's only one that it will be when executing
<Cheshire>
tar_, if you want it statically verified that the program is total I think you would use a stronger type system such as Coq (to rule out impossible cases)
<tar_>
write an interpreter in coq?
jonafan_ has joined #ocaml
<Cheshire>
tar_, If I understood you correctly yes
jonasb has joined #ocaml
jonafan has quit [Read error: 60 (Operation timed out)]
<love-pingoo>
Cheshire: I think tar_ wants to get rid of variants
jlouis has quit ["Lost terminal"]
<Cheshire>
oh ok
<Cheshire>
I thought it was the impossible case
smimram has quit ["bli"]
willb has quit [Connection timed out]
mattc58 has left #ocaml []
jonafan_ is now known as jonafan
<mfp>
love-pingoo: r := v doesn't walk v, it just adds it to the remembered set if the ref is in the major heap and v is in the minor
<mfp>
(caml_modify)
<mfp>
the remembered set is implemented with an array of values, enlarged (geometrically) as needed
<mfp>
and, of course, if the compiler knows that r is e.g. int ref, it won't use caml_modify
<mfp>
(but it will if the ref is polymorphic; you'd have to specialize it manually to avoid caml_modify)
love-pingoo has quit [Read error: 110 (Connection timed out)]
<mfp>
uh
ttamttam has quit ["Leaving."]
<mfp>
anyway, ocamlopt knows how to place local refs in registers/on the stack, so the code need not differ much from that you'd get with a tail-recursive function --- the main diff is that the latter always begins with call
<mfp>
(tail-recursive functions are never inlined)
Cheshire has quit [Read error: 104 (Connection reset by peer)]
Cheshire has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
_zack has quit ["Leaving."]
willb has joined #ocaml
tar_ has quit []
jonafan_ has joined #ocaml
Snark has joined #ocaml
jonafan has quit [Read error: 60 (Operation timed out)]
tar_ has joined #ocaml
<slash_>
anyone knows if there is another ocamlport of sdl other then ocamlsdl?
pango has quit [Remote closed the connection]
<slash_>
which is more up-to-date
_jeremiah has joined #ocaml
|jeremiah has quit []
<slash_>
nm
OChameau has quit ["Leaving"]
Yoric[DT] has joined #ocaml
pango has joined #ocaml
<Yoric[DT]>
hi
<hcarty>
Yoric[DT]: Very nice Batteries slides
jhamza has quit ["using sirc version 2.211+KSIRC/1.3.12"]
<Snark>
hcarty, the talk was good too :-)
* Snark
should report some bugs on the debian batteries package
<hcarty>
Snark: How were the talks overall? The slides look interesting all around
<Snark>
hcarty, that was pretty interesting
<Snark>
I'm glad I could go and see them
<Snark>
s/see/watch/
love-pingoo has joined #ocaml
ttamttam has joined #ocaml
jlouis has joined #ocaml
marmotine has joined #ocaml
avsm has quit []
bluestorm has joined #ocaml
<mfp>
aren't polymorphic variant constructors supposed to be capitalized? IIRC there's no guarantee that lowercase constructors will remain valid
<mfp>
(-> lots of non-capitalized constructors in Batteries, e.g. Toolchain.Execute)
tar_ has quit []
<Yoric[DT]>
hcarty: thanks
<Yoric[DT]>
Snark: thanks, too :)
<Yoric[DT]>
mfp: is that true?
<mfp>
Yoric[DT]: looking for a ref, but I'm pretty sure I read somewhere that lowercase constructors were sort of accidental and for internal use
<Yoric[DT]>
gasp
<Yoric[DT]>
good to know
<bluestorm>
mfp: i checked and yes, polymorphic variants should be uppercase
smimou has joined #ocaml
<mfp>
yeah the manual says tag-name::=capitalized-ident