Paste: testcase

Author: slava
Mode: factor
Date: Sat, 10 Oct 2009 01:42:15
Plain Text |
TUPLE: testing ;

USING: kernel scratchpad sequences ;
M: testing length drop 8 ;

USING: combinators kernel memory scratchpad sequences.private ;
M: testing nth-unsafe
    swap {
        { 0 [ size ] }
        { 1 [ size ] }
        { 2 [ size ] }
        { 3 [ size ] }
        { 4 [ size ] }
        { 5 [ size ] }
        { 6 [ size ] }
        { 7 [ size ] }
    } case ; inline

[ { testing testing } declare [ rest-slice ] [ unclip-slice ] bi* -rot [ 8 ] 2dip [ [ nth-unsafe ] bi-curry@ bi drop nip ] 2curry each-integer ] optimized.

Annotation: simpler testcase

Author: slava
Mode: factor
Date: Sat, 10 Oct 2009 01:55:54
Plain Text |
[
    [ 16 8 ] 2dip
    [
        [
            [ 1 + ] dip
            drop {
                { 0 [ 16 ] }
                { 1 [ 16 ] }
                { 2 [ 16 ] }
                { 3 [ 16 ] }
                { 4 [ 16 ] }
                { 5 [ 16 ] }
                { 6 [ 16 ] }
                { 7 [ 16 ] }
            } case
        ] [
            drop {
                { 0 [ 16 ] }
                { 1 [ 16 ] }
                { 2 [ 16 ] }
                { 3 [ 16 ] }
                { 4 [ 16 ] }
                { 5 [ 16 ] }
                { 6 [ 16 ] }
                { 7 [ 16 ] }
            } case
        ] bi-curry* bi drop nip
    ] 2curry each-integer
] optimized.

Annotation: even simpler

Author: slava
Mode: factor
Date: Sat, 10 Oct 2009 02:00:51
Plain Text |
[
    0 2
    [
        nip
        [
            1 + {
                [ 16 ]
                [ 16 ]
                [ 16 ]
            } dispatch
        ] [
            {
                [ ]
                [ ]
                [ ]
            } dispatch
        ] bi
    ] each-integer
] optimized.

New Annotation

Summary:
Author:
Mode:
Body: