something that is sequenced can return a Sequence over itself. it also allows several other methods to be defined in terms of that sequence. A Sequenced object is Enumerable, since all Enumerable operations can be defined in terms of sequencing.

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
kind = "Mixins Sequenced"
Active cells (details)
collected(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced collected
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x collected(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
dropped(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced dropped
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x dropped(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
droppedWhile(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced droppedWhile
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x droppedWhile(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
each(...)

nil

macro(
  argCount = call arguments length 
  cond(
    argCount ==(
      0), 
    
    
    seq, 
    argCount ==(
      1), 
    
    chain = call arguments [](
        0) 
    
    s = seq 
    while(s next?, 
      chain evaluateOn(call ground, s next) 
      ) 
    @, 
    argCount ==(
      2), 
    
    argumentName = call arguments [](
        0) 
    code = call arguments [](
        1) 
    
    s = seq 
    lexicalCode = LexicalBlock createFrom(list(argumentName, code), call ground) 
    while(s next?, 
      lexicalCode call(s next) 
      ) 
    @, 
    argCount ==(
      3), 
    
    indexArgumentName = call arguments [](
        0) 
    argumentName = call arguments [](
        1) 
    code = call arguments [](
        2) 
    
    s = seq 
    lexicalCode = LexicalBlock createFrom(list(indexArgumentName, argumentName, code), call ground) 
    index = 0 
    while(s next?, 
      lexicalCode call(index, s next) 
      ++(index) 
      ) 
    @ 
    , 
    error!(Condition Error Invocation NoMatch, message: call message, context: call currentContext)) 
  )
Mixins Sequenced each
  • - should be implemented in terms of 'seq' [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    seqObj mock!(:next?) andReturn(false) 
    x mock!(:seq) andReturn(seqObj) 
    x each(42) 
    
    
  • - should be possible to call with one message chain that will be applied to all arguments [ show source ]
    Ground y = [] 
    Ground xs = method(y <<(self)) 
    SequenceTester each(xs) 
    y should ==([](1, 2, 3, 4, 5, 6, 7, 8)) 
    x = 0 
    SequenceTester each(nil 
      ++(x)) 
    x should ==(8) 
    
    
  • - should be possible to call with one argument name and code that will be applied to all arguments [ show source ]
    y = [] 
    SequenceTester each(x, y <<(x)) 
    y should ==([](1, 2, 3, 4, 5, 6, 7, 8)) 
    
    
  • - should be possible to call with two argument names and code that will be applied to all arguments [ show source ]
    y = [] 
    SequenceTester each(i, x, y <<([](i, x))) 
    y should ==([]([](0, 1), [](1, 2), [](2, 3), [](3, 4), [](4, 5), [](5, 6), [](6, 7), [](7, 8))) 
    
    
  • - should return the object [ show source ]
    (SequenceTester each(x, x)) should be(SequenceTester) 
    
    
  • - should establish a lexical context when invoking the methods. this context will be the same for all invocations. [ show source ]
    SequenceTester each(x_list, blarg = 32) 
    cell?(:x_list) should be false 
    cell?(:blarg) should be false 
    x = 14 
    SequenceTester each(x, blarg = 32) 
    x should ==(14) 
    
    
  • - should return a Sequence if called with no arguments [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x each should be same(seqObj) 
    
    
filtered(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced filtered
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x filtered(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
grepped(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced grepped
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x grepped(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
indexed(...)

nil

macro(
  call resendToReceiver(self seq))
interleave(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced interleave
  • - should create a new sequence [ show source ]
    [](1, 2, 3) interleave(1 ..(5)) should mimic(Sequence) 
    
    
  • - should take an enumerable [ show source ]
    [](1, 2, 3) interleave(5 ..(15)) asList should ==([](1, 5, 2, 6, 3, 7)) 
    
    
  • - should take a seq [ show source ]
    [](1, 2, 3) interleave((5 ..(15)) seq) asList should ==([](1, 5, 2, 6, 3, 7)) 
    
    
  • - should only take as many elements as needed from the self [ show source ]
    [](1, 2, 3, 4, 5, 6) interleave([](10, 11)) asList should ==([](1, 10, 2, 11)) 
    
    
  • - should only take as many elements as needed from the argument [ show source ]
    [](1, 2) interleave([](10, 11, 12, 13, 14, 15)) asList should ==([](1, 10, 2, 11)) 
    
    
  • - should interleave the elements of the argument with the elements of the sequence [ show source ]
    []("foo", "bar", "quux") interleave(1 ..(3)) asList should ==([]("foo", 1, "bar", 2, "quux", 3)) 
    
    
interpose(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced interpose
  • - should return a new sequence [ show source ]
    [](1, 2, 3) interpose(42) should mimic(Sequence) 
    
    
  • - should return a sequence that has the element interposed [ show source ]
    [](1, 2, 3) interpose(42) asList should ==([](1, 42, 2, 42, 3)) 
    
    
mapped(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced mapped
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x mapped(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
rejected(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced rejected
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x rejected(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
selected(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced selected
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x selected(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43)))) 
    
    
zipped(...)

nil

macro(
  call resendToReceiver(self seq))
Mixins Sequenced zipped
  • - should resend the call with all arguments to the result of calling seq [ show source ]
    x = Origin mimic 
    x mimic!(Mixins Sequenced) 
    seqObj = SequenceHelper mimic 
    x mock!(:seq) andReturn(seqObj) 
    x zipped(foo, bar x *(43)) should ==(42) 
    seqObj called should be true 
    seqObj callInfo arguments should ==([]('(foo), '(bar x *(43))))