<dan2>
so initial run is O(n), and every other time O(1)
<pango>
sure, but fib is not a function, it's a (lazy) value
<dan2>
but it caches values, so it's very similar
<pango>
well, to get the nth element, you still have to traverse n elements, like List.nth
<dan2>
memoization is usually a wrapper function around a function to save time down the road
<pango>
but additions are only done once
<pango>
that's how I understand the term memoization too, and why I'm not sure it applies here
<dan2>
it just caches entries as they're accessed in the list
<Smerdyakov>
"Lazy" is implemented with wrapper functions, no doubt; it's just that their domains are 'unit'.
<dan2>
pango: the value is there when you're using a Big number library with something like this
<pango>
well, implementation is straightforward, I'm just not sure one can use "memoization" and "lazy values" interchangeably. For one, both can be used to solve some kinds of problems... and they usually lead to different implementations
bebui has quit ["leaving"]
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
TFK has joined #ocaml
ziggurat has joined #ocaml
<pango>
(at least, used to be straightforward; it seems that they're now using a more efficient representation, with some help from the runtime...)
<dan2>
I wish I understood more of what the hell I'm doing with camlidl
ziggurat has quit ["This computer has gone to sleep"]
<dan2>
Smerdyakov: how easy did you say the foreign function interface with SML was?
<Smerdyakov>
There is no standard SML FFI.
<Smerdyakov>
I said that the MLton FFI was trivial to use.
<dan2>
Smerdyakov: does it allow for easy use of function pointers?
<Smerdyakov>
I don't know.
<dan2>
I should just finish this with camlidl
ziggurat has joined #ocaml
mauke has joined #ocaml
jajs has left #ocaml []
bluestorm has quit ["Konversation terminated!"]
malc_ has joined #ocaml
mikeX has joined #ocaml
<mikeX>
is there a way to somewhat emulate the behavior of raise, as in make a funtion that returns 'a regardless of input?
<ulfdoz>
nope, you must qualify (correct term) a type in some way.
<pango>
end with a function that doesn't return: raise itself, assert, ...
<malc_>
pango: Obj.magic
<mikeX>
well raise and assert interrupt execution, that's what I'm trying to avoid
<pango>
well, I was thinking of answers that do not break havok ;)
<pango>
mikeX: I do not see how that could work
<mikeX>
I see, thanks
<pango>
if condition then something else mymagicpolymorphicfunction ()
<mauke>
you're doing something wrong
<pango>
if the return value of the function is polymorphic, that expression will always be correctly typed, no matter what "something" returns
<mauke>
yeah. it also doesn't make any sense.
<pango>
receipe for disaster
<mikeX>
mauke: well I have a function that could raise Terminate, but doesn't always (based on some kriteria and with the help of kfprintf). I was trying to find a way to avoid having to return something on match e with .. | _ -> that_function ()
<mauke>
what's the context of that match?
<pango>
mikeX: much like if/then/else construct above, typing requires that the value returned by all branches have the same type
<mauke>
and what kind of value is that_function () supposed to return?