
object Comps

inherit list
  Harness



Execute task




  // |first section tests low level functionality, not the parser

  @Test 'filter undef', task
    set b to undefined |has true
    return b is undefined
    
  @Test 'filter value true', task
    set b to 'a' |has it='a'
    return b is 'a'
    
  @Test 'filter value false', task
    set b to 'a' |has it='b'
    return b is undefined
    
  @Test 'has list all', task
    set b to: 1, 2, 3; |has it
    return b[0]=1 and b[1]=2 and b[2]=3 and b.length = 3
    
  @Test 'filter list some', task
    set b to: 1, 2, 3; |has it>1
    return b[0]=2 and b[1]=3 and b.length = 2
    
  @Test 'filter list none', task
    set b to: 1, 2, 3; |has it>4
    return b.length = 0
    
  @Test 'filter traits all', task
    set b to: a 1, b 2, c 3; |has it>0
    return b.a=1 and b.b=2 and b.c=3
    
  @Test 'filter traits some', task
    set b to: a 1, b 2, c 3; |has it>1
    return b.a is undefined and b.b=2 and b.c=3
    
  @Test 'filter traits none', task
    set b to: a 1, b 2, c 3; |has it>4
    return b.a is undefined and b.b is undefined and b.c is undefined
    
  @Test 'filter iterator odds', task
    set b to: 1,2,3,4,5; |iterate |has it%2
    count 3
      unless b.next().value = counter*2+1
        return false
    return true
  
  @Test 'sort undef', task
    set b to undefined |by it
    return b is undefined
  
  @Test 'sort value', task
    set b to 'fred' |by it
    return b='fred'
    
  @Test 'sort list', task
    set b to: 3,2,1; |by it
    return b[0]=1 and b[1]=2 and b[2]=3 and b.length=3
    
  @Test 'sort traits', task
    set b to: a 3,b 2,c 1; |by it
    return b[0]=1 and b[1]=2 and b[2]=3 and b.length=3
  
    
  @Test 'thru inline undef', task
    set b to undefined |thru it
    return b is undefined
    
  @Test 'thru inline value', task
    set b to 1 |thru it+1
    return b=2
    
  @Test 'thru inline list', task
    set b to: 1, 2, 3; |thru it+1
    return b[0]=2 and b[1]=3 and b[2]=4 and b.length=3
    
  @Test 'thru inline traits', task
    set b to: a 1, b 2, c 3; |thru it+1
    return b.a=2 and b.b=3 and b.c=4
   
  @Match 'thru inline iterator', 5, task
     set b to: 1,3,5; |iterate |thru it+2
     b.next
     return b.next().value
     
  @Test 'thru block', task
    set b to: a 1, b 2, c 3; |thru 
      return it+1
    return b.a=2 and b.b=3 and b.c=4
   
  @Test 'thru using', task
    set c to task
      return $+1
    set b to: a 1, b 2, c 3; |thru using c
    return b.a=2 and b.b=3 and b.c=4
   
  @Test 'audit value', task
    set b to 1 |audit it+1
    return b=1
    
  @Test 'audit list', task
    set b to: 1, 2, 3; |audit it+1
    return b[0]=1 and b[1]=2 and b[2]=3 and b.length=3
    
  @Test 'audit inline traits', task
    set d to 0
    set c to task
      set d + $
    set b to: a 1, b 2, c 3; |audit from c it
    return b.a=1 and b.b=2 and b.c=3 and d=6
   
  @Test 'audit block traits', task
    set d to 0
    set b to: a 1, b 2, c 3; |audit 
      set d + it
    return b.a=1 and b.b=2 and b.c=3 and d=6
   
  @Test 'audit using traits', task
    set d to 0
    set c to task
      set d + $
    set b to: a 1, b 2, c 3; |audit using c
    return b.a=1 and b.b=2 and b.c=3 and d=6
   
  @Match 'audit iterator', 3, task
     set b to: 1,3,5; |iterate |audit it+2
     b.next
     return b.next().value
     
  @Match 'observe list', 2, task
    set a to false
    set Setter to task
      set a to $
    set b to: 1,2; |observe from Setter it.length
    unless b.length=2 and b.0=1 and b.1=2
      return false
    return a
    
  @Test 'observe block', task
    set b to 0
    set a to 1 |observe
      set b to it+1
    return b=2 and a=1
  
  @Test 'observe inline', task
    set a to 0
    set b to task
       set a to $+1
    set c to 1 |observe from b it
    return c=1 and a=2
  
  @Test 'observe using', task
    set a to 0
    set b to task
       set a to $+1
    set c to 1 |observe using b
    return c=1 and a=2
  
  
  // the exception is the correct case
  //@Test 'observe iterator', task
  //  try
  //    set b to: 1,2,3; |iterate |observe 
  //      debug it.length
  //  catch
  //    return true
  //  return false
    
    
  @Match 'set value block', 1, task
    return 2 |set
      return 1
  
  @Match 'set value inline', 1, task
    return 2 |set 1
  
  @Test 'set block', task
    set b to: 2; |set
       it.unshift 1
    if b.length=2 and b.0=1 and b.1=2
      return true
    return false
    
  @Test 'set inline 1', task
    set Unshifter to task given l,v
      l.unshift v
      return l
    set b to: 2; |set from Unshifter it, 1
    if b.length=2 and b.0=1 and b.1=2
      return true
    return false
    
  @Test 'set inline 2', task
    set b to: 2, 1; |set from it.reverse
    if b.length=2 and b.0=1 and b.1=2
      return true
    return false
    
  @Test 'set using', task
    set rev to task
      return from $.reverse
    set b to: 2, 1; |set using rev
    if b.length=2 and b.0=1 and b.1=2
      return true
    return false
    
  @Match 'into no list', 'a', task
    set b to empty |into 'a'
       return sum+it
    return b
    
  @Match 'into 1 list |into', 'aa', task
    set b to list a; |into 'a'
       return sum+it
    return b
    
  @Match 'into 3 list ', 'abc', task
    set b to list a,b,c; |into ''
       return sum+it
    return b

  @Match 'into no traits', 'a', task
    set b to blank |into 'a'
       return sum+key+it
    return b

  @Match 'into 1 trait', 'a1', task
    set b to: a 1; |into ''
       return sum+key+it
    return b

  @Match '3 traits |into', 'a1b2c3', task
    set b to: a 1, b 2, c 3;  |into ''
       return sum+key+it
    return b

  @Match 'into value ', 'ba', task
    set b to 'a' |into 'b'
      return sum+it
    return b
    
  @Match 'into 1 iterable ', 'aa', task
    set b to list a; |iterate |into 'a'
       return sum+it
    return b.next().value
    
  @Match 'into 3 iterable', 'abc', task
    set b to list a,b,c; |iterate |into ''
       return sum+it
    return b.next().value
    
  @Match 'into 3 iterable inline ', 'abc', task
    set b to list a,b,c; |iterate |into '' sum+it
    return b.next().value
    
  @Match 'into nested', 4, task
    set a to:
      :1, 2
      :3, 4
    set a to self | thru (. | thru . * 2)
    return a.0.1
    
  @Match 'count undefined', 0, task
    return undefined | count
    
  @Match 'count scalar', 1, task
    return 99 | count
    
  @Match 'count array', 2, task
    return list a, b; | count
    
  @Match 'count traits', 3, task
    set b to: a 1, b 2, c 3
    return b | count
    
  @Match 'count iterable', 4, task
    set b array 1,2,3,4; |iterate
    return b | count
    
  // |concat  
    
  @Match 'concat undef undef', true, task
    set a undefined |concat undefined
    return a is undefined

  @Match 'concat undef val', true, task
    set a 1 |concat undefined
    return a[0]=1 and a.length=1

  @Test 'concat undef list', task
    set a undefined |concat: 1, 2
    return a.0=1 and a.1=2 and a.length=2
    
  @Test 'concat undef iterable', task
    set a undefined |concat ((array 1, 2) |iterate)
    set a to a |collect
    return a.0=1 and a.1=2 and a.length=2

  @Test 'concat list undef', task
    set a (array 1, 2) |concat undefined
    set a to a |collect
    return a.0=1 and a.1=2 and a.length=2
    
  @Test 'concat iterable undef', task
    set a ((array 1, 2) |iterate) |concat undefined
    set a to a |collect
    return a.0=1 and a.1=2 and a.length=2

  @Test 'concat inplace self', task
    set a: 1, 2
    set a |concat: 3, 4
    return a.0=1 and a.1=2 and a.2=3 and a.3=4 and a.length=4

  @Match 'concat val undef', true, task
    set a undefined |concat 1
    return a[0]=1 and a.length=1

  @Match 'concat val val', true, task
    set a 1 |concat 2
    return a.0=1 and a.1=2 and a.length=2

  @Test 'concat val list', task
    set a 1 |concat: 2, 3
    return a.0=1 and a.1=2 and a.2=3 and a.length=3
    
  @Test 'concat list val', task
    set a (array 1, 2) |concat 3
    return a.0=1 and a.1=2 and a.2=3 and a.length=3

  @Test 'concat val obj', task
    set b: a 1
    set a 2 |concat b
    return a.0=2 and a.1.a=1 and a.length=2
    
  @Test 'concat obj val', task
    set b: a 1
    set a b |concat 2
    return a.0.a=1 and a.1=2 and a.length=2

  @Test 'concat obj obj', task
    set c: a 1
    set d: b 2
    set a c |concat d
    return a.0.a=1 and a.1.b=2 and a.length=2
    
  @Test 'concat list list', task
    set a (array 1, 2) |concat (array 3, 4)
    return a.0=1 and a.1=2 and a.2=3 and a.3=4 and a.length=4
    
  @Test 'concat iter iter', task
    set q (array 1, 2) |iterate
    set r (array 3, 4) |iterate
    set i q |concat r
    set a i |collect
    return a.0=1 and a.1=2 and a.2=3 and a.3=4 and a.length=4
    
  @Test 'concat list iter', task
    set q (array 1, 2) 
    set r (array 3, 4) |iterate
    set i q |concat r
    set a i |collect
    return a.0=1 and a.1=2 and a.2=3 and a.3=4 and a.length=4

  @Test 'concat iter list', task
    set q (array 1, 2) |iterate
    set r (array 3, 4) 
    set i q |concat r
    set a i |collect
    return a.0=1 and a.1=2 and a.2=3 and a.3=4 and a.length=4

  @Test 'concat iter val', task
    set q (array 1, 2) |iterate
    set i q |concat 3
    set a i |collect
    return a.0=1 and a.1=2 and a.2=3 and a.length=3

  @Test 'concat val iter', task
    set q (array 3, 4) |iterate
    set a 1 |concat q
    return a.0=1 and a.1=3 and a.2=4 and a.length=3

  @Test 'concat obj iter', task
    set q (array 3, 4) |iterate
    set a (: a 1) |concat q
    return a.0.a=1 and a.1=3 and a.2=4 and a.length=3

  @Test 'concat iter obj', task
    set q (array 1, 2) |iterate
    set i q |concat (: d 4)
    set a i |collect
    return a.0=1 and a.1=2 and a.2.d=4 and a.length=3
  
     
  // test data

  set friends to:
    :name 'Sara', age 23, #cat, province 'ON'
    :name 'John', age 19, #cat, #dog, province 'ON'
    :name 'Ellie', age 22, province 'QC'
    :name 'Marshal', age 21, #dog, province 'ON'
    :name 'Doug', age 18, province 'ON'
    :name 'Ann', age 23, #cat, province 'QC'
    :name 'Harry', age 31, province 'QC'
    :name 'Jenna', age 28, #dog, province 'ON'  

  @Test 'by two expression', task
    set b to friends | by .province by .age desc | last
    return 'Ellie' is b.name
  
  @Test 'has task', task
    set a friends |has using task
      return $name is 'Sara'
    ... |thru .name
    return a.length is 1 and a.0 is 'Sara'

  @Test 'by task', task
    set a friends |by using task given a,b
      return a.age <=> b.age
    ... | limit 1; | thru .name
    return a.length is 1 and a.0 is 'Doug'

  @Match 'thru task', 'SARA', task
    return friends |thru using task
      return from $name.toUpperCase
    ... |first
    
  @Match 'into task', 185, task
    return friends |into 0 using task given acc,val
      return acc+val.age
    
  @Test 'into empty generator', task
    set gen process
      nop
    set a gen |into 1 sum + .
    set a self |collect 
    return a.0 is 1 and a.length is 1
    
  @Match 'age total |into', 185, task
    return friends |into 0
      set sum + .age
  
//  @Match '#cat count', 3, task
//    return (friends #cat).length
  
//  @Match '!#cat count', 5, task
//    return (friends !#cat).length
  
//  @Match '#cat #dog count', 1, task
//    return (friends #cat #dog).length

//  @Match '#cat !#dog count', 2, task
//    return (friends #cat !#dog).length
  
//  @Match '#ferret count', 0, task
//    return (friends #ferret).length
        
  @Match 'first', 'Sara', task
    return (friends |first).name
      
//  @Match 'youngest dog', 'John', task
//    return (friends #dog |lowest .age).name

  @Match 'youngest quebec', 'Ellie', task
    return (friends |has .province='QC' |lowest .age).name

  @Match 'longest name', 'Marshal', task
    return (friends |highest .name.length).name

  @Match 'youngest', 'Doug', task
    return (friends |by .age |first).name

  @Match 'lowest name', 'Ann', task
    return (friends |by .name |limit 1)[0].name
  
  @Match 'eldest', 'Harry', task
    return (friends |highest .age).name

  @Match 'last', 'Jenna', task
    return (friends |last).name
    
  @Match 'lowest number', 1, task
    return (list 1,2,3) | lowest
    
  @Match 'highest number', 3, task
    return (list 1,2,3) | highest
    
  @Match 'lowest number 2', 1, task
    return (list 1,3) | lowest
    
  @Match 'highest number 2', 3, task
    return (list 1,3) | highest
    
  @Match 'lowest number 3', 1, task
    return (list 1) | lowest
    
  @Match 'highest number 3', 3, task
    return (list 3) | highest
    
    
  @Match 'lowest number 4', undefined, task
    return undefined | lowest
    
  @Match 'highest number 4', undefined, task
    return undefined | highest
    
    

  
  @Test 'enlist undefined', task
    set a to undefined |enlist
    return a is undefined
    
  @Test 'enlist value', task
    set a to 3 |enlist
    return ~Array.isArray(a) and a[0]=3 and a.length=1
    
  @Test 'enlist string', task
    set a to 'bob' |enlist
    return ~Array.isArray(a) and a[0]='bob' and a.length=1
  
  @Test 'enlist array', task
    set a to (:1, 2) |enlist
    return ~Array.isArray(a) and a[0]=1 and a[1]=2 and a.length=2
    
  @Test 'enlist object', task
    set a to: a 1,  b 2; |enlist
    return ~Array.isArray(a) and a.0.0='a' and a.0.1=1 and a.1.0='b' and a.1.1=2 and a.length=2
    
  @Test 'enlist iterable', task
    set a to :1,3,5; |iterate |enlist
    set b to 0
    ply a
      set b + it
    return b=9
  
  @Test 'entrait undefined', task
    set a to undefined |entrait
    return a is undefined
    
  @Test 'entrait value', task
    set a to 3 |entrait
    return a[3]=true
    
  @Test 'entrait array 1', task
    set a to:(:1,4),(:2); |entrait
    return a[1]=4 and a[2] is undefined
    
  @Test 'entrait object', task
    set a to: #a,  b 2; |entrait
    return a.a=true and a.b=2
    
  @Test 'entrait iterable', task
    set a to :(:1,'a'),(:3,1),(:5); |iterate |entrait
    return a.1='a' and a.3=1 and a.5 is undefined
  
  @Test 'enlist |entrait', task
    set a to: fred 1, bill 2, cal 3; |enlist |entrait
    return a.fred=1 and a.bill=2 and a.cal=3
  
  @Test 'limit undef', task
    set a to undefined |limit 1
    return a is undefined
    
  @Test 'limit no rows', task
    set a to: 1, 2, 3; |limit 0
    return a.length is 0
  
  @Test 'limit no gen', task
    set a to: 1, 2, 3; |iterate |limit 0
    if typeof a is 'function'
      set a self |collect
      return a.length is 0
    return false
  
  
  set ListVerify task given c, m
    if c.length isnt m.length 
      debug "List error ${~JSON.stringify(c)} isn't ${~JSON.stringify(m)}"
      return false
    ply c
      if . isnt m[key]
        debug "List error ${~JSON.stringify(c)} isn't ${~JSON.stringify(m)}"
        return false
    return true
  
  @Match 'limitstring u, -y', 'defg', task
    return 'abcdefg' |limit -4
  
  @Match 'limitstring u, 0', '', task
    return 'abcdefg' |limit 0
  
  @Match 'limitstring u, u', 'abcdefg', task
    return 'abcdefg' |limit undefined
  
  @Match 'limitstring u, y', 'abcdef', task
    return 'abcdefg' |limit 6
  
  @Match 'limitstring -, -y', 'ef', task
    return 'abcdefg' |limit -3, -1
  
  @Match 'limitstring -, 0', '', task
    return 'abcdefg' |limit -4, 0
  
  @Match 'limitstring -, u', 'bcdefg', task
    return 'abcdefg' |limit -6, undefined
  
  @Match 'limitstring -, y', 'cd', task
    return 'abcdefg' |limit -5, 2
  
  @Match 'limitstring 0, -y', 'abc', task
    return 'abcdefg' |limit 0, -4
  
  @Match 'limitstring 0, 0', '', task
    return 'abcdefg' |limit 0, 0
  
  @Match 'limitstring 0, u', 'abcdefg', task
    return 'abcdefg' |limit 0, undefined
  
  @Match 'limitstring 0, y', 'de', task
    return 'abcdefg' |limit 3, 2
  
  @Match 'limitstring +, -y', 'cdef', task
    return 'abcdefg' |limit 2, -1
  
  @Match 'limitstring +, 0', '', task
    return 'abcdefg' |limit 5, 0
  
  @Match 'limitstring +, u', 'fg', task
    return 'abcdefg' |limit 5, undefined
  
  @Match 'limitstring +, y', 'bcdef', task
    return 'abcdefg' |limit 1, 5
  
  set l to: 1,2,3,4,5

  @Test 'limit -x', task
    set a to l |limit -2
    return from ListVerify a, :4,5
    
  @Test 'limit 0', task
    set a to l |limit 0
    return from ListVerify a, empty
    
  @Test 'limit +x', task
    set a to l |limit 2
    return from ListVerify a, :1,2
    
  @Test 'limit -x, -y', task//              everything except |last y rows starting x from end of list
    set a to l |limit -3,-1
    return from ListVerify a, :3,4
    
  @Test 'limit -x, 0', task//              nothing
    set a to l |limit -3,0
    return from ListVerify a, empty
    
  @Test 'limit -x, undef', task//           |last x rows
    set a to l |limit -2, undefined
    return from ListVerify a, :4, 5
    
  @Test 'limit -x, +y', task//                    y rows starting x from end of list
    set a to l |limit -4,2
    return from ListVerify a, :2,3
    
  @Test 'limit 0, -y', task//everything except |last y rows
    set a to l |limit 0,-1
    return from ListVerify a, :1,2,3,4
    
  @Test 'limit 0, 0', task //nothing
    set a to l |limit 0,0
    return from ListVerify a, empty
    
  @Test 'limit 0, undef', task //everything 
    set a to l |limit 0, undefined
    return from ListVerify a, :1,2,3,4,5
    
  @Test 'limit 0, +y', task //first y rows
    set a to l |limit 0,2
    return from ListVerify a, :1,2
    
  @Test 'limit +x, -y', task//everything except |last y rows starting at x
    set a to l |limit 1,-2
    return from ListVerify a, :2,3
    
  @Test 'limit +x, 0', task //nothing
    set a to l |limit 1,0
    return from ListVerify a, empty
    
  @Test 'limit +x, undef', task //everything starting at x
    set a to l |limit 2, undefined
    return from ListVerify a, :3,4,5
    
  @Test 'limit +x, +y', task //y rows starting at x
    set a to l | limit 2,2
    return from ListVerify a, :3,4
      
      
  @Test 'limit gen -x', task
    set a to l | iterate | limit -2 | collect
    return from ListVerify a, :4,5
    
  @Test 'limit gen 0', task
    set a to l | iterate | limit 0 | collect
    return from ListVerify a, empty
    
  @Test 'limit gen +x', task
    set a to l | iterate | limit 2 | collect
    return from ListVerify a, :1,2
    
  @Test 'limit gen -x, -y', task//              everything except |last y rows starting x from end of list
    set a to l |iterate | limit -3, -1 | collect
    return from ListVerify a, :3,4
    
  @Test 'limit gen -x, 0', task//              nothing
    set a to l | iterate | limit -3, 0 | collect
    return from ListVerify a, empty
    
  @Test 'limit gen -x, undef', task//           |last x rows
    set a to l | iterate | limit -2, undefined | collect
    return from ListVerify a, :4, 5
    
  @Test 'limit gen -x, +y', task//                    y rows starting x from end of list
    set a to l |iterate |limit -4,2 | collect
    return from ListVerify a, :2,3
    
  @Test 'limit gen 0, -y', task//everything except |last y rows
    set a to l |iterate |limit 0,-1 | collect
    return from ListVerify a, :1,2,3,4
    
  @Test 'limit gen 0, 0', task //nothing
    set a to l | iterate | limit 0, 0 |collect
    return from ListVerify a, empty
    
  @Test 'limit gen 0, undef', task //everything 
    set a to l |iterate |limit 0, undefined; |collect
    return from ListVerify a, :1,2,3,4,5
    
  @Test 'limit gen 0, +y', task //first y rows
    set a to l |iterate |limit 0,2; |collect
    return from ListVerify a, :1,2
    
  @Test 'limit gen +x, -y', task//everything except |last y rows starting at x
    set a to l |iterate |limit 1,-2; |collect
    return from ListVerify a, :2,3
    
  @Test 'limit gen +x, 0', task //nothing
    set a to l |iterate |limit 1,0; |collect
    return from ListVerify a, empty
    
  @Test 'limit gen +x, undef', task //everything starting at x
    set a to l |iterate |limit 2, undefined; |collect
    return from ListVerify a, :3,4,5
    
  @Test 'limit gen +x, +y', task //y rows starting at x
    set a to l |iterate |limit 2,2; |collect
    return from ListVerify a, :3,4
      
  
  @Test 'limit entire generator', task
    set gen to: 1, 2, 3; |iterate
    set a to gen |limit 0, undefined
    set a self |collect
    return a.length is 3 and a.1 is 2
    
  @Test 'limit chopped generator', task
    set gen to: 1, 2, 3; |iterate
    set a to gen |limit 0, 10
    set a self |collect
    return a.length is 3 and a.1 is 2
    
  @Test 'limit on object', task
    set a to: a 1, b 2; |limit 1
    return a.length=1 and a.0.a=1 
    
  @Test 'limit on value unlimited', task
    set a to 1 |limit 1
    return a.length is 1 and a.0 is 1
    
  @Test 'limit on value from the end', task
    set a to 1 |limit -1
    return a.length is 1 and a.0 is 1
    
  @Test 'limit on value from the end chopped', task
    set a to 1 |limit -1,0
    return a.length is 0
    
  @Test 'limit list offset unclosed', task
    set a to: 1, 2, 3; |limit 2, undefined
    return a.length is 1 and a.0 is 3
    
  @Test 'limit list negative offset unclosed', task
    set a to: 1, 2, 3; |limit -2, undefined
    return a.length is 2 and a.0 is 2 and a.1 is 3
    
  @Test 'limit on value |limited', task
    set a to 1 |limit 0
    return a.length is 0 
    
  @Test 'limit on value out of range', task
    set a to 1 |limit -2,1
    return a.length is 0
    
  @Test 'first last on undefined', task
    set a to undefined |first
    set b to undefined |last
    return a is undefined and b is undefined
    
  @Test 'first |last on value', task
    set a to 1 |first
    set b to 1 |last
    return a is 1 and b is 1

  @Test 'first on object', task
    set a to: a 1, b 2; |first
    return a.a is 1

  @Test 'last on object', task
    set a to: a 1, b 2; |last
    return a.a is 1

  @Test 'first on generator', task
    set a to: 1, 2, 3; |iterate |first
    return a is 1

  @Test 'last on generator', task
    set a to: 1, 2, 3; |iterate |last
    return a is 3
  
  @Match 'row count on |iterated |audit', 3, task
    set a to: 1, 2, 3; |iterate
    set b to 0
    chain a
      |audit
        set b + key
    return b 
    
  @Match 'row count on |iterated map', 3, task
    set a to: 1, 2, 3; |iterate
    set b to 0
    chain a
      |thru
        set b + key
    return b 
    
  @Match 'row count on |iterated filter', 3, task
    set a to: 1, 2, 3; |iterate
    set b to 0
    chain a
      |has
        set b + key
    return b 
    
  @Match 'row count on |iterated reduce', 3, task
    set a to: 1, 2, 3; |iterate
    set b to 0
    chain a
      |into 0
        set b + key
    return b
    
  @Test 'lop or array', task
    set t: 0,2,0
    set f: 0,0,0
    return (t|or) and not (f|or)
    
  @Test 'lop or array 2', task
    set t: 0,2,0; | or
    set f: 0,0,0; | or
    return t and not f
    
  @Test 'lop or traits', task
    set t: a 0,b 2,c 0
    set f: a 0,b 0,c 0
    return (t|or) and not (f|or)
    
  @Test 'lop or generator', task
    set t: 0,2,0; | iterate
    set f: 0,0,0; | iterate
    set t | or | collect | first
    set f | or | collect | first
    return t and not f
    
  @Test 'lop or values', task
    set t 1
    set f 0
    return (t|or) and not (f|or)
    

  @Test 'lop and array', task
    set t: 1,2,3
    set f: 1,0,3
    return (t|and) and not (f|and)
    
  @Test 'lop and traits', task
    set t: a 1,b 2,c 3
    set f: a 1,b 0,c 3
    return (t|and) and not (f|and)
    
  @Test 'lop and generator', task
    set t: 1,2,3; | iterate
    set f: 1,0,3; | iterate
    set t | and | collect | first
    set f | and | collect | first
    return t and not f
    
  @Test 'lop and values', task
    set t 1
    set f 0
    return (t|and) and not (f|and)


    
    
    
  