core: minor cleanups
parent
63928191e7
commit
41433da61b
|
@ -1,4 +1,4 @@
|
|||
! Copyright (C) 2005, 2008 Slava Pestov.
|
||||
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel kernel.private math math.private
|
||||
sequences sequences.private ;
|
||||
|
@ -9,24 +9,16 @@ M: array length length>> ; inline
|
|||
M: array nth-unsafe [ >fixnum ] dip array-nth ; inline
|
||||
M: array set-nth-unsafe [ >fixnum ] dip set-array-nth ; inline
|
||||
M: array resize resize-array ; inline
|
||||
|
||||
: >array ( seq -- array ) { } clone-like ;
|
||||
|
||||
M: array equal? over array? [ sequence= ] [ 2drop f ] if ;
|
||||
M: object new-sequence drop 0 <array> ; inline
|
||||
|
||||
M: f new-sequence drop [ f ] [ 0 <array> ] if-zero ; inline
|
||||
|
||||
M: array equal?
|
||||
over array? [ sequence= ] [ 2drop f ] if ;
|
||||
|
||||
INSTANCE: array sequence
|
||||
|
||||
: >array ( seq -- array ) { } clone-like ;
|
||||
: 1array ( x -- array ) 1 swap <array> ; inline
|
||||
|
||||
: 2array ( x y -- array ) { } 2sequence ; inline
|
||||
|
||||
: 3array ( x y z -- array ) { } 3sequence ; inline
|
||||
|
||||
: 4array ( w x y z -- array ) { } 4sequence ; inline
|
||||
|
||||
PREDICATE: pair < array length 2 number= ;
|
||||
|
|
|
@ -5,6 +5,10 @@ kernel kernel.private math assocs quotations vectors
|
|||
hashtables sorting words sets math.order make ;
|
||||
IN: combinators
|
||||
|
||||
! Most of these combinators have compile-time expansions in
|
||||
! the optimizing compiler. See stack-checker.transforms and
|
||||
! compiler.tree.propagation.call-effect
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: call-effect-unsafe ( quot effect -- ) drop call ;
|
||||
|
|
Loading…
Reference in New Issue