BiDOrD_ has quit [Quit: No Ping reply in 180 seconds.]
BiDOrD has joined #ocaml
Edward has quit []
companion_cube has quit [Ping timeout: 255 seconds]
chicco has joined #ocaml
_habnabit has joined #ocaml
companion_cube has joined #ocaml
arubin has joined #ocaml
<thelema>
is it a bug that numeric_compare "abc5123" > "abc500122"?
joewilliams is now known as joewilliams_away
<mrvn>
it probably doesn't pare that as "abc" 5123 same as pretty much all compares.
<mrvn>
s/pare/parse/
<mrvn>
What you want is version_compare, as in how dpkg compares versions.
<thelema>
mrvn: actually, the (original) point of that code was to deal with filenames numbered without leading zeros
<thelema>
and it looks like quicktest has found another bug in that code. (the previous bug was fixed at the same time the quickcheck tests were added
<thelema>
)
tauntaun has quit [Quit: Ex-Chat]
elehack has joined #ocaml
<mrvn>
thelema: normal numeric compares only work on the leading numbers. 5123abc and 500122abc would sort.
<mrvn>
That has annoyed me a lot of times in the past.
lopex has quit []
<thelema>
I'm talking about BatString.numeric_compare, yes?
<mrvn>
well, happy fixing.
<thelema>
thanks.
<thelema>
I'll see if I can come up with the proper implementation of this, which I don't think is version_compare
<thelema>
although I've not checked
<thelema>
nope, although maybe I'm stuck on the change_flip from earlier, as I can imagine using it to solve this problem
<mrvn>
you need to split the string into numeric and non numeric parts and then compare them in turn. type numstr = Str of string | Num of int and then compare numstr lists.
<mrvn>
if you want to support numbers larger than int then it becomes more complex.
sepp2k has joined #ocaml
<thelema>
I guess I can catch int_of_string failures and... bigint? :) probably easier to just emulate a numeric compare by comparing length first (after stripping leading zeros)
<mrvn>
thelema: store numbers as char list in reverse order :)
<mrvn>
"ab123cd" -> [Str "ab"; Num ['3';
<mrvn>
'2'; '1'; ]; Str "cd"]
<mrvn>
nah, forget that. stupid idea,
<thelema>
but that doesn't get me a numeric compare...
<mrvn>
you need something to make the numbers the same length or emulate that for the compare.
<thelema>
well, the easiest fix is to have my current algorithm back up to find the start of the number before converting to int
<mrvn>
add leading 0 to make the length the same and then just compare alphabetically.
<thelema>
currently I scan forward to find the first different character, if it's a number, convert to int and compare that instead
<thelema>
all I have to do is back up to the start of the number so I don't drop leading nonzero digits
<mrvn>
thelema: abc123 abc1234? Do you comapre 4 to ""?
<thelema>
I convert "4" and "" to integer - I guess "" converts to 0
<thelema>
or not. if I run out of characters, I decide right there, same as for normal compare
<thelema>
same as "abc" vs. "abcd"
Modius has joined #ocaml
<thelema>
except maybe I return the wrong one...
<mrvn>
you indeed need to backtrack there
<mrvn>
or track forward to the next non digit and then compare back.
<thelema>
I already have code to track forward to the next non-digit, I just need to back up digits first
npouillard has quit [Ping timeout: 272 seconds]
npouillard has joined #ocaml
<thelema>
wow I'm a bad coder - if the difference between the strings is not a number in one of the strings, I compare the whole strings again
<thelema>
as opposed to comparing just the two characters
<thelema>
and I cheat poorly for strings of equal length
<thelema>
"abc10" < "abc1a"
<mrvn>
nope
npouillard has quit [Ping timeout: 260 seconds]
npouillard has joined #ocaml
<elehack>
the test extractor requires a trailing space after (**T - is that intentional or a bug?
<thelema>
elehack: intentional, mostly. You should label the test on that same line
<thelema>
it also cuts down on falsely identifying tests from comments like (**This is a comment **)
<elehack>
Ahh, gotcha.
<thelema>
(**T test_name
<thelema>
there's a number of improvements to be made in test generation, not least of which is embedding the source location in the output file so compile errors don't go to the _t.ml file
<thelema>
also test_name must be a valid ocaml identifier - currently , is allowed and causes a nasty compile error
Amorphous has quit [Ping timeout: 272 seconds]
<elehack>
I noticed that - I had spaces, and the resulting file was not correct.
<thelema>
probably should s/ /_/g those for convenience
<elehack>
That could be useful.
<elehack>
I was just working on #114 - dealing with the stdlib's additions to Map.
<elehack>
turns out we can't be compatible with them, due to incompatible definitions of filter :(
<thelema>
:( what's the difference, just argument order?
<elehack>
the filtering function takes both key and value in stdlib, only value in BatMap.
<elehack>
probably something to fix for 2.0 - client code can always ignore the key, and the key can be useful.
<thelema>
for now, a filter_stdlib function that's compatible seems reasonable (or another name)
<elehack>
ok.
<elehack>
I'm also introducing a BatMap.BASIC signature.
Amorphous has joined #ocaml
<thelema>
BASIC? like GWBASIC?
* mrvn
repsonds with BatMap.COMPLEX
rossberg has quit [Ping timeout: 272 seconds]
<elehack>
this signature is compatible with the 3.11 stdlib Map.S, and BatMap.S now includes it.
<elehack>
so APIs can have easy access to a signature that is satisfied by the stdlib's Map (or by ptmap.ml)
<elehack>
found this to be an issue when I tried rebuilding my main school codebase on 3.12 today.
rossberg has joined #ocaml
<elehack>
looks like we already have an stdlib-compatible filter function - filteri.
<elehack>
lol
* elehack
is open to alternative names
<thelema>
use your best judgement, I/we'll adjust anything needing it, and we'll have a discussion if there's conflict between what people believe correct
<elehack>
sounds good
khia0 has joined #ocaml
khia0 has left #ocaml []
myu2_ has quit [Remote host closed the connection]
elehack has quit [Quit: Farewell, programs.]
myu2 has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
ModusPwnens has joined #ocaml
myu2 has quit [Remote host closed the connection]
arubin has quit [Quit: arubin]
eye-scuzzy has quit [Ping timeout: 245 seconds]
eye-scuzzy has joined #ocaml
<ModusPwnens>
so i have to write an interpreter for class, but I'm confused about a few concepts.
<ModusPwnens>
Anyone willing to tackle this?
ulfdoz has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
tnguyen has joined #ocaml
ulfdoz has joined #ocaml
Snark has joined #ocaml
ulfdoz has quit [Ping timeout: 276 seconds]
myu2 has joined #ocaml
Yoric has joined #ocaml
cyanure has joined #ocaml
seafood has joined #ocaml
cyanure has quit [Quit: Quitte]
sepp2k has quit [Quit: Leaving.]
myu2 has quit [Remote host closed the connection]
seafood has quit [Quit: seafood]
ygrek has joined #ocaml
Yoric has quit [Quit: Yoric]
tnguyen has quit [Remote host closed the connection]
eb4890 has joined #ocaml
myu2 has joined #ocaml
ikaros has joined #ocaml
Associat0r has joined #ocaml
boscop has joined #ocaml
oriba has joined #ocaml
flux has quit [Read error: Operation timed out]
flux has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
edwin has joined #ocaml
oriba has quit [Quit: Verlassend]
mnabil has joined #ocaml
Yoric has joined #ocaml
eb4890 has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
ModusPwnens has quit []
ttamttam has joined #ocaml
lopex has joined #ocaml
ikaros_ has joined #ocaml
tauntaun has joined #ocaml
ikaros has quit [Ping timeout: 260 seconds]
seafood has joined #ocaml
CoryDambach has quit [Read error: Connection reset by peer]