ulfdoz has quit [Read error: 60 (Operation timed out)]
pango_ has joined #ocaml
pango has quit [Remote closed the connection]
kuribas` has quit ["ERC Version 5.0.2 $Revision: 1.726.2.10 $ (IRC client for Emacs)"]
jcreigh has joined #ocaml
revision17_ is now known as Revision17
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
rk_afk is now known as ramkrsna
slipstream-- has joined #ocaml
slipstream has quit [Connection timed out]
ulfdoz has joined #ocaml
tristram has joined #ocaml
love-pingoo has joined #ocaml
mnemonic has joined #ocaml
Itkovian has joined #ocaml
mnemonic has quit ["leaving"]
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
Itkovian has quit []
bzzbzz has quit ["leaving"]
kuribas has joined #ocaml
mnemonic has joined #ocaml
chessguy has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
danly has quit [Remote closed the connection]
danly has joined #ocaml
dylan_ has joined #ocaml
dylan has quit [Read error: 104 (Connection reset by peer)]
woggle has quit [Remote closed the connection]
woggle has joined #ocaml
chessguy has quit [Connection timed out]
love-pingoo has joined #ocaml
smimou has joined #ocaml
woggle has quit [Read error: 104 (Connection reset by peer)]
woggle has joined #ocaml
jacobolus_ has joined #ocaml
<
jacobolus_>
what's the best way to count the number of items in a list which match some predicate?
jacobolus has joined #ocaml
jacobolus_ has left #ocaml []
<
kuribas>
That depends on what you mean by best.
<
aref>
He's left :)
<
aref>
I'm very new to Ocaml, but was going to answer List.map (predicate-function) [...] ;;
<
aref>
Would that be correct?
<
kuribas>
List.map returns a list, while he wants it to return a number.
<
kuribas>
An easy way but inefficient way would be List.filter and then List.length
<
aref>
Oh, okay, right, I missed that part of it.
rillig has quit [Remote closed the connection]
<
aref>
What would be an efficient way?
<
jacobolus>
I'm still here
<
jacobolus>
I did List.filter then List.length previously
<
jacobolus>
I was wondering if there was a better way :)
<
mellum>
fold_right
<
jacobolus>
I'm pretty much an ocaml newbie, and don't really understand how fold_right works. is there a good explanation somewhere?
<
dylan_>
let count f n x = if f x then succ n else n
<
dylan_>
let filter_count f l = List.fold_left (count f) 0 l
<
jacobolus>
dylan_: thanks
kuribas has quit ["ERC Version 5.0.2 $Revision: 1.726.2.10 $ (IRC client for Emacs)"]
<
jacobolus>
alright, gotta go for lunch. I'll try to learn about these fold functions. thanks all
dylan_ is now known as dylan
<
pango_>
mellum: fold_left actually... I think fold_right is not tail recursive
<
mellum>
yeah, right.
<
pango_>
no, left ;)
<
aref>
this is right interesting
mnemonic has quit ["leaving"]
mnemonic has joined #ocaml
chessguy has joined #ocaml
finelemo1 has joined #ocaml
finelemo2 has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
finelemo1 has quit [Read error: 110 (Connection timed out)]
ita has joined #ocaml
Snark has joined #ocaml
Snark has quit ["Leaving"]
jacobolus has quit [Read error: 104 (Connection reset by peer)]
jacobolus has joined #ocaml
Itkovian has joined #ocaml
chessguy has joined #ocaml
chessguy2 has joined #ocaml
<
ita>
chessguy2: d4
<
ita>
aref: hey ! :-)
<
aref>
hehe, hey :)
<
jacobolus>
are there 4 ppl in on this chess game?
<
jacobolus>
I say a4!
<
aref>
We like to mix it up :)
<
ita>
i do not play anymore :-/
<
aref>
Me neither, except the occasional game. No time, I'm afraid
<
ita>
btw, anyone here using the facile constraint library ?
chessguy has quit [Read error: 145 (Connection timed out)]
mnemonic has quit ["leaving"]
jacobolus has quit [Connection reset by peer]
jacobolus_ has joined #ocaml
chessguy has joined #ocaml
chessguy2 has quit [Read error: 145 (Connection timed out)]
ita is now known as ita|zzz
ita|zzz has quit ["Konversation terminated!"]
love-pingoo has quit ["Connection reset by pear"]
shawn has quit ["This computer has gone to sleep"]
tristram has quit [Read error: 110 (Connection timed out)]
Itkovian has quit []
mrsolo has left #ocaml []
slipstream has joined #ocaml
shawn has joined #ocaml
shawn has quit [Client Quit]
shawn has joined #ocaml
slipstream-- has quit [Connection timed out]
smimou has quit ["bli"]
jacobolus_ is now known as jacobolus