From: Björn Lindqvist Date: Wed, 28 Oct 2015 23:48:18 +0000 (+0100) Subject: arrays: make it so pair? doesn't call length, fixes #1496 X-Git-Tag: unmaintained~1756 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=1ee0823e52889ec2d3005d95ff744d89b6f0ea97 arrays: make it so pair? doesn't call length, fixes #1496 --- diff --git a/core/arrays/arrays-tests.factor b/core/arrays/arrays-tests.factor index e0d171a398..aa162751af 100644 --- a/core/arrays/arrays-tests.factor +++ b/core/arrays/arrays-tests.factor @@ -25,3 +25,7 @@ IN: arrays.tests ${ "kernel-error" ERROR-OUT-OF-FIXNUM-RANGE 147573952589676412928 f } = ] must-fail-with + +{ t } [ + 1 2 2array pair? +] unit-test diff --git a/core/arrays/arrays.factor b/core/arrays/arrays.factor index 8fc2f88b65..cd4c207afa 100644 --- a/core/arrays/arrays.factor +++ b/core/arrays/arrays.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors kernel math sequences sequences.private ; +USING: accessors kernel math sequences sequences.private slots.private ; IN: arrays BUILTIN: array { length array-capacity read-only initial: 0 } ; @@ -25,4 +25,4 @@ INSTANCE: array sequence : 3array ( x y z -- array ) { } 3sequence ; inline : 4array ( w x y z -- array ) { } 4sequence ; inline -PREDICATE: pair < array length 2 number= ; +PREDICATE: pair < array 1 slot 2 number= ;