sequence= is now inlined

slava 2006-08-07 19:41:31 +00:00
parent bd4f48f9c2
commit 55ec0e3a91
14 changed files with 34 additions and 26 deletions

View File

@ -1,6 +1,5 @@
+ 0.84: + 0.84:
- mach_signal not working, right now
- fix contribs: boids, automata - fix contribs: boids, automata
- sometimes darcs get fails with the httpd - sometimes darcs get fails with the httpd
- gdb triggers 'mutliple i/o ops on port' error - gdb triggers 'mutliple i/o ops on port' error
@ -20,12 +19,12 @@
- see if alien calls can be made faster - see if alien calls can be made faster
- faster sequence= for UI - faster sequence= for UI
- remove literal table - remove literal table
- generic 'define ( asset def -- )'
======================================================================== ========================================================================
+ ui: + ui:
- doc front page: document stack effect notation
- better doc for accumulate, link from tree - better doc for accumulate, link from tree
- we have trouble drawing rectangles - we have trouble drawing rectangles
- the UI listener has a shitty design. perhaps it should not call out - the UI listener has a shitty design. perhaps it should not call out
@ -72,6 +71,7 @@
+ module system: + module system:
- generic 'define ( asset def -- )'
- track individual method usages - track individual method usages
- C types should be words - C types should be words
- TYPEDEF: float { ... } { ... } ; ==> \ float T{ c-type ... } "c-type" swp - TYPEDEF: float { ... } { ... } ; ==> \ float T{ c-type ... } "c-type" swp

View File

@ -39,6 +39,8 @@ parser sequences sequences-internals words ;
[ [
\ number= compile \ number= compile
\ + compile \ + compile
\ nth compile
\ set-nth compile
\ = compile \ = compile
{ "kernel" "sequences" "assembler" } compile-vocabs { "kernel" "sequences" "assembler" } compile-vocabs

View File

@ -231,9 +231,8 @@ M: hashtable clone ( hash -- hash )
: hashtable= ( hash hash -- ? ) : hashtable= ( hash hash -- ? )
2dup subhash? >r swap subhash? r> and ; 2dup subhash? >r swap subhash? r> and ;
M: hashtable = ( obj hash -- ? ) M: hashtable equal? ( obj hash -- ? )
{ {
{ [ 2dup eq? ] [ 2drop t ] }
{ [ over hashtable? not ] [ 2drop f ] } { [ over hashtable? not ] [ 2drop f ] }
{ [ 2dup [ hash-size ] 2apply number= not ] [ 2drop f ] } { [ 2dup [ hash-size ] 2apply number= not ] [ 2drop f ] }
{ [ t ] [ hashtable= ] } { [ t ] [ hashtable= ] }

View File

@ -127,17 +127,22 @@ M: object like drop ;
: sequence= ( seq seq -- ? ) : sequence= ( seq seq -- ? )
2dup [ length ] 2apply tuck number= 2dup [ length ] 2apply tuck number=
[ (mismatch) -1 number= ] [ 3drop f ] if ; [ (mismatch) -1 number= ] [ 3drop f ] if ; inline
M: array equal? ( obj seq -- ? )
over array? [ sequence= ] [ 2drop f ] if ;
M: quotation equal? ( obj seq -- ? )
over quotation? [ sequence= ] [ 2drop f ] if ;
M: sbuf equal? ( obj seq -- ? )
over sbuf? [ sequence= ] [ 2drop f ] if ;
M: vector equal? ( obj seq -- ? )
over vector? [ sequence= ] [ 2drop f ] if ;
UNION: sequence array string sbuf vector quotation ; UNION: sequence array string sbuf vector quotation ;
M: sequence = ( obj seq -- ? )
2dup eq? [
2drop t
] [
over type over type eq? [ sequence= ] [ 2drop f ] if
] if ;
M: sequence hashcode ( hash -- n ) M: sequence hashcode ( hash -- n )
dup empty? [ drop 0 ] [ first hashcode ] if ; dup empty? [ drop 0 ] [ first hashcode ] if ;

View File

@ -4,7 +4,7 @@ IN: strings
USING: generic kernel kernel-internals math sequences USING: generic kernel kernel-internals math sequences
sequences-internals ; sequences-internals ;
M: string = ( obj str -- ? ) M: string equal? ( obj str -- ? )
over string? [ over string? [
over hashcode over hashcode number= over hashcode over hashcode number=
[ sequence= ] [ 2drop f ] if [ sequence= ] [ 2drop f ] if

View File

@ -8,7 +8,7 @@ sequences ;
UNION: c-ptr byte-array alien ; UNION: c-ptr byte-array alien ;
M: alien = ( obj obj -- ? ) M: alien equal? ( obj obj -- ? )
over alien? [ over alien? [
2dup [ expired? ] 2apply 2dup or [ 2dup [ expired? ] 2apply 2dup or [
2swap 2drop 2swap 2drop

View File

@ -12,7 +12,7 @@ TUPLE: node param shuffle
classes literals history classes literals history
successor children ; successor children ;
M: node = eq? ; M: node equal? eq? ;
: make-node ( param in-d out-d in-r out-r node -- node ) : make-node ( param in-d out-d in-r out-r node -- node )
[ >r swapd <shuffle> f f f f f <node> r> set-delegate ] keep ; [ >r swapd <shuffle> f f f f f <node> r> set-delegate ] keep ;

View File

@ -17,7 +17,7 @@ C: value ( obj -- value )
M: value hashcode value-uid ; M: value hashcode value-uid ;
M: value = eq? ; M: value equal? eq? ;
M: integer value-uid ; M: integer value-uid ;

View File

@ -80,11 +80,10 @@ TUPLE: check-tuple class ;
M: tuple clone ( tuple -- tuple ) M: tuple clone ( tuple -- tuple )
(clone) dup delegate clone over set-delegate ; (clone) dup delegate clone over set-delegate ;
M: tuple hashcode ( tuple -- n ) class hashcode ; M: tuple hashcode ( tuple -- n ) 2 slot hashcode ;
M: tuple = ( obj tuple -- ? ) M: tuple equal? ( obj tuple -- ? )
2dup eq? over tuple? [ tuple= ] [ 2drop f ] if ;
[ 2drop t ] [ over tuple? [ tuple= ] [ 2drop f ] if ] if ;
: (delegates) ( obj -- ) : (delegates) ( obj -- )
[ dup delegate (delegates) , ] when* ; [ dup delegate (delegates) , ] when* ;

View File

@ -10,8 +10,11 @@ USING: generic kernel-internals math math-internals ;
GENERIC: hashcode ( obj -- n ) GENERIC: hashcode ( obj -- n )
M: object hashcode drop 0 ; M: object hashcode drop 0 ;
GENERIC: = ( obj obj -- ? ) GENERIC: equal? ( obj obj -- ? )
M: object = eq? ; M: object equal? eq? ;
: = ( obj obj -- ? )
2dup eq? [ 2drop t ] [ equal? ] if ; inline
GENERIC: <=> ( obj1 obj2 -- n ) GENERIC: <=> ( obj1 obj2 -- n )

View File

@ -13,7 +13,7 @@ UNION: number real complex ;
M: real real ; M: real real ;
M: real imaginary drop 0 ; M: real imaginary drop 0 ;
M: number = ( n n -- ? ) number= ; M: number equal? ( n n -- ? ) number= ;
: rect> ( xr xi -- x ) : rect> ( xr xi -- x )
over real? over real? and [ over real? over real? and [

View File

@ -4,7 +4,7 @@ IN: kernel
USING: arrays generic kernel-internals math namespaces sequences USING: arrays generic kernel-internals math namespaces sequences
sequences-internals words ; sequences-internals words ;
M: wrapper = M: wrapper equal?
over wrapper? [ [ wrapped ] 2apply = ] [ 2drop f ] if ; over wrapper? [ [ wrapped ] 2apply = ] [ 2drop f ] if ;
M: quotation clone (clone) ; M: quotation clone (clone) ;

View File

@ -25,7 +25,7 @@ SYMBOL: open-fonts
! sprites is a vector. ! sprites is a vector.
TUPLE: font ascent descent height handle widths ; TUPLE: font ascent descent height handle widths ;
M: font = eq? ; M: font equal? eq? ;
: close-font ( font -- ) font-handle FT_Done_Face ; : close-font ( font -- ) font-handle FT_Done_Face ;

View File

@ -50,7 +50,7 @@ pref-dim parent children orientation state
visible? root? clipped? grafted? visible? root? clipped? grafted?
interior boundary ; interior boundary ;
M: gadget = eq? ; M: gadget equal? eq? ;
: gadget-child gadget-children first ; : gadget-child gadget-children first ;