@@ -197,6 +197,7 @@ match g.left with
197
197
{% highlight OCaml %}
198
198
(* pattern-matches on the list (of lists) , which should be non-empty, and introduces two bindings,
199
199
line for the head, and above for the tail.* )
200
+
200
201
let up g =
201
202
match g.above,g.below with
202
203
| {gamegrid = line :: above},{gamegrid = below} -> (
@@ -206,28 +207,20 @@ let up g =
206
207
Some (left, focus, right) ->
207
208
let above = { gamegrid = above } in
208
209
let below = { gamegrid = below'} in
209
- { above
210
+ Some { above
210
211
; below
211
212
; left
212
213
; right
213
214
; focus }
214
215
|None ->
215
- { above = g.above
216
- ; below = g.below
217
- ; left = g.left
218
- ; right = g.right
219
- ; focus = g.focus }
216
+ None
220
217
)
221
- |({gamegrid=[ ] },_ ) -> { above = g.above
222
- ; below = g.below
223
- ; left = g.left
224
- ; right = g.right
225
- ; focus = g.focus }
218
+ |({gamegrid=[ ] },_ ) -> None
226
219
;;
227
-
228
220
{% endhighlight %}
229
221
230
222
{% highlight OCaml %}
223
+
231
224
let down g =
232
225
match g.below,g.above with
233
226
| {gamegrid = line :: below},{gamegrid = above} -> (
@@ -237,23 +230,15 @@ let down g =
237
230
Some (left, focus, right) ->
238
231
let above = { gamegrid = above } in
239
232
let below = { gamegrid = above'} in
240
- { above
233
+ Some { above
241
234
; below
242
235
; left
243
236
; right
244
237
; focus }
245
238
|None ->
246
- { above = g.above
247
- ; below = g.below
248
- ; left = g.left
249
- ; right = g.right
250
- ; focus = g.focus }
239
+ None
251
240
)
252
- | ({gamegrid=[ ] },_ )-> { above = g.above
253
- ; below = g.below
254
- ; left = g.left
255
- ; right = g.right
256
- ; focus = g.focus }
241
+ | ({gamegrid=[ ] },_ )-> None
257
242
258
243
;;
259
244
{% endhighlight %}
0 commit comments