We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7be9124 commit af497a2Copy full SHA for af497a2
src/micro_logic/core.clj
@@ -285,3 +285,39 @@
285
(if (seq s)
286
(lcons (first s) (seq->lcons (rest s)))
287
empty-lcons))
288
+
289
290
+;;; extended goals
291
292
+(defn conso [first rest seq]
293
+ (=== (lcons first rest) seq))
294
295
+(defn firsto [first seq]
296
+ (fresh [rest]
297
+ (conso first rest seq)))
298
299
+(defn resto [rest seq]
300
+ (fresh [first]
301
302
303
+(defn emptyo [x]
304
+ (=== empty-lcons x))
305
306
+(defn nilo [x]
307
+ (=== nil x))
308
309
+(defn repeato [n x]
310
+ (conde
311
+ [(emptyo x)]
312
+ [(fresh [rest]
313
+ (conso n rest x)
314
+ (repeato n rest))]))
315
316
+(defn iterateo [gc x]
317
318
319
+ [(fresh [val rest]
320
+ (gc val)
321
+ (conso val rest x)
322
+ (iterateo gc rest))]))
323
0 commit comments