mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
yminsky_ has quit [Read error: 110 (Connection timed out)]
hkBst has quit ["Konversation terminated!"]
yminsky_ has joined #ocaml
ikaros has quit ["segfault"]
yminsky_ has quit [Client Quit]
vpalle has quit ["Leaving"]
yminsky_ has joined #ocaml
LordMetroid has quit ["Leaving"]
gaja has quit [Remote closed the connection]
gaja has joined #ocaml
rodge has quit [Remote closed the connection]
RobertFischer has joined #ocaml
<det> Let's say I have a function:
<det> let divmod a b = (a / b, a mod b)
<det> and then in another function I do:
<det> let (q, r) = divmod a b
<det> Will Ocaml optimize away the tuple allocation?
<RobertFischer> Almost certainly not.
<RobertFischer> But if that's your biggest problem, I envy you -- tuple allocation is very fast in Ocaml.
<det> It's not a problem, just a curiosity.
<det> But it does make me appreciate MLton.
yminsky_ has quit []
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
seafood_ has joined #ocaml
yminsky_ has joined #ocaml
yminsky_ has quit []
yminsky_ has joined #ocaml
ikatz has quit ["BitchX-1.1-final -- just do it."]
ikatz has joined #ocaml
yminsky_ has quit [Read error: 110 (Connection timed out)]
jdrake has quit [Connection timed out]
gaja has quit [Remote closed the connection]
gaja has joined #ocaml
olleolleolle has joined #ocaml
filp has joined #ocaml
seafood_ has quit []
seafood_ has joined #ocaml
middayc has joined #ocaml
filp has quit ["Bye"]
olleolleolle has quit []
ygrek has joined #ocaml
seafood_ has quit []
al-maisan has joined #ocaml
Tetsuo has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
olleolleolle has joined #ocaml
Linktim has joined #ocaml
filp has joined #ocaml
mqtt has quit ["Quitte"]
Yoric[DT] has joined #ocaml
acatout has quit [Remote closed the connection]
olleolleolle has left #ocaml []
acatout has joined #ocaml
<rwmjones_> det, no, and it also won't do a single IDIV operation to get both the div & the mod
<rwmjones_> there's no way to do that afaik
hkBst has joined #ocaml
<det> Thanks.
<det> Without the tuple optimization, I don't see how you could use IDIV in an efficient way, anyways.
YOMMCC has joined #ocaml
<YOMMCC> You do not believe that is not afraid, afraid you can not see . http://freedom.ws/yomgdi
YOMMCC has left #ocaml []
Linktim_ has joined #ocaml
Linktim has quit [Read error: 104 (Connection reset by peer)]
middayc has quit []
seafood_ has joined #ocaml
Snark has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> rwmjones: ping
jonafan_ has joined #ocaml
Linktim- has joined #ocaml
petchema has quit [Remote closed the connection]
jonafan has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
olleolleolle has joined #ocaml
yminsky_ has joined #ocaml
yminsky_ has quit [Client Quit]
Linktim- has quit [Read error: 110 (Connection timed out)]
yminsky_ has joined #ocaml
seafood_ has quit []
yminsky_ has quit []
Tetsuo has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
structured has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
petchema has joined #ocaml
middayc has joined #ocaml
Linktim has joined #ocaml
Linktim_ has quit [Read error: 104 (Connection reset by peer)]
Linktim_ has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
ikaros has joined #ocaml
rwmjones has quit [Read error: 104 (Connection reset by peer)]
rwmjones_ has quit [Read error: 104 (Connection reset by peer)]
ygrek has quit [Remote closed the connection]
rwmjones has joined #ocaml
Tetsuo has joined #ocaml
olleolleolle has left #ocaml []
Linktim has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
LordMetroid has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
^authentic has joined #ocaml
imz has joined #ocaml
<imz> this is probably a familiar question, but has there been any work done on optimizing the space-complexity of this sort of function:
<imz> let rec summation = function [] -> 0 | n :: tail -> n + summation tail
<imz> i was surprised that ocaml could not figure out how to optimize that
<imz> (but then, i have no idea how hard that would be; it only seems easy from a very far distance)
middayc has quit []
<orbitz> you are refering to the deforestation section of the blog post i take it?
<flux> imz, I suppose such optimizations would be possible. however, it could be very difficult for the programmer to see which cases end up being optimized and which not; a slight change could affect that a lot
<orbitz> in such a simple case i think ocaml could make the optimization but there are rarely ever such trivial examples ina program that implementing th eopimization probably isn't worth it
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
^authentic has joined #ocaml
<imz> yeah, the function "+" has to be associative, i suppose; i haven't considered how often that is the case in practice.
<imz> the absence of this optimization in ocaml may be evidence that the answer is "not very often"
<Yoric[DT]> Especially since + may easily be redefined to something non-associative.
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
pango has quit [Remote closed the connection]
pango has joined #ocaml
<imz> interesting: List.for_all seems to be optimized in this way. it is not marked tail-recursive in the documentation and does not overflow the stack - unlike my summation function.
<imz> let rec for_all p = function
<imz> [] -> true
<imz> | a::l -> p a && for_all p l
<imz> s/tail-recursive/non-tail-recursive/
Axioplase has joined #ocaml
<flux> imz, but && is actually a shortcutting operator
<flux> imz, the left side of the argument is forgotten once it is evaluated to be true
<imz> ah, i see.
Maddas has quit [Remote closed the connection]
Axioplase has quit [Remote closed the connection]
Axioplase has joined #ocaml
filp has quit ["Bye"]
Linktim_ has quit [Read error: 104 (Connection reset by peer)]
Linktim_ has joined #ocaml
psnively has joined #ocaml
psnively has quit [Client Quit]
psnively has joined #ocaml
<psnively> Testing.
<psnively> Good morning, Camlers.
rwmjones has quit ["Closed connection"]
filp has joined #ocaml
jonafan_ is now known as jonafan
<al-maisan> psnively: it's late afternoon here but hello and welcome :-)
LordMetroid has quit ["Leaving"]
Linktim_ has quit [Remote closed the connection]
imz has quit ["Leaving."]
smimou has quit ["bli"]
nysin has joined #ocaml
Linktim has joined #ocaml
<struk_atwork> good afternoon...3 hours until work is over
<flux> good evening.
<psnively> al-maisan: Good point. :-)
<al-maisan> :-)
<struk_atwork> so I still really have no clue when a module is more appropriate than a class, and vice versa. guess I'll have to learn the empirical way
<nysin> I found out today that F# has neither. That made it a lot less interesting for anything except being an interactive .Net console (which is useful)
<nysin> Or well, it has .Net classes probably.
<struk_atwork> nysin: it does..and .NET has classes and structs I thought? no functors though
<struk_atwork> nysin, er not .NET, F#+.NET
<nysin> bleh, yeah, I mistyped.
<nysin> But lacking the ability to manipulate them that way they're less useful
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
<struk_atwork> nysin: manipulate via functors you mean?
<nysin> yes
<orbitz> classes make sense when you you want yoru data to be polymorphic i would imagien
LordMetroid has joined #ocaml
<struk_atwork> nysin, I can't vouch for or against F# (save it's MS tech and that stinks). However, they may have not been able to implement functors easily or at all due to compatibility with .NET api / libs
<hcarty> struk_atwork: Classes are handy when you need subtyping. Performance is generally pretty similar between classes and modules in my experience.
<nysin> struk_atwork, oh certainly. They seem to generally try to keep O'Caml features if possible. That they didn't suggests that they could not. It does mean that F# loses a lot of 'oh if I want to run an ML-like language but want it on .Net for some reason' appeal.
<struk_atwork> hcarty, subtyping? got a good link for that technique?
<palomer> man
<palomer> I'm a _huge_ fan of polymorphic variants
<orbitz> you would be
<hcarty> struk_atwork: (let f c x y = x#foo x y) will work on any class with an appropriate method foo
<hcarty> Sorry, that should be: let f c x y = c#foo x y
<struk_atwork> hcarty, reviewing subtype wiki...one sec
<flux> one of the the main advantages of classes versus modules is that you don't need to keep repeating the Module the value originates from, nor you need to open the modules
<flux> but then again classes cannot contain types, so they aren't full replacements
<hcarty> struk_atwork: The OCaml manual intro can be helpful as well: http://caml.inria.fr/pub/docs/manual-ocaml/
<struk_atwork> hcarty, reviewed. it sounds like a generalization of inheritance essentially
<flux> objects cannot be pattern matched, and at times they are less concenient than records of closures
<hcarty> It is often a matter of which syntax and programming style you prefer though
<flux> I don't know which one is more efficient though, records of closures or methods; maybe records, as I believe it is more complicated to find the method of an object
<hcarty> flux: According to some list posts (I don't have the link...) objects can be faster
<struk_atwork> flux: yeah I've been trying to think beyond the fact that classes are modules where "self" is an implicit parameter..I know they must be much different than that
<hcarty> They cost less to allocate, and the method calls can be cached
<al-maisan> Hello there!
<al-maisan> Could someone please explain how to set the 'minor_heap_size' for the garbage collector?
<al-maisan> A pointer to a web page etc. would be fine as well..
<al-maisan> also, what are the default minor/major heap sizes? Is this documented anywhere?
<orbitz> al-maisan: perhaps with ocamlrun?
<orbitz> yep
<orbitz> ocamlrun will do it
<al-maisan> OKJ
<orbitz> and i htink a natively compield one will read OCAMLRUNPARAMS
<al-maisan> Ah, that's interesting..
Snark has quit ["Ex-Chat"]
<al-maisan> orbitz: thanks very much!
<orbitz> np
middayc has joined #ocaml
Linktim has quit [Remote closed the connection]
Linktim has joined #ocaml
smimou has joined #ocaml
al-maisan has quit ["Leaving."]
authentic has quit [Read error: 110 (Connection timed out)]
<psnively> I <3 polymorphic variants too.
<orbitz> i </3 them
nysin has quit ["Leaving"]
ygrek has quit [Remote closed the connection]
Axioplase has quit [Read error: 104 (Connection reset by peer)]
psnively has quit []
<palomer> double coercions are cool!
<palomer> they make classes so much more useful
<palomer> though the fact that ref is invariant kinda sucks
<orbitz> what are they palomer ?
jdrake has joined #ocaml
smimou has quit ["bli"]
Axioplase has joined #ocaml
LordMetroid has quit [Connection reset by peer]
LordMetroid has joined #ocaml
Axioplase has quit ["brb"]
Axioplase has joined #ocaml
Axioplase has quit [Client Quit]
Axioplase has joined #ocaml
middayc has quit []
<palomer> orbitz, in ocaml, the name of a class and the virtual methods it inherits has no bearings on its type
<palomer> similarly for types
<palomer> however, ocaml forces you to state what type you want to cast to
<palomer> hence the need for double coercions
rodge has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
filp has quit ["Bye"]
Linktim has quit [Remote closed the connection]
ikaros has left #ocaml []
<orbitz> palomer: i'll double yoru coercion
sporkmonger has joined #ocaml
Axioplase has quit [Connection reset by peer]
smimou has joined #ocaml
LordMetroid has quit ["Leaving"]
jdrake has quit ["Ex-Chat"]
Tetsuo has quit ["Leaving"]
hkBst has quit ["Konversation terminated!"]