Skip to content

Commit c9da8ed

Browse files
committed
readme update
1 parent 2ac7cc4 commit c9da8ed

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

README.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Additionally, the following is implemented on top of it:
2626
The core algorithm outputs a set of instructions to get from `SeqA` to `SeqB`, something like this:
2727

2828
```
29-
to get from s1="bcdefgzio" to s2="abcxyfgi"):
29+
in order to get from s1="bcdefgzio" to s2="abcxyfgi":
3030
3131
Insert a from s2 before position 0 into s1.
3232
Delete d from s1 at position 2 in s1.
@@ -54,16 +54,16 @@ object DiffElement {
5454

5555
The result of the interpretation (without any transformations applied) for the same example:
5656

57+
```scala
58+
StringDiff
59+
.raw(
60+
"bcdefgzio",
61+
"abcxyfgi",
62+
collapse = false
63+
).mkString("[\n ", "\n ", "\n]")
5764
```
58-
println(
59-
StringDiff
60-
.raw(
61-
"bcdefgzio",
62-
"abcxyfgi",
63-
collapse = false
64-
).mkString("[\n ", "\n ", "\n]")
65-
)
6665

66+
```
6767
[
6868
InSecond(a)
6969
InBoth(bc)
@@ -82,16 +82,16 @@ The result of the interpretation (without any transformations applied) for the s
8282

8383
By default, diff functions will collapse the diff:
8484

85+
```scala
86+
StringDiff
87+
.raw(
88+
"bcdefgzio",
89+
"abcxyfgi",
90+
collapse = true // default is true
91+
).mkString("[\n ", "\n ", "\n]")
8592
```
86-
println(
87-
StringDiff
88-
.raw(
89-
"bcdefgzio",
90-
"abcxyfgi",
91-
collapse = true // default is true
92-
).mkString("[\n ", "\n ", "\n]")
93-
)
9493

94+
```
9595
[
9696
InSecond(a)
9797
InBoth(bc)
@@ -101,18 +101,22 @@ By default, diff functions will collapse the diff:
101101
InBoth(i)
102102
InFirst(o)
103103
]
104+
```
104105

105106
Here, the following list of DiffElements:
106107

108+
```
107109
[
108110
InFirst(d)
109111
InSecond(x)
110112
InSecond(y)
111113
InFirst(e)
112114
]
115+
```
113116

114117
got collapsed into a single one:
115-
118+
119+
```
116120
[
117121
Diff(de,xy)
118122
]
@@ -130,15 +134,15 @@ Examples:
130134

131135
### Diff'ing sequences:
132136

137+
```scala
138+
SeqDiff
139+
.seq(
140+
Seq(1, 2, 3, 4, 5).toIndexedSeq,
141+
Seq(1, 2, 8, 3, 8, 4, 5, 0).toIndexedSeq
142+
).mkString("[\n ", "\n ", "\n]")
143+
```
144+
133145
```
134-
println(
135-
SeqDiff
136-
.seq(
137-
Seq(1, 2, 3, 4, 5).toIndexedSeq,
138-
Seq(1, 2, 8, 3, 8, 4, 5, 0).toIndexedSeq
139-
).mkString("[\n ", "\n ", "\n]")
140-
)
141-
142146
[
143147
InBoth(Vector(1, 2))
144148
InSecond(Vector(8))
@@ -161,6 +165,7 @@ Raw diff:
161165
)
162166
)
163167
```
168+
164169
```
165170
[
166171
InSecond(a)

0 commit comments

Comments
 (0)