Commit graph

14 commits

Author SHA1 Message Date
Christophe Rhodes 12332bbfc7 Restore funcallable sequences
Absence of tests meant that a prior simplification (revision
17945c81f9) removed the ability to
inherit simultaneously from SEQUENCE and FUNCTION, breaking example
code in the extensible sequences ILC paper.  Restore this, attempting
to explain various things about the current system in response to a
comment, and include tests to hopefully preserve subclassing of
FUNCTION, SEQUENCE and STREAM independently of each other.

Additionally fix the COERCE transform to transform into sequence
coercion if the type argument names an extended sequence class.

Fixes lp#2050088
2024-01-28 22:03:08 +00:00
Jan Moringen a7adde52ba Implement READ-SEQUENCE for user-defined sequences 2023-11-21 00:32:35 +01:00
Jan Moringen 297c12f808 Implement WRITE-SEQUENCE for user-defined sequences 2023-11-21 00:32:35 +01:00
Jan Moringen 7cd2c9fbb3 Make bindings in SEQUENCE:WITH-SEQUENCE-ITERATOR-FUNCTIONS optional
Omitting variables or supplying NIL causes the corresponding function
binding to be omitted. Established functions are no longer ignorable.
2023-11-21 00:32:34 +01:00
Bike 05471076c3 Fix MAP-INTO-ing extended sequences
Use the required protocol functions.
2020-10-03 23:47:37 +03:00
Christophe Junke 5760fe4fc1 Fix probable copy-paste error in list iterator, from end
The following code failed:

     (sb-sequence:with-sequence-iterator-functions
         (next stop value _set _index _copy)
         ('(a b c d) :from-end t)
       (loop until (stop) collect (value) do (next)))

... with the following error:

    The value
      (D)
    is not of type
      NUMBER
    when binding SB-KERNEL::X
       [Condition of type TYPE-ERROR]
2018-10-25 02:27:57 +03:00
Stas Boukarev 224dc9e9af tests: Remove redundant LOADs and USE-PACKAGEs. 2018-03-20 21:04:19 +03:00
Jan Moringen 59945c5f90 Uniformly expand RESULT-TYPE in MAKE-SEQUENCE, MAP, MERGE, CONCATENATE
* Previously, MAKE-SEQUENCE expanded RESULT-TYPE while MAP, MERGE and
  CONCATENATE did not.

* WHEN-EXTENDED-SEQUENCE-TYPE helps doing this without code duplication.
2016-03-14 23:37:49 +01:00
Jan Moringen c52f46ef61 Use new WHEN-EXTENDED-SEQUENCE-TYPE in MAKE-SEQUENCE, MAP, CONCATENATE, MERGE 2016-03-14 23:37:49 +01:00
Jan Moringen a9dc8e55f1 Fix type-relations between EXTENDED-SEQUENCE and [FUNCALLABLE-]INSTANCE
SUBTYPEP behavior (unchanged):

  (subtypep 'extended-sequence 'instance)             => nil, t
  (subtypep 'instance 'extended-sequence)             => nil, t

  (subtypep 'extended-sequence 'funcallable-instance) => nil, t
  (subtypep 'funcallable-instance 'extended-sequence) => nil, t

New TYPE-INTERSECTION behavior:

     (type-intersection extended-sequence instance)
  == (type-intersection instance extended-sequence)
  => (and extended-sequence instance) instead of empty type

     (type-intersection extended-sequence funcallable-instance)
  == (type-intersection funcallable-instance extended-sequence)
  => (and extended-sequence funcallable-instance) instead of empty type
2016-03-14 23:36:05 +01:00
Jan Moringen b7bdbc4d0d Fix result sequence creation in SEQUENCE:MAP
It passed (class-of result-prototype) to MAKE-SEQUENCE which, in the
best case, would go back to the prototype of the class and call
SEQUENCE:MAKE-SEQUENCE-LIKE on it.

All subtype queries and whatnot performed by MAKE-SEQUENCE before
finally calling SEQUENCE:MAKE-SEQUENCE-LIKE are unnecessary in the
common case of SEQUENCE:MAP being called from MAP in which case the
result type is an extended sequence.

Instead, directly call SEQUENCE:MAKE-SEQUENCE-LIKE on RESULT-PROTOTYPE.

This is what SEQUENCE:{CONCATENATE,MERGE} already do.
2016-03-09 21:17:24 +01:00
Jan Moringen 5b1da7212e MAKE-SEQUENCE accepts extended sequence class objects as result-type 2016-03-09 21:17:24 +01:00
Stas Boukarev 4e4d7e4108 Replace (assert (raises-error? ...)) with assert-error. 2014-05-29 18:15:34 +04:00
Mark Cox cdbc1eb4a5 MAKE-SEQUENCE signals correct error for incompletely user-defined sequences
For the following situation:
- result type is a type specifier designating a DEFTYPEd type
- the type expands to a the name of a user-defined sequence class
- not all mandatory sequence protocol methods are define for the
  user-define sequence class
MAKE-SEQUENCE used to signal a SIMPLE-TYPE-ERROR referring to the
unexpanded type specifier, instead of signaling a
SEQUENCE:PROTOCOL-UNIMPLEMENTED error.

Fixes lp#1315846.
2014-05-04 15:46:44 +02:00