disco-lang / disco

Functional teaching language for use in a discrete mathematics course
Other
161 stars 22 forks source link

Add OEIS interface #189

Closed byorgey closed 4 years ago

byorgey commented 4 years ago

Using the oeis package. Provide some OEIS primitives that allow interaction with the OEIS database.

bookshelfdave commented 4 years ago

can you provide examples of what this could look like?

byorgey commented 4 years ago

Sure! The oeis package provides a way to retrieve all the info related to a sequence, but I am thinking of keeping things simple. Maybe we could have two primitives: one to extend a sequence, and the other to yield the URL of a sequence. So, in more detail:

byorgey commented 4 years ago

As a further example of what this might look like when it's working:

Disco> import oeis
Disco> :type extendSequence
extendSequence : List ℕ → List ℕ
Disco> extendSequence [0,1,1,2,3,5]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155]
Disco> :type lookupSequence
lookupSequence : List ℕ → List Char
Disco> lookupSequence [0,1,1,2,3,5]
"http://oeis.org/A000045"

I'm also open to other suggestions!