<Maddas>
after the last line, the if test should succeed and the thing should just return l and quit
<Maddas>
any ideas why?
mattam_ has joined #ocaml
<mattam_>
hmm, did you read what i wrote ?
<Maddas>
no, nothing arrived.
<Maddas>
:-)
mattam has quit [Nick collision from services.]
<mattam_>
i can be = slen
<mattam_>
the (i-1) >= slen should be replaced with i >= slen
mattam_ is now known as mattam
<Maddas>
are you sure?
<Maddas>
but if i = slen then s.[i] would fail, wouldn't it?
<Maddas>
as slen starts from one, while the indices start from zero
<mattam>
yep
<Maddas>
oh, duh
<Maddas>
:)
<mattam>
slen can be 0
<mattam>
too
<Maddas>
Ah.
<mattam>
maybe reindenting would help you
<Maddas>
Why? :)
<mattam>
f (i-1) >= slen then l else
<mattam>
let j = i + 1 in
<mattam>
if is_sep s.[i] then
<mattam>
that is not clear :)
<Maddas>
hm
<Maddas>
did you find out why my program doesn't terminate before getting an exception then? :-)
<mattam>
and, BTW, using Str.split (Str.regexp " \|'\|...") whould be better :)
<Maddas>
Duh. Oh well, this is just an exercise :-)
<mattam>
Maddas: when i = 15, (i-1) >= slen is false and you try to access str.[15]
<mattam>
which causes the exception
<Maddas>
I see
<Maddas>
oh, I forgot to re-define the subroutine after doing the change
<Maddas>
yay
<Maddas>
Stupid mistake. I was thinking the wrong way around all the time
* Maddas
slaps himself
<Maddas>
Thanks a lot :)
<mattam>
np
<Maddas>
l :: (String.sub s ws (i-ws)) or (String.sub s ws (i-ws)) :: l, the second is more efficient, isn't it?
<Maddas>
I read something about that once, but I forgot where :-)
<Maddas>
never mind, the first is a syntax error.
<mattam>
yep, and the second is more efficient (adding a cell is better than concatenating two lists)
Nate1975 has joined #ocaml
foxster has joined #ocaml
brwill_zzz is now known as brwill
brwill is now known as brwill_nearby
TachYon has joined #ocaml
TachYon has quit [Remote closed the connection]
bk_ has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
bk_ has joined #ocaml
Xcalibor has joined #ocaml
<Xcalibor>
hi
<phubuh>
hi
<Riastradh>
hi
<phubuh>
is it possible to craft a function that takes a list of objects and an identifier for a method common to all the objects, and invokes the method on every one?
<phubuh>
actually, never mind. that would be horrible.
<teratorn>
there's no reason to use a function
<teratorn>
just interate the list
<teratorn>
*iterate
<Smerdyakov>
Why don't you just pass a closure per object, where each closure calls the appropriate method on the appropriate object?
<phubuh>
yeah
foxster has quit [Client Quit]
TachYon has joined #ocaml
TachYon has quit [Client Quit]
bk_ has quit ["I'll be back"]
Nate1975 has quit ["using sirc version 2.211+KSIRC/1.2.4"]
<phubuh>
is it just me, or can tuareg-mode just barely handle string literals?
<Xcalibor>
dunno...
<Xcalibor>
mostly use gvim and ledit on a separate window...
* Xcalibor
uses emacs for haskell mode and hugs98 of ucb logo, though
<mattam>
tuareg has problems with string literals, but reindenting the line should get things right
<phubuh>
ah
<phubuh>
i'll try that the next time i get it
malc has joined #ocaml
buggs|afk has joined #ocaml
<Xcalibor>
time for bed laters!
Xcalibor has quit ["Terminando cliente"]
buggs has quit [Read error: 110 (Connection timed out)]
jdrake has joined #ocaml
__DL__ has joined #ocaml
jdrake has quit ["Oops. This machine just fell asleep"]