Gregory Crosswhite wrote:
Heinrich Apfelmus wrote:
Gregory Crosswhite wrote:
You're correct in pointing out that f uses memoization inside of
itself to cache the intermediate values that it commutes, but those
values don't get shared between invocations of f; thus, if you call
f with the
Gregory Crosswhite wrote:
You're correct in pointing out that f uses memoization inside of itself
to cache the intermediate values that it commutes, but those values
don't get shared between invocations of f; thus, if you call f with the
same value of n several times then the memo table
That actually doesn't work as long as memo is an array, since then it
has fixed size; you have to also make memo an infinitely large data
(but lazy) structure so that it can hold results for arbitrary n. One
option for doing this of course is to make memo be an infinite list, but
a more
Hello,
I agree that your answer is elegant, but it's not an efficient
algorithm in any language. How about this, keeping the rest of your
code the same?
import Data.Array.Diff
import Data.IArray
update :: (Char - [Int]) - DiffArray Int ModP - Char - DiffArray Int ModP
update lookup arr c = arr
I just discovered that changing DiffArray to a plain Array improves
performance of my code by almost a factor of 10. Bitten by DiffArray
yet again!
John
-- this is no good, just change DiffArray to Array.
update :: (Char - [Int]) - DiffArray Int ModP - Char - DiffArray Int ModP
update lookup
Am Sonntag 06 September 2009 13:36:57 schrieb John Lato:
I just discovered that changing DiffArray to a plain Array improves
performance of my code by almost a factor of 10. Bitten by DiffArray
yet again!
That's strange. Compiled without optimisations, using plain Array instead of
DiffArray
On Sun, Sep 6, 2009 at 4:30 PM, Daniel Fischerdaniel.is.fisc...@web.de wrote:
Am Sonntag 06 September 2009 13:36:57 schrieb John Lato:
I just discovered that changing DiffArray to a plain Array improves
performance of my code by almost a factor of 10. Bitten by DiffArray
yet again!
That's
Sorry for digging up such an old thread, but my undergraduate
dissertation is on this topic so I couldn't resist. :)
(Some credit in the following goes to my supervisor, Ulrich Berger.)
Mark Engelberg wrote:
I'd like to write a memoization utility. Ideally, it would look
something like
On 08/06/07, Peter Berry [EMAIL PROTECTED] wrote:
You could generate F and the Memoizable instance using TH or DrIFT or
the like (allowing derivation would be really nice :). Actually F
could be considered a dependent type, so you could define a pretty
much universal instance using TH with that
Rodrigo Queiro wrote:
sorear pointed me to this paper a while ago:
http://citeseer.ist.psu.edu/peytonjones99stretching.html
I never tried any of the code in the end, but it will probably be useful?
An implementation of that memo table scheme can be found here:
Mark Engelberg wrote:
I'd like to write a memoization utility. Ideally, it would look
something like this:
memoize :: (a-b) - (a-b)
memoize f gives you back a function that maintains a cache of
previously computed values, so that subsequent calls with the same
input will be faster.
apfelmus wrote:
Note that due to parametricity, any function of this type is necessarily
either id or _|_. In other words, there are only two functions of type
∀a∀b. (a-b) - (a-b)
You managed to type ∀ but you couldn't find ⊥ ?
OOC, can anybody tell me what ∀ actually means anyway?
You managed to type ∀ but you couldn't find ⊥ ?
OOC, can anybody tell me what ∀ actually means anyway?
It is called the 'universal quantifier' and means for all. It is often
used implicitly in natural language. e.g. cars are red can be expanded
to [for all elements of the set of cars] cars
Tony Morris wrote:
You managed to type ∀ but you couldn't find ⊥ ?
OOC, can anybody tell me what ∀ actually means anyway?
It is called the 'universal quantifier' and means for all. It is often
used implicitly in natural language. e.g. cars are red can be expanded
to [for all elements of
Andrew Coppin wrote:
OOC, can anybody tell me what ∀ actually means anyway?
http://en.wikipedia.org/wiki/Universal_quantification
http://en.wikipedia.org/wiki/System_F
I do recall that GHC has some weird extension called existential
quantification
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
apfelmus wrote:
Mark Engelberg wrote:
I'd like to write a memoization utility. Ideally, it would look
something like this:
memoize :: (a-b) - (a-b)
memoize f gives you back a function that maintains a cache of
previously computed values, so
16 matches
Mail list logo