<super__guest>
how does one address two different lists in a function?
<thelema>
super__guest: let l1 = [x;y;z] in let l2 = [1;2;3] in match l1,l2 with [],[] -> "both empty" | _ -> "not both empty"
<thelema>
is that what you mean by "address"?
<MaskRay>
perhaps he means a polymorphic function
<super__guest>
well, i'm trying to do a subset check and i've made a function to determin whether an element is within a list, but i want to check every h :: t in l1 against all of l2, so i need to do the ocaml version of a nested for loop, but i don't understand how to address them as such
<super__guest>
determine*
<super__guest>
i think i'm fine with polymorphism
<_habnabit>
super__guest, Set.inter
<super__guest>
these should be a'
<super__guest>
o
<_habnabit>
super__guest, that way it's not O(n^2)
<super__guest>
doesn't it have to be by default, since ocaml uses singly linked lists?
<super__guest>
or am i missing something
<_habnabit>
(but fwiw you could write `let list_inter l1 l2 = List.filter (flip List.mem l1) l2`)
<thelema>
super__guest: let subset l1 l2 = List.for_all (fun x -> List.mem x l2) l1
<_habnabit>
thelema, jinx
<thelema>
:P
<super__guest>
lol
<_habnabit>
super__guest, the Set module is binary trees; you can do an intersection in a much better time complexity
<super__guest>
ah
<super__guest>
thank you guys for being very helpful
<_habnabit>
highly recommended to use Set instead of lists if you're going to be doing set operations like this
<thelema>
super__guest: it's rarely appropriate to write for loops to iterate over lists
<super__guest>
i'll keep that in mind, thanks a lot
<MaskRay>
thelema: how about iterating an array with for loops?
<thelema>
MaskRay: sure, but higher level functions are usually better, and can be combined nicely to do most things with less errors
<MaskRay>
or in which case is the for loop preferred
<thelema>
MaskRay: for i = 0 to Array.length arr do arr.(i) <- arr.(i) * 2 done
<thelema>
for loops are good for iterating over many arrays simultaneously
<MaskRay>
thanks
<thelema>
or for doing non-uniform iteration (for i = 1 to n do for j = 1 to i do ... done done
antegallya has joined #ocaml
clog has joined #ocaml
nimred has joined #ocaml
noj has joined #ocaml
jlouis has joined #ocaml
haelix has joined #ocaml
nimred has quit [Changing host]
nimred has joined #ocaml
emias has joined #ocaml
ousado has joined #ocaml
patronus has joined #ocaml
pango has joined #ocaml
ankit9 has joined #ocaml
Nass has joined #ocaml
mcclurmc has joined #ocaml
<thelema>
but checking the ocaml program I have open right now, there's no for loops at all - every "for" is within a string.
deavid has joined #ocaml
srcerer has joined #ocaml
<_habnabit>
I don't think I've ever written one
<_habnabit>
or a while loop
<thelema>
I use while loops for input when I'm not using batteries
<MaskRay>
i find that making an ad-hoc loop even for a trivial fold on arrays is clumsy
Tobu has quit [Read error: Operation timed out]
<thelema>
and for loops have a slight efficiency advantage over higher order functions
<MaskRay>
cannot use pattern matching on function definitions like haskell
<thelema>
because the inliner can't inline higher order functinos
<MaskRay>
f 0 = 1
<MaskRay>
f n = n*f (n-1)
<thelema>
MaskRay: let rec f = function 0 -> 1 | n -> n * f(n-1)
<_habnabit>
well, you _can_ do pattern matching, but you won't be able to have more than one match case
<thelema>
I use the pattern "let f x y = match x,y with ..." often
<MaskRay>
thelema: a `function' or `match' clause is indispensable..
<thelema>
MaskRay: yup
Qrntzz has joined #ocaml
antegallya has quit [Quit: Leaving.]
<super__guest>
can i ask your guy's opinion on a proper way to determine equal sets?
antegallya has joined #ocaml
<super__guest>
i have two possible solutions
<_habnabit>
is there a reason you're implementing sets?
<super__guest>
one: using the subset declaration, i determine whether two sets are of equal size and if one is a subset of the other
<_habnabit>
(and is that reason 'homework' ?)
<super__guest>
bingo
<_habnabit>
sigh :(
<super__guest>
this is my first time using functional programming
iago has quit [Quit: Leaving]
<super__guest>
i hope i haven't dissapointed you with my wide eye'd enthusiasm
<MaskRay>
i would examine the length first and then flatten the two sets
<super__guest>
ah
<_habnabit>
I don't find that reimplementing things like this serves as any kind of useful exercise
<super__guest>
in the school i attend this is usually our first look at functional programming
<super__guest>
and i don't have the background to have been quite familiar with any ml
<MaskRay>
it will be both short and efficient in a lazy language
<MaskRay>
but couldn't figure out an elegant way in ocaml...
<super__guest>
_habnabit: do you use ocaml in a professional capacity?
<super__guest>
or in a personal capacity?
<_habnabit>
professional
<super__guest>
may i ask what you do?
<_habnabit>
computational biology.
<super__guest>
with ocaml, specifically
<super__guest>
academic environment?
<_habnabit>
vaguely? I'm just a programmer; my boss deals with the academia part.
<_habnabit>
(which is fortunate.)
<super__guest>
ocaml seems like an interesting choice of programming language, at least compared to the imperatives i am familiar with
<super__guest>
as a mathmajor i think i would like to use ocaml more
antegallya has quit [Ping timeout: 260 seconds]
twittard_ has joined #ocaml
twittard has quit [Ping timeout: 255 seconds]
Tobu has joined #ocaml
twittard_ has quit [Ping timeout: 276 seconds]
Tobu has quit [Read error: Operation timed out]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 240 seconds]
super__guest has quit [Ping timeout: 252 seconds]
alxbl has quit [Ping timeout: 255 seconds]
super__guest has joined #ocaml
super__guest has quit [Remote host closed the connection]
emmanuelux has quit [Ping timeout: 240 seconds]
Tobu has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 276 seconds]
ftrvxmtrx has joined #ocaml
twittard has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
twittard has quit [Remote host closed the connection]
twittard has joined #ocaml
Tobu has joined #ocaml
twittard_ has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
ulfdoz has joined #ocaml
twittard has quit [Ping timeout: 276 seconds]
twittard_ is now known as twittard
kmicinski has joined #ocaml
kmicinski has quit [Quit: leaving]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
ulfdoz has quit [Ping timeout: 276 seconds]
lopex has quit [Excess Flood]
MaskRay has quit [Ping timeout: 240 seconds]
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
lopex has joined #ocaml
ocp has quit [Read error: Operation timed out]
pilki has joined #ocaml
pilki has quit [Client Quit]
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
silver has joined #ocaml
ftrvxmtrx has joined #ocaml
cago has joined #ocaml
edwin has joined #ocaml
idest0 has joined #ocaml
Snark has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
milosn has joined #ocaml
ocp has joined #ocaml
edwin has quit [Ping timeout: 240 seconds]
edwin has joined #ocaml
Cyanure has joined #ocaml
silver has quit [Quit: I put on my robe and wizard hat]
idest0 has quit [Read error: Connection reset by peer]
edwin has quit [Quit: Leaving.]
thomasga has joined #ocaml
ikaros has joined #ocaml
twittard has quit [Read error: Connection reset by peer]
Tobu has quit [Ping timeout: 272 seconds]
emmanuelux has joined #ocaml
everyonemines has joined #ocaml
Tobu has joined #ocaml
<Ralith>
How do ocaml compilers typically compile manipulation of parametrically polymorphic data to machine code such that it is not confounded by differently-sized types?
<_habnabit>
it's probably just all pointers
<adrien>
everything is the same size
<adrien>
well, almost everything
<Ralith>
a float sure isn't a pointer
<_habnabit>
it can be boxed and then pointed to
<Ralith>
yes, though that costs significant performance under some circumstances; I was wondering if there are common techniques to avoid that
<adrien>
Ralith: basically, the in-memory representation is uniform
<adrien>
Ralith: if you have a record of only floats or an array of floats, they get the same representation; that helps a lot
<adrien>
the ocaml compilers might not optimize everything but they're not crazy either
<Ralith>
I don't quite follow your point about records versus arrays
<everyonemines>
A record of only floats is flattened to an array. A mixed array isn't.
<adrien>
the compiler will usually box your values but it some cases, it can skip that
avsm has quit [Quit: Leaving.]
<everyonemines>
Yeah, there's a performance hit, but the equivalent code without parametric poly is no faster.
<_habnabit>
all types can be moved around by the GC though, right?
<_habnabit>
(I'd _hope_ so_)
avsm has joined #ocaml
<adrien>
if you have a specific performance issue, it would be better if you could show the code
<Ralith>
I don't; I'm musing on optimizations in general.
<everyonemines>
Speaking of performance, I've heard people say modules can cause slowdowns. How would that be the case?
<adrien>
everyonemines: functors?
<everyonemines>
I mean, I can understand why functors could be slower, but regular modules...?
<everyonemines>
maybe they meant functors
<Ralith>
so basically I was wondering about the extent to which unboxed non-pointer values are supported for parametrically polymorphic functions, and what approaches are used to accomplish this, if any
<adrien>
and first-class modules? modules defined by a file or defined _in_ a file? maybe because if you use different modules and don't ship .cmx files, you can't inline
<everyonemines>
oh, multi-stage compilation and failure to inline
<everyonemines>
that must have been it
<adrien>
Ralith: don't take my words on that but I think there is no support: the uniform representation (and therefore the boxing) is required
<everyonemines>
I think what Ralith is proposing is the following: instead of a type * pointer, we allocate type * 64b
<everyonemines>
(for float | int, as an example)
<everyonemines>
and then if we have an int we only use 32b of the 64
<Ralith>
that's the immediately obvious way to implement that, yeah
<everyonemines>
That technique is only useful in special cases, the compiler must then decide.
<adrien>
there is the GC tag too which uses one bit
<everyonemines>
yeah
<Ralith>
only in special cases?
<everyonemines>
In practice, parametric polymorphism is used more for enumeration types of X than for float | int
<everyonemines>
imo
<Ralith>
enumeration types are encoded as machine integers, aren't they?
<Ralith>
and thereby unboxable and efficiently passable in registers
<everyonemines>
sure, optimization is good, but the use cases where this matters aren't that important
<everyonemines>
maybe
<Ralith>
I'm not saying this is necessarily a hugely important, or even significant, thing to do
<Ralith>
it's just a problem that struck my fancy
<adrien>
I'll add one more consideration
<adrien>
GCC, LLVM, ICC, MSVC, and all the compilers that optimize "a lot" are full of bugs, corner cases, and yet are developped by big teams
<everyonemines>
MLton? :-)
<Ralith>
heh
FruitsPunchSamur has joined #ocaml
<FruitsPunchSamur>
hi can someone please help me
<everyonemines>
not based on the information you've provided
<everyonemines>
sorry
<FruitsPunchSamur>
oh
<FruitsPunchSamur>
i was just checking if someone was here
<FruitsPunchSamur>
sorry
<FruitsPunchSamur>
im trying to write a function to remove duplicates from a list
<adrien>
everyonemines: probably too; CompCert is maybe the only C compiler that is "correct" (so far)
<FruitsPunchSamur>
i don't know if it's frowned upon to ask for help on homework but i'm really stuck
<FruitsPunchSamur>
oh whoops, did i butt in into a conversation
<adrien>
oh no, go on :P
<FruitsPunchSamur>
well, i'm supposed to write a tail recursive function to remove duplicate integers given a list of integers
<FruitsPunchSamur>
i'm not looking for answers, but I'd like some help trying to grasp the logic and syntax. I haven't been programming in ocaml for long and i'm just looking up old school assignments to get me up to speed
<adrien>
Ralith: yes, that too; but it shows that if you don't have a lot of time, it might be better to not try to do too much
<Ralith>
true enough
<adrien>
FruitsPunchSamur: how much are you allowed to use from the standard library? how long have you been doing (o)caml?
ikaros has quit [Quit: Ex-Chat]
<FruitsPunchSamur>
adrien: well I can use the standard library all i want. I'm just trying to do it according to the assignment specs. According to spec, I can use List.mem and List.rev and the Pervasives library. Also the skeleton code provided said not to rewrite anything other than assigning the value of seen' and rest'.
<FruitsPunchSamur>
adrien: I installed ocaml last night
<everyonemines>
if ((List.mem h t) = true) then t else rest
<everyonemines>
think about that for a minute
<everyonemines>
also, =true?
<everyonemines>
:-)
<FruitsPunchSamur>
forgive me, but i'm afraid i fail to see the mistake... I first check to see if h has duplicates in t. If true, then recurse on t. otherwise, recurse on rest, where rest is the same thing as h::t
Tobu has quit [Read error: Operation timed out]
<everyonemines>
if List.mem h seen then loop seen t else loop (h::seen) t
otk has quit [Ping timeout: 244 seconds]
<FruitsPunchSamur>
sorry, is loop an ocaml keyword?
<everyonemines>
no, it's what I use for recursive loops
<FruitsPunchSamur>
ohh
otk has joined #ocaml
<FruitsPunchSamur>
sorry, i'm confused about a couple of things
<FruitsPunchSamur>
1) loop seen t
<FruitsPunchSamur>
2) loop (h:seen) t
<everyonemines>
h::t -> if List.mem h seen then loop seen t else loop (h::seen) t
<FruitsPunchSamur>
sorry syntax is still really foreign to me... is "loop" just a guide for me to tell that you're looping?
<FruitsPunchSamur>
also what does seen t produce? is there no need for a cons (:) operator?
<everyonemines>
loop seen t is a function application of loop
<adrien>
in your case, it was "helper" instead of "loop"
<everyonemines>
loop is better :-)
<everyonemines>
sounds like you've studied C before but didn't look up some ocaml basics
<FruitsPunchSamur>
ohhhhhhhhhhhhhhhhhh
<FruitsPunchSamur>
i see
<FruitsPunchSamur>
Thanks for your time, this was made a lot clearer to me
<FruitsPunchSamur>
you are correct, i have studied C before. switching to a functional language such as ocaml was pretty weird
<FruitsPunchSamur>
but this is interesting
<FruitsPunchSamur>
thanks :)
<everyonemines>
of course, you can write ocaml like C if you want
<FruitsPunchSamur>
haha but then wouldn't that lose the purpose of using ocaml?
<FruitsPunchSamur>
one thing i found really cool is the fold function
<everyonemines>
If you want to program in a purely functional style then honestly you should use haskell.
<everyonemines>
ocaml lets you mix functional and imperative code where appropriate
<everyonemines>
In other words, functional stuff is a tool, not an end in itself.
<FruitsPunchSamur>
interesting, i was actually considering what to pick between haskell, lisp, and ocaml before settling on ocaml (only cause i found slides for it first)
<FruitsPunchSamur>
im not actually a programmer. I switched majors last quarter and finished K&R's C programming over break
<everyonemines>
oh, nice
<FruitsPunchSamur>
im really glad i switched, this is much more interesting compared to biochem haha
avsm has quit [Quit: Leaving.]
<everyonemines>
well, biochem has its interesting parts too, the difference might be that you can do programming more directly
<everyonemines>
if you know what I mean
<everyonemines>
I know a bit about enzyme mechanisms myself actually
<FruitsPunchSamur>
just to clarify, seen is used to build the unique list? loop (h:seen,t) is building the unique list?
<FruitsPunchSamur>
that's true. do you work in the bionformatics sector?
<FruitsPunchSamur>
ouch. i'd take a stab but this one is way out of my league
<adrien>
_andre: haven't read everything but on line 16, you have "None -> ()"
<adrien>
so you could try to do [ () "blah" ] with your function call
<adrien>
in other words, you're not returning a function
<everyonemines>
Honestly, I don't see the appeal of printf in ocaml. I prefer to use String.concat.
<adrien>
when you want to limit the widht of a float =)
<_andre>
adrien: i don't think i understood the issue you mentioned
edwin has joined #ocaml
antegallya has joined #ocaml
antegallya has quit [Ping timeout: 240 seconds]
FruitsPunchSamur has quit [Quit: Leaving]
antegallya has joined #ocaml
Drup has joined #ocaml
ikaros has joined #ocaml
letrec has joined #ocaml
fantasticsid has joined #ocaml
ttamttam has joined #ocaml
ocp has quit [Ping timeout: 260 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
zorun has quit [Read error: Connection reset by peer]
fantasticsid has joined #ocaml
zorun has joined #ocaml
<MaskRay>
i've found in many cases the double-semicolon separator is dispensable. is it a good practice to omit them? if not, what's the preferred position to put double semicolons?
<MaskRay>
the program seems to be prettier without them
<adrien>
that's probably the main reason to omit them
<adrien>
on the other hand, using them gives the compiler a clear indication that a "sentence" is over
<adrien>
and that prevents errors from being reported too far away from their actual location
<adrien>
a syntax error can propagate to the the end of the current sentence: delimited by ';;' or by the end of the file
<adrien>
if the end of the file is 10000 lines below the error, it might be a bit confusing =)
Qrntzz has quit [Changing host]
Qrntzz has joined #ocaml
Qrntzz has quit [Changing host]
Qrntzz has joined #ocaml
<Qrntzz>
I don't have a single double-colon (excuse the word play) in all the code I wrote and I'm fine
<Qrntzz>
adrien: if you have source files with more than 10000 lines, it's probably time to refactor, isn't it? :-p
<adrien>
how long does it take to compile? :P
<Qrntzz>
does it really make a significant difference?
<adrien>
if it takes more than half a second with ocamlopt (not .opt) on an average machine, it's probably time to check if there is something to do ;p
<adrien>
last time I had to do C++, that was one of my biggest grief: do a change and then look at your computer for 5 to 10 seconds with nothing to do
<Qrntzz>
heh, agreed
EmmanuelOga has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
mcclurmc has quit [Excess Flood]
mcclurmc has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<MaskRay>
I've found that ocaml usually reports errors without locating the error exactly
<MaskRay>
ocaml just reports a quite large snippet contains errors
<thelema>
MaskRay: yes, ocaml is often bad at localizing errors, especially with ; and type errors
<thelema>
that said, it does try to pinpoint as well as it can the error. For type errors, the messages are often way too verbose; naming the whole module that doesn't match
<thelema>
adrien: I think "phrase" is the official term for your "sentence"
<adrien>
ah? I had seen "sentence" being used I think
<thelema>
hmm... I'll see if I can source that.
<flux>
I've used 'block', but if there's an official term I'd like to use that :)
oriba has joined #ocaml
<thelema>
:( "specification" for interfaces and "definition" for implementations is what's used in 6.12 of the manual
<adrien>
^ ^
<thelema>
ah, "toplevel-phrase" is used in chapter 9
<adrien>
I think I got "sentence" from an email but I might have translated one way and again
antegallya has quit [Ping timeout: 276 seconds]
avsm has joined #ocaml
ulfdoz has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
MaskRay has quit [Quit: leaving]
<hcarty>
thelema: Do you know if there is anything in 'a BatSet.Concrete.set that would cause problems with Marshal? Or the %identity casts between 'a BatSet.Concrete.set and Set.S.t (which don't make much sense to me, since it looks like stdlib's set code is duplicated in batSet.ml anyway...)
<hcarty>
thelema: I'm not using Marshal directly, but I am using xleroy's MPI bindings which, IIRC, use it internally.
cago has quit [Quit: Leaving.]
ulfdoz_ has joined #ocaml
<thelema>
hcarty: marshalling functions in the polymorphic sets?
<thelema>
hcarty: more in 10 minutes
ocp has joined #ocaml
silver has joined #ocaml
ulfdoz has quit [Ping timeout: 272 seconds]
ulfdoz_ is now known as ulfdoz
<hcarty>
thelema: Strictly functor-based sets. But both functorized and polymorphic sets seem to use the same code internally, so I don't know what impact that has.
ikaros has quit [Read error: Operation timed out]
Cyanure has quit [Ping timeout: 245 seconds]
letrec has quit [Ping timeout: 272 seconds]
avsm has quit [Read error: Connection reset by peer]
Submarine has quit [Read error: Operation timed out]
shachaf has quit [Remote host closed the connection]
<The_Average>
im somewhate new to programming, what are the cons of Ocaml compared to java?
<_habnabit>
you'll get too much work done too quickly
<hcarty>
The_Average: OCaml is applicable in a large number of areas. Do you have a specific area of interest for programming (web, games, etc)?
<thelema>
hcarty: most of stdlib's set code is re-implemented in batSet, but not all of it, and the casts are still necessary for the type equality.
thomasga has quit [Ping timeout: 244 seconds]
haelix has quit [Ping timeout: 244 seconds]
mcclurmc has quit [Ping timeout: 244 seconds]
EmmanuelOga has quit [Ping timeout: 244 seconds]
Obfuscate has quit [Ping timeout: 244 seconds]
bzzbzz has quit [Ping timeout: 244 seconds]
trhodes has quit [Ping timeout: 244 seconds]
asmanur3 has quit [Ping timeout: 244 seconds]
thomasga has joined #ocaml
dsheets1 has joined #ocaml
Dettorer has quit [Ping timeout: 240 seconds]
emias has quit [Ping timeout: 240 seconds]
malouin has quit [Ping timeout: 240 seconds]
dsheets has quit [Ping timeout: 240 seconds]
<The_Average>
Im very interested in web code
* _habnabit
<3 freenode
<thelema>
The_Average: you'll have to think differently to program in ocaml than java. Immutable by default and that not everything is an object changes things a *lot*
ttamttam has left #ocaml []
shachaf has joined #ocaml
<The_Average>
well i certainly didn't know about Ocaml, ill deffiently look into it
The_Average has left #ocaml []
<hcarty>
The_Average: There are some interesting OCaml-based web programming tools available. Ocsigen is one (
twittard has quit [Read error: Connection reset by peer]
twittard_ has joined #ocaml
ocp has quit [Quit: Leaving.]
ocp has joined #ocaml
Drup has quit [Quit: Leaving.]
antegallya has joined #ocaml
everyonemines has quit [Quit: Leaving.]
<hcarty>
thelema: You've mentioned wanting a pure-OCaml regexp module/library for Batteries. Have you seen ocaml-re (https://github.com/avsm/ocaml-re)? If so, what's your opinion of it?
<thelema>
yes, I haven't had time to evaluate it fully.
antegallya has quit [Ping timeout: 272 seconds]
<thelema>
It seems okay from a brief scan
<thelema>
I especially appreciate that it's maintained
milosn has quit [Read error: Operation timed out]
<thelema>
Probably the biggest features I want are splitting by regex and straightforward string regex matching
<thelema>
Maybe substitutions would be nice too
milosn has joined #ocaml
silver has quit [Remote host closed the connection]
<hcarty>
thelema: re: BatSet - if I include (Bat)Set.Make(Foo) and then override the map and of_enum functions in my set module, my ordering problem goes away.
<thelema>
ok, a problem with either Set.map or Set.of_enum
<thelema>
are you using of_enum_cmp?
<hcarty>
thelema: I'm trying to replace/override each of those functions individually now to see which is the culprit, assuming that is really where the problem lies.
<thelema>
oh yeah, functor
<hcarty>
thelema: Right
ocp has quit [Read error: Connection reset by peer]
ocp has joined #ocaml
<thelema>
ah, maybe map puts values in the same position?
* thelema
looks up implementations
antegallya has joined #ocaml
<thelema>
yup, Set.map keeps the same structure of the map
<thelema>
the same tree shape, which is likely incorrect for the new set
<thelema>
s/the map/the set/
<thelema>
which is probably why inria doesn't provide Set.map
<thelema>
let map f s =
<thelema>
fold (fun v acc -> add (f v) acc) s empty
<hcarty>
My map is: fold (fun elt accu -> add (f elt) accu) s empty
<hcarty>
That works
<hcarty>
for me
<hcarty>
:-)
<thelema>
hmm, I should make a test...
<hcarty>
thelema: Should I file a bug report?
<thelema>
if you like, but I'll just close it with my commit.
Tobu has quit [Quit: No Ping reply in 180 seconds.]
<hcarty>
If you're going to fix it right now then I won't bother
Tobu has joined #ocaml
<thelema>
I'm fixing it now...
<thelema>
it looks like the non-functorized version should get an extra argument for the compare function
<thelema>
aha, there's even notes that map and filter_map are under-specified
<thelema>
well, that's another fix for another day.
<hcarty>
Are there any other functions in Set which may have the same fault?
<thelema>
I'm checking filter map now, but I think no.
<thelema>
I'm guessing the code from BatMap was copied too quickly without thinking through the consequences
<thelema>
BatMap.map can't modify a key
ocp has quit [Ping timeout: 272 seconds]
<hcarty>
It looks like filter_map uses a fold so it should be safe.
<thelema>
yup, same code.
edwin has quit [Remote host closed the connection]
probst has joined #ocaml
<thelema>
pushed as commit c793ddd
roha has joined #ocaml
roha has quit [Client Quit]
<thelema>
I was about to say that this'll be the first time I didn't break the build with a quick commit, but then I ran 'make test' and it failed
<thelema>
luckily, it was the result of qtest2 changes, so a 'make clean test' worked right.
EmmanuelOga has quit [Ping timeout: 244 seconds]
antegallya has quit [Ping timeout: 248 seconds]
ikaros has quit [Quit: Ex-Chat]
twittard_ has quit [Remote host closed the connection]
twittard has joined #ocaml
<gildor>
hi
<gildor>
thelema: have you commited the benchmark of bitset into batteries ?
<thelema>
gildor: iirc, yes
<thelema>
one sec while I check
<gildor>
(you show me some results and I would like to work on improving it, if possible)
<thelema>
hmm, doesn't look like it...
<thelema>
I'll commit now
<gildor>
now, I need to figure how to merge your commit into my branch ;-)
<thelema>
it's just one file, copy that file into your benchsuite folder
<thelema>
if you're in-sync enough, you can cherry pick the commit
<gildor>
if you have commited it, I'll try to merge
<gildor>
I need to learn github a little more
<thelema>
I use gitk for cherry picking
<thelema>
pushed as b86d782
<thelema>
gildor: It's about time for me to go home - should I do that and check back with you in about 15 minutes, or should I wait?
<gildor>
go home
<thelema>
cheers
<gildor>
that is not high priority and I am not sure to be here in 15 minute
<thelema>
ok; I can help with git, but I guess there's lots of git help on the net
probst has quit [Quit: probst]
<gildor>
thelema: well, everything fine
<gildor>
thelema: I created a branch upstream and pull upstream batteries there
<gildor>
and I use this branch to merge
<gildor>
that is fine
agarwal1975 has joined #ocaml
agarwal1975 has quit [Client Quit]
everyonemines has joined #ocaml
letrec has joined #ocaml
funktronic has joined #ocaml
<funktronic>
ocsigen seems to be the preemininent way to do web apps.. any other suggestions ?
cdidd has quit [Remote host closed the connection]
* thelema
reads backlog
<gildor>
I can wait a minute
<gildor>
you'll probably have comments
<thelema>
the gc is run between every iteration (all 300/1000)
<thelema>
I'm not sure about the inlining argument
<thelema>
I agree that gc probably shouldn't be run between iterations
<gildor>
I have make it run between every iteration
<gildor>
between every tests I mean
<gildor>
if you make it run between iteration you should not take into account time spent here
<gildor>
I see only one reference to the Gc module
<thelema>
that time shouldn't be measured
_xizor has quit []
<gildor>
and this call is triggered by config.gc_between_tests
<thelema>
yes, the time is only measured in M.time_ f iters_int
<thelema>
the Gc.compact() is run outside the timing loop
<gildor>
yes, so the Gc was free to run whenever it wants if you don't set gc_between_tests (default is false)
<thelema>
ah, I see. ok
<thelema>
maybe default=true is better
<gildor>
which impacts timing of subsequent tests
<thelema>
although neither test really allocates much.
<thelema>
the array of ints is even allocated once.
<gildor>
yes default=true is worth
<thelema>
in fact, what allocation is done?
<gildor>
creation of a 1_000_000 bitset
<thelema>
none of set/unset/get allocate for either algorithm, do they?
<thelema>
hmm, maybe that should be pulled outside the loop
<gildor>
+ 1_000_000 array of bool (~4MB)
<thelema>
statically allocate both
<gildor>
indeed it is created once
<thelema>
assume that they work (which I'm currently doing) and don't even bother clearing them
<gildor>
but anyway, it won't harm to control Gc behavior
<gildor>
esp. considering that I had an unstable results
<thelema>
granted, although that should be delt with by the statistics...
<gildor>
i.e. going from array 60% faster than bitset
<thelema>
I wonder why the difference
<gildor>
to bitset 35% faster than array
<thelema>
inlining, ok
<thelema>
huh, bitset faster?
<gildor>
when I didn't have the Gc set, I had different result at each run
<thelema>
ok, definitely GC sensitive.
<gildor>
now things seems stable
<thelema>
maybe I'll play with 2d benchmarks and benchmark a variety of widths
<thelema>
(after you go to bed)
<gildor>
anyway, this bench is nearer to what I see when using BitSet
<gildor>
(that is the reason of the rewrite, otherwise I'll have trusted you)
<gildor>
now that I have a meaningful benchmark, I can start optimizing BitSet
<thelema>
I'll see what I can get from more benchmarking - thanks for digging further
<gildor>
(if possible)
everyonemines has quit [Quit: Leaving.]
<gildor>
do you want me to do a pull request ?
<thelema>
I can merge your gist, thanks though
<thelema>
(unless you want the practice)
<gildor>
I need to practice ;-)
<gildor>
wait a minute
<thelema>
ok, go ahead
letrec has quit [Ping timeout: 252 seconds]
<thelema>
hmm, I'm tempted to jitter the iterations per sample, so that if there's an expensive GC run right at the end of each sample, it won't always be there
<thelema>
maybe min() is better than mean() for benchmarks... or at least it should be reported.