Giter VIP home page Giter VIP logo

oeis2's Introduction

oeis2

GitHub Actions Haskell Hackage version Stackage version BSD3

Haskell interface for Online Encyclopedia of Integer Sequences; homage to oeis.

Difference from oeis

  • Source data of OEIS.
    : oeis use fmt=text, but this library use fmt=json.
  • Possible to get all search results.
  • Search functions from ID or sub-sequence are merged.
  • Possibele to search from other than ID or sub-sequence.
  • Support for HTTPS.

Usage

Add import statement.

import Math.OEIS
  • Get all search results from sub-sequence

    • If n == 0, you get all search results.

      ghci>searchSeq (SubSeq [1,2,3,4]) 0
      [OEIS {number = "A000027", ids = ["M0472","N0173"], seqData = [1,2,3,4,5,6,7,...
      ghci>length it
      53
    • Otherwise, you get first n search results.

      ghci>searchSeq (SubSeq [1,2,3,4]) 17
      [OEIS {number = "A000027", ids = ["M0472","N0173"], seqData = [1,2,3,4,5,6,7,8,9,
      ghci>length it
      17
  • Get first few terms from sub-sequence

    ghci>getSeqData (SubSeq [1,2,2,3,3,3,4,4,4,4])
    Just [1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,...
  • Get Mathematica function from sub-sequence

    ghci>mathematica <$> lookupSeq (SubSeq [1,2,2,3,3,3,4,4,4,4])
    Just ["a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* _Branko Curgus_, May 12 2009 *)","Table[n, {n, 13}, {n}] // Flatten (* _Robert G. Wilson v_, May 11 2010 *)"]
  • If no search result

    ghci>lookupSeq (ID "1145141919893")
    Nothing

oeis2's People

Contributors

23prime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ncfavier

oeis2's Issues

test suite failure

oes2-1.0.6 failed in a recent Stackage test run with the following error message:

      test/Spec.hs:29:5:
      1) Test for lookupSeq Compare lookup by ID with by SubSeq

[ generated example elided ]

      To rerun use: --match "/Test for lookupSeq/Compare lookup by ID with by SubSeq/"

    Randomized with seed 1521710722

    Finished in 1.4243 seconds
    4 examples, 1 failure

oeis2-1.0.7 fails to build with aeson-2

src/Math/OEIS/Internal.hs:124:27: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘key’, namely ‘k’
      In the first argument of ‘(.)’, namely ‘key k’
      In the second argument of ‘(^?)’, namely ‘key k . _Integer’
    |
124 |   = let d = result ^? key k ._Integer
    |                           ^

src/Math/OEIS/Internal.hs:136:27: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘key’, namely ‘k’
      In the first argument of ‘(.)’, namely ‘key k’
      In the second argument of ‘(^?)’, namely ‘key k . _String’
    |
136 |   = let d = result ^? key k ._String
    |                           ^

src/Math/OEIS/Internal.hs:150:29: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘key’, namely ‘k’
      In the first argument of ‘(.)’, namely ‘key k’
      In the second argument of ‘(^?)’, namely ‘key k . _Array’
    |
150 |   = let ds  = result ^? key k . _Array
    |                             ^

src/Math/OEIS/Internal.hs:154:41: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘key’, namely ‘k’
      In the first argument of ‘(.)’, namely ‘key k’
      In the second argument of ‘(^?!)’, namely ‘key k . nth i . _String’
    |
154 |         let ts  = (\i -> result ^?! key k . nth i . _String) <$> [0..(len - 1)]
    |                                         ^

As a Hackage trustee I have revised v1.0.7: https://hackage.haskell.org/package/oeis2-1.0.7/revisions/


EDIT: Related: commercialhaskell/stackage#6498

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.