 ! Copyright (C) 2007, 2010 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel hashtables sequences sequences.private arrays
-words namespaces make parser effects.parser math assocs effects
-definitions quotations summary accessors fry hashtables.identity ;
+USING: accessors arrays assocs combinators definitions effects
+effects.parser fry hashtables.identity kernel math sequences
+sequences.private words ;
 IN: memoize
 
 <PRIVATE

: make/n ( table quot effect -- quot )
    [ unpack/pack '[ _ _ cache ] ] keep pack/unpack ;

: make/0 ( table quot effect -- quot )
    out>> [
        packer '[

    ] keep unpacker compose ;

: make-memoizer ( table quot effect -- quot )
    dup in>> length {
        { 0 [ make/0 ] }
        { 1 [ make/1 ] }
        [ drop make/n ]
    } case ;

PRIVATE>

