step: add prettyprint instead

This commit is contained in:
NunoSempere 2023-05-22 21:17:29 -04:00
parent 8a593e1eb5
commit a47306183d
3 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,8 @@
nimble install https://github.com/nim-lang/bigints nimble install https://github.com/nim-lang/bigints
https://nimdocs.com/nim-lang/bigints/bigints.html https://nimdocs.com/nim-lang/bigints/bigints.html
nimble install print
https://github.com/treeform/print
## Dependencies ## Dependencies

BIN
jit_bayes

Binary file not shown.

View File

@ -1,6 +1,8 @@
import strutils import strutils
import sequtils import sequtils
import print
## Get sequences
let file_path = "./data/stripped" let file_path = "./data/stripped"
proc getOEIS(): seq[seq[string]] = proc getOEIS(): seq[seq[string]] =
let f = open(file_path) let f = open(file_path)
@ -18,6 +20,7 @@ proc getOEIS(): seq[seq[string]] =
return seqs return seqs
var seqs = getOEIS() var seqs = getOEIS()
## Sequence helpers
proc startsWithSubsequence(xs: seq[string], ys: seq[string]): bool = proc startsWithSubsequence(xs: seq[string], ys: seq[string]): bool =
if xs.len == 0: if xs.len == 0:
return true return true
@ -35,6 +38,8 @@ proc getSequencesWithStart(seqs: seq[seq[string]], start: seq[string]): seq[seq[
continuations.add(seq) continuations.add(seq)
return continuations return continuations
## Pretty print sequences
var start = @["1", "2", "3"] var start = @["1", "2", "3"]
var continuations = getSequencesWithStart(seqs, start) var continuations = getSequencesWithStart(seqs, start)
echo continuations print continuations