[bug] Cons would fail if the first argument was falsy. Not what I wanted.
This commit is contained in:
parent
0d0430240d
commit
1bd3f27d85
|
@ -35,7 +35,7 @@ _annotate = (ConsList) ->
|
||||||
|
|
||||||
cons = (a = nil, b = nil) ->
|
cons = (a = nil, b = nil) ->
|
||||||
return (new ConsList()) if (nilp a) and (nilp b)
|
return (new ConsList()) if (nilp a) and (nilp b)
|
||||||
if (a) then (new ConsList(a, b)) else (new ConsList(b))
|
if (a?) then (new ConsList(a, b)) else (new ConsList(b))
|
||||||
|
|
||||||
nil = (-> new ConsList())()
|
nil = (-> new ConsList())()
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ expect = chai.expect
|
||||||
describe "Basic list building", ->
|
describe "Basic list building", ->
|
||||||
for [t, v] in [
|
for [t, v] in [
|
||||||
[cons(), cons()]
|
[cons(), cons()]
|
||||||
|
[cons(0), [0, nil]]
|
||||||
[cons(nil), cons(nil)]
|
[cons(nil), cons(nil)]
|
||||||
[cons('a'), cons('a')]
|
[cons('a'), cons('a')]
|
||||||
[cons('a', cons('b', cons('c'))), cons('a', cons('b', cons('c')))]
|
[cons('a', cons('b', cons('c'))), cons('a', cons('b', cons('c')))]
|
||||||
|
|
Loading…
Reference in New Issue