mattam has quit [Read error: 104 (Connection reset by peer)]
mattam has joined #ocaml
pnou has quit [Read error: 104 (Connection reset by peer)]
Banana_ has joined #ocaml
Banana has quit [Read error: 104 (Connection reset by peer)]
<twobitsprite>
I'm looking all over the manual, and I can't find a page the outlines all of the arithemtic operations...
zigong has joined #ocaml
mlh_ has joined #ocaml
<twobitsprite>
how can one fold the * operator? I tried "fold_right ( * ) [3;4];;" but it says "This expression has type 'a list but is here used with type int"
<avlondono>
twobitsprite: look at the type of the fold_right function, you're missing part of it. If the list is empty, what should be the result of that fold?
<avlondono>
though you probably figured it out long ago
<pnou_>
# List.fold_right ( * ) [3;4];;
<pnou_>
- : int -> int = <fun>
<pnou_>
it works
<twobitsprite>
ahh... I was actually using fold_left... fold_right does work... why is that?
<pnou_>
look at the type:
<pnou_>
# List.fold_left;;
<pnou_>
- : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a = <fun>
<twobitsprite>
I see
<pnou_>
must write fun x -> List.fold_left ( * ) x [3; 4]
ptolomy has joined #ocaml
<twobitsprite>
well... now that people are here... maybe you can answer me why "**" is float -> float -> float, and there is nothing for ints?
<twobitsprite>
i.e. is there a better way to get the n-power of an int?
<twobitsprite>
once again... silence...
<pnou_>
i don't think so, you got to write your own function
<twobitsprite>
lame...
<pnou_>
indeed
<twobitsprite>
I've never taken the power of a float before, I always see it done with ints... I just find it odd that a language would not support taking the power of an int...
<pnou_>
the standard library is quite poor in my opinion
<twobitsprite>
why is that? lack of developers?
<pnou_>
no, that's the INRIA policy
<pnou_>
standard library with just the essential
<twobitsprite>
power of int isn't essential?
<pnou_>
i don't agree with them
<pnou_>
ask them
<twobitsprite>
amd functional programming advocates wonder why thier langauges never gain favor in the industry...
<twobitsprite>
the only thing that for Python in the lime-light was it's "Batteries included" motto... developers like large standard libraries
<pnou_>
not functional programming, ocaml; that's their private view of what a standard library should be
<twobitsprite>
well... its true of most functional implementations... most of them have pretty shotty support for non-"essentials"
<pnou_>
it depends on where you put the edge
<pnou_>
in other words, if you compare to perl or if you compare to any mainstreamed compiled language
<pnou_>
anyway, time to go sleeping
zigong has quit [Remote closed the connection]
kothog has quit [Remote closed the connection]
Smerdyakov has joined #ocaml
mfurr has joined #ocaml
Smerdyakov has quit [Read error: 104 (Connection reset by peer)]
Herrchen_ has joined #ocaml
joeytwiddle has quit ["Leaving"]
Herrchen has quit [Read error: 110 (Connection timed out)]
UziMonkey has quit ["Leaving"]
UziMonkey has joined #ocaml
threeve has quit []
mlh_ has quit [brown.freenode.net irc.freenode.net]
mlh_ has joined #ocaml
slashvar[lri] has quit [brown.freenode.net irc.freenode.net]
mflux has quit [brown.freenode.net irc.freenode.net]
mflux has joined #ocaml
mlh_ has quit [brown.freenode.net irc.freenode.net]
slashvar[lri] has joined #ocaml
_shawn has quit [brown.freenode.net irc.freenode.net]
batdog|gone has quit [brown.freenode.net irc.freenode.net]
dan2_ has quit [brown.freenode.net irc.freenode.net]
mornfall has quit [brown.freenode.net irc.freenode.net]
oracle1 has quit [brown.freenode.net irc.freenode.net]
rossberg has quit [brown.freenode.net irc.freenode.net]
haelix has quit [brown.freenode.net irc.freenode.net]
pattern has quit [brown.freenode.net irc.freenode.net]
Schmurtz has quit [brown.freenode.net irc.freenode.net]
cmeme has quit [brown.freenode.net irc.freenode.net]
Mike_L has quit [brown.freenode.net irc.freenode.net]
det has quit [brown.freenode.net irc.freenode.net]
Revision17 has quit [brown.freenode.net irc.freenode.net]
slashvar[lri] has quit [brown.freenode.net irc.freenode.net]
ptolomy has quit [brown.freenode.net irc.freenode.net]
pango has quit [brown.freenode.net irc.freenode.net]
mflux has quit [brown.freenode.net irc.freenode.net]
Korollary has quit [brown.freenode.net irc.freenode.net]
skylan has quit [brown.freenode.net irc.freenode.net]
shrimpx_ has quit [brown.freenode.net irc.freenode.net]
mw has quit [brown.freenode.net irc.freenode.net]
noj has quit [brown.freenode.net irc.freenode.net]
UziMonkey has quit [brown.freenode.net irc.freenode.net]
pnou_ has quit [brown.freenode.net irc.freenode.net]
twobitsprite has quit [brown.freenode.net irc.freenode.net]
clog has joined #ocaml
slashvar[lri] has quit [calvino.freenode.net irc.freenode.net]
ptolomy has quit [calvino.freenode.net irc.freenode.net]
pango has quit [calvino.freenode.net irc.freenode.net]
avlondono has joined #ocaml
avlondono has quit [calvino.freenode.net irc.freenode.net]
ax has quit [calvino.freenode.net irc.freenode.net]
UziMonkey has quit [calvino.freenode.net irc.freenode.net]
pnou_ has quit [calvino.freenode.net irc.freenode.net]
twobitsprite has quit [calvino.freenode.net irc.freenode.net]
ulfdoz has quit [calvino.freenode.net irc.freenode.net]
TaXules has quit [calvino.freenode.net irc.freenode.net]
Amorphous has quit [calvino.freenode.net irc.freenode.net]
Demitar has quit [calvino.freenode.net irc.freenode.net]
haakonn has quit [calvino.freenode.net irc.freenode.net]
zvrba has quit [calvino.freenode.net irc.freenode.net]
calvin_ has quit [calvino.freenode.net irc.freenode.net]
Hipo has quit [calvino.freenode.net irc.freenode.net]
Hipo has joined #ocaml
noj has quit [calvino.freenode.net irc.freenode.net]
TaXules has joined #ocaml
zvrba has joined #ocaml
TeXitoi has quit [calvino.freenode.net irc.freenode.net]
Hadaka has quit [calvino.freenode.net irc.freenode.net]
juri has quit [calvino.freenode.net irc.freenode.net]
Demitar has joined #ocaml
pango has joined #ocaml
Naked has joined #ocaml
Demitar has quit [calvino.freenode.net irc.freenode.net]
TaXules has quit [calvino.freenode.net irc.freenode.net]
Hipo has quit [calvino.freenode.net irc.freenode.net]
Naked has quit [calvino.freenode.net irc.freenode.net]
Revision17 has quit [calvino.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
j_n has joined #ocaml
oracle1 has joined #ocaml
mfurr has joined #ocaml
Herrchen has joined #ocaml
batdog|gone has joined #ocaml
dan2_ has joined #ocaml
mornfall has joined #ocaml
haelix has joined #ocaml
rossberg has joined #ocaml
pattern has joined #ocaml
gim has joined #ocaml
vincenz has joined #ocaml
mlh_ has joined #ocaml
_shawn has joined #ocaml
yeknoMizU has joined #ocaml
Mike_L has joined #ocaml
Amorphous has joined #ocaml
haakonn has joined #ocaml
haakonn has quit [calvino.freenode.net irc.freenode.net]
haelix has quit [calvino.freenode.net irc.freenode.net]
batdog|gone has quit [calvino.freenode.net irc.freenode.net]
_shawn has quit [calvino.freenode.net irc.freenode.net]
vincenz has quit [calvino.freenode.net irc.freenode.net]
dan2_ has quit [calvino.freenode.net irc.freenode.net]
mornfall has quit [calvino.freenode.net irc.freenode.net]
pattern has quit [calvino.freenode.net irc.freenode.net]
rossberg has quit [calvino.freenode.net irc.freenode.net]
Herrchen has quit [calvino.freenode.net irc.freenode.net]
det has joined #ocaml
Demitar has joined #ocaml
TaXules has joined #ocaml
Hipo has joined #ocaml
mornfall has joined #ocaml
batdog|gone has joined #ocaml
rossberg has joined #ocaml
pattern has joined #ocaml
haelix_ has joined #ocaml
_shawn has joined #ocaml
Revision17 has joined #ocaml
dan2_ has joined #ocaml
yeknoMizU is now known as UziMonkey
ptolomy has joined #ocaml
cmeme has joined #ocaml
slashvar[lri] has joined #ocaml
TeXitoi has joined #ocaml
ax has joined #ocaml
Herrchen has joined #ocaml
mattam has joined #ocaml
Banana has joined #ocaml
booyaa has joined #ocaml
vincenz has joined #ocaml
avlondono has joined #ocaml
pnou has joined #ocaml
ulfdoz has joined #ocaml
calvin_ has joined #ocaml
cmeme has quit [Client Quit]
juri has joined #ocaml
cmeme has joined #ocaml
noj has joined #ocaml
cmeme has quit [Client Quit]
cmeme has joined #ocaml
cmeme has quit [Client Quit]
mlh_ has quit [Client Quit]
cmeme has joined #ocaml
cmeme has quit [Client Quit]
cmeme has joined #ocaml
haakonn has joined #ocaml
__DL__ has joined #ocaml
FrancisScott has joined #ocaml
FrancisScott has quit [Client Quit]
pango has quit [Remote closed the connection]
booyaa has quit ["leaving"]
mfurr has quit [Read error: 110 (Connection timed out)]
Korollary has quit [Ping timeout: 1080 seconds]
haelix_ is now known as haelix
Gueben has joined #ocaml
Snark has joined #ocaml
Submarine has joined #ocaml
Boojum has joined #ocaml
FrancisScott has joined #ocaml
Snark has quit [Nick collision from services.]
Boojum is now known as Snark
mornfall has quit [Connection timed out]
FrancisScott has quit [Client Quit]
Pita has joined #ocaml
Pita has quit [Read error: 131 (Connection reset by peer)]
mfurr has joined #ocaml
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
TeXitoi has joined #ocaml
vezenchio has joined #ocaml
meee has joined #ocaml
meee has quit ["leaving"]
chris__ has joined #ocaml
chris__ has quit [Client Quit]
FrancisScott has joined #ocaml
_shawn has quit ["Leaving"]
_shawn has joined #ocaml
chris__ has joined #ocaml
chris__ has quit ["leaving"]
Schmurtz has joined #ocaml
clog has joined #ocaml
haakonn has joined #ocaml
cmeme has joined #ocaml
cmeme has quit [Client Quit]
cmeme has joined #ocaml
mflux has joined #ocaml
cmeme has quit [Client Quit]
cmeme has joined #ocaml
cmeme has quit [Client Quit]
cmeme has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
Tachyon76 has joined #ocaml
threeve has joined #ocaml
slashvar[lri] has quit [Read error: 60 (Operation timed out)]
paganini has joined #ocaml
Tachyon76 has quit [Remote closed the connection]
mikeX has joined #ocaml
mikeX has quit [Client Quit]
Schmurtz has quit []
Schmurtz has joined #ocaml
slashvar[lri] has joined #ocaml
Rev17|work has joined #ocaml
paganini has quit ["Leaving"]
UziMonkey has left #ocaml []
Rev17|work has quit ["OMG WTF BBQ"]
Korollary has joined #ocaml
avlondono has quit [Nick collision from services.]
avlondon1 has joined #ocaml
Snark has quit [Read error: 60 (Operation timed out)]
Gueben has joined #ocaml
booyaa has joined #ocaml
mflux has quit [Read error: 54 (Connection reset by peer)]
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
Korollary has quit [Read error: 110 (Connection timed out)]
Schmurtz has joined #ocaml
pango has joined #ocaml
KAeL has joined #ocaml
zigong has joined #ocaml
rober has joined #ocaml
<rober>
hi
<KAeL>
hi
FrancisScott has quit [Client Quit]
rober has quit [Remote closed the connection]
kothog has joined #ocaml
Snark has joined #ocaml
mflux has joined #ocaml
avlondono has joined #ocaml
<avlondono>
question about polymorphic types
<avlondono>
let f = function #a as x -> x | #b as y -> y
<avlondono>
say type a = [`A] and b = [`B]
<avlondono>
the type of f is [< `A | `B] -> [>`A | `B]
<avlondono>
now I define
<avlondono>
let g (x : a) = x
<avlondono>
let h (x : b) = x
<avlondono>
then the following won't work:
<avlondono>
let f = function #a as x -> g x | #b as y -> h y
<avlondono>
I understand the constraint of g as the type system assumes the output of the function must be the type of the output of g, but I can't figure what should I tell the compiler to make sure the constraint is not propagated early
KAeL has left #ocaml []
<Schmurtz>
g x don't have the same type of h y
<avlondono>
I understand that
<Schmurtz>
did you try with : let g (x : a) = (x: [>`A | `B])
<Schmurtz>
or something like that
<avlondono>
I tried several combinations, including that (I think)
<avlondono>
let me try again
<avlondono>
it's been like an hour so I have tried many things
<Schmurtz>
however, I have no experience with `A type, so I can't help very much
<avlondono>
thanks anyway
Amorphous has quit ["arg... must... shutdown... computer burnin..."]
<avlondono>
ok it was in the manual (as usual)
<Schmurtz>
lol
mflux has quit [Remote closed the connection]
mflux has joined #ocaml
AngleSaxe has joined #ocaml
AngleSaxe is now known as Dodecahedron
<ax>
what does ` do in this case?
<avlondono>
it makes the variant type polymorphic
<avlondono>
you don't need to declare them and they are not tied to a particular type
<avlondono>
the type system checks if you are being consistent in their usage or not
<ax>
hmm, i need to read more i guess
<avlondono>
in some way it is (at least for me), like types are collections of those polymorphic variants
Submarine has quit ["Leaving"]
<avlondono>
ax: it is one of the coolest things I have learned in ocaml
<avlondono>
and also very tricky
<ax>
yes, i am still rather confused about some things in ocaml, i need to read more deeply and do more exersizes i think
<ax>
now that i have some free time i'll be doing that
<avlondono>
there is a paper of Jacques Garrigue thaat is quite illustrative about this particular thing
<avlondono>
Code Reuse Through Polymorphic Variants
<avlondono>
it's on his website
<ax>
i'll look that up, thank you
mrsolo has joined #ocaml
Snark has quit ["Leaving"]
joeytwiddle has joined #ocaml
<Schmurtz>
ax, don't worry, many ocaml features are not essential
Dodecahedron has quit [Client Quit]
threeve has quit []
zigong has quit [Read error: 104 (Connection reset by peer)]
kothog has quit []
mflux has quit [Remote closed the connection]
mflux has joined #ocaml
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]
threeve has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
Gueben has quit [Read error: 104 (Connection reset by peer)]