From 9151d02655c517304f2379ceb2928274cb1fb0bb Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 5 Nov 2015 12:05:28 -0500 Subject: [PATCH] Rename `down` to `into`. --- prototype/Doubt/Location.swift | 4 ++-- prototype/DoubtTests/LocationTests.swift | 26 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/prototype/Doubt/Location.swift b/prototype/Doubt/Location.swift index fc9d3e393..027893cf8 100644 --- a/prototype/Doubt/Location.swift +++ b/prototype/Doubt/Location.swift @@ -22,7 +22,7 @@ public struct Location: SequenceType { /// The node currently in focus. public let it: A - public var down: Location? { return _down(it) } + public var into: Location? { return _down(it) } public var up: Location? { return _up(it) } @@ -38,7 +38,7 @@ public struct Location: SequenceType { /// Returns the logically next `Location` after the receiver in a pre-order depth-first traversal. public var next: Location? { - return down ?? nextAfter + return into ?? nextAfter } /// Returns the logically next `Location` after the receiver and its children in a pre-order depth-first traversal. diff --git a/prototype/DoubtTests/LocationTests.swift b/prototype/DoubtTests/LocationTests.swift index 373fb898f..4f939d842 100644 --- a/prototype/DoubtTests/LocationTests.swift +++ b/prototype/DoubtTests/LocationTests.swift @@ -13,35 +13,35 @@ final class LocationTests: XCTestCase { } func testCannotMoveDownwardsFromLeaves() { - assert(leafA.explore().down?.it, ==, nil) + assert(leafA.explore().into?.it, ==, nil) } func testCanMoveDownwardsIntoBranches() { - assert(term.explore().down?.it, ==, leafA) + assert(term.explore().into?.it, ==, leafA) } func testCanMoveBackUpwards() { - assert(term.explore().down?.up?.it, ==, term) + assert(term.explore().into?.up?.it, ==, term) } func testCannotMoveLeftwardsFromFirstChildOfBranch() { - assert(term.explore().down?.left?.it, ==, nil) + assert(term.explore().into?.left?.it, ==, nil) } func testCanMoveRightwardsFromLeftmostChildOfLongBranch() { - assert(term.explore().down?.right?.it, ==, leafB) + assert(term.explore().into?.right?.it, ==, leafB) } func testCanExploreBranchesDeeply() { - assert(term.explore().down?.right?.right?.down?.it, ==, innerLeafB) + assert(term.explore().into?.right?.right?.into?.it, ==, innerLeafB) } func testCanMoveBackUpwardsFromDeepExplorations() { - assert(term.explore().down?.right?.right?.down?.right?.up?.up?.it, ==, term) + assert(term.explore().into?.right?.right?.into?.right?.up?.up?.it, ==, term) } func testCanReturnToStartOfExplorationFromArbitrarilyDeepNodes() { - assert(term.explore().down?.right?.right?.down?.right?.root.it, ==, term) + assert(term.explore().into?.right?.right?.into?.right?.root.it, ==, term) } func testSequenceIsPreOrderDepthFirstTraversal() { @@ -49,23 +49,23 @@ final class LocationTests: XCTestCase { } func testModifyReplacesSubtrees() { - assert(term.explore().down?.modify(const(leafB)).right?.up?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ]))) + assert(term.explore().into?.modify(const(leafB)).right?.up?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ]))) } func testMultipleModificationsReplaceMultipleSubtrees() { - assert(term.explore().down?.modify(const(leafB)).right?.modify(const(leafA)).up?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ]))) + assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).up?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ]))) } func testModificationsPreserveKeys() { - assert(keyed.explore().down?.modify(const(leafA)).root.it, ==, Cofree(3, .Keyed([ "a": innerLeafA, "b": leafA ]))) + assert(keyed.explore().into?.modify(const(leafA)).root.it, ==, Cofree(3, .Keyed([ "a": innerLeafA, "b": leafA ]))) } func testDeepModificationsReplaceDeepSubtrees() { - assert(term.explore().down?.modify(const(leafB)).right?.modify(const(leafA)).right?.down?.modify(const(innerLeafA)).right?.modify(const(innerLeafB)).root.it, ==, Cofree(0, .Indexed([ leafB, leafA, Cofree(3, .Keyed([ "a": innerLeafB, "b": innerLeafA ])) ]))) + assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).right?.into?.modify(const(innerLeafA)).right?.modify(const(innerLeafB)).root.it, ==, Cofree(0, .Indexed([ leafB, leafA, Cofree(3, .Keyed([ "a": innerLeafB, "b": innerLeafA ])) ]))) } func testModificationsCanRefineDiffs() { - assert(diff.explore().down?.right?.modify(const(refined)).root.it, ==, Free.Roll(0, .Indexed([ Free.Roll(1, .Leaf("a string")), refined ]))) + assert(diff.explore().into?.right?.modify(const(refined)).root.it, ==, Free.Roll(0, .Indexed([ Free.Roll(1, .Leaf("a string")), refined ]))) } }