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.
 | 
					! See http://factorcode.org/license.txt for BSD license.
 | 
				
			||||||
USING: accessors kernel kernel.private math math.private
 | 
					USING: accessors kernel kernel.private math math.private
 | 
				
			||||||
sequences sequences.private ;
 | 
					sequences sequences.private ;
 | 
				
			||||||
| 
						 | 
					@ -9,24 +9,16 @@ M: array length length>> ; inline
 | 
				
			||||||
M: array nth-unsafe [ >fixnum ] dip array-nth ; inline
 | 
					M: array nth-unsafe [ >fixnum ] dip array-nth ; inline
 | 
				
			||||||
M: array set-nth-unsafe [ >fixnum ] dip set-array-nth ; inline
 | 
					M: array set-nth-unsafe [ >fixnum ] dip set-array-nth ; inline
 | 
				
			||||||
M: array resize resize-array ; inline
 | 
					M: array resize resize-array ; inline
 | 
				
			||||||
 | 
					M: array equal? over array? [ sequence= ] [ 2drop f ] if ;
 | 
				
			||||||
: >array ( seq -- array ) { } clone-like ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
M: object new-sequence drop 0 <array> ; inline
 | 
					M: object new-sequence drop 0 <array> ; inline
 | 
				
			||||||
 | 
					 | 
				
			||||||
M: f new-sequence drop [ f ] [ 0 <array> ] if-zero ; inline
 | 
					M: f new-sequence drop [ f ] [ 0 <array> ] if-zero ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: array equal?
 | 
					 | 
				
			||||||
    over array? [ sequence= ] [ 2drop f ] if ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INSTANCE: array sequence
 | 
					INSTANCE: array sequence
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					: >array ( seq -- array ) { } clone-like ;
 | 
				
			||||||
: 1array ( x -- array ) 1 swap <array> ; inline
 | 
					: 1array ( x -- array ) 1 swap <array> ; inline
 | 
				
			||||||
 | 
					 | 
				
			||||||
: 2array ( x y -- array ) { } 2sequence ; inline
 | 
					: 2array ( x y -- array ) { } 2sequence ; inline
 | 
				
			||||||
 | 
					 | 
				
			||||||
: 3array ( x y z -- array ) { } 3sequence ; inline
 | 
					: 3array ( x y z -- array ) { } 3sequence ; inline
 | 
				
			||||||
 | 
					 | 
				
			||||||
: 4array ( w x y z -- array ) { } 4sequence ; inline
 | 
					: 4array ( w x y z -- array ) { } 4sequence ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PREDICATE: pair < array length 2 number= ;
 | 
					PREDICATE: pair < array length 2 number= ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,10 @@ kernel kernel.private math assocs quotations vectors
 | 
				
			||||||
hashtables sorting words sets math.order make ;
 | 
					hashtables sorting words sets math.order make ;
 | 
				
			||||||
IN: combinators
 | 
					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
 | 
					<PRIVATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: call-effect-unsafe ( quot effect -- ) drop call ;
 | 
					: call-effect-unsafe ( quot effect -- ) drop call ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue