From 41433da61bb490011d62acff99cdc34711cf44c5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 18 Feb 2010 01:57:22 +1300 Subject: [PATCH] core: minor cleanups --- core/arrays/arrays.factor | 14 +++----------- core/combinators/combinators.factor | 4 ++++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/arrays/arrays.factor b/core/arrays/arrays.factor index fa4d4b2f69..62a0774444 100644 --- a/core/arrays/arrays.factor +++ b/core/arrays/arrays.factor @@ -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 ; inline - M: f new-sequence drop [ f ] [ 0 ] 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 ; 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= ; diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor index 9016d540d7..7b9481825b 100644 --- a/core/combinators/combinators.factor +++ b/core/combinators/combinators.factor @@ -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 +