number-wall 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+15/−31 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- NumberWall: numberWall :: (NumberWall a, Show a) => (Int -> a) -> Col -> Row -> a
+ NumberWall: numberWall :: NumberWall a => (Int -> a) -> Col -> Row -> a
Files
- CHANGELOG.md +6/−0
- number-wall.cabal +1/−28
- src/NumberWall.hs +8/−3
CHANGELOG.md view
@@ -8,3 +8,9 @@ * Added example usage to documentation. * Fixed image and math in description.++## 0.1.0.2 -- 2022-9-3++* Removed formal definition.+* Added section headings in documentation.+* Removed unnecessary `Show` constraint.
number-wall.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: number-wall-version: 0.1.0.1+version: 0.1.0.2 author: Owen Bechtel maintainer: ombspring@gmail.com @@ -12,33 +12,6 @@ The "numbers" in the grid are usually either integers, or integers modulo some prime. Number walls can be defined in terms of determinants, but can also be calculated using a recursive algorithm.- .- Formally, let \( R \) be an integral domain. The number wall of a- sequence \( S : \mathbb{Z} \to R \) is an infinite grid of- numbers \( W \), defined as follows:- .- \[- W(x, y) = \begin{cases}- 0 & y < -1 \\- 1 & y = -1 \\- S(x) & y = 0 \\- D(x, y) & y > 0- \end{cases}- \]- .- \[- D(x, y) = \begin{vmatrix}- S(x) & S(x + 1) & \ldots & S(x + y) \\- S(x - 1) & S(x) & \ldots & S(x + y - 1) \\- \vdots & \vdots & \ddots & \vdots \\- S(x - y) & S(x - y + 1) & \ldots & S(x)- \end{vmatrix}- \]- .- The values in any number wall satisfy the- relation \( W(x, y - 1) W(x, y + 1) + W(x - 1, y) W(x + 1, y) = W(x, y)^2 \),- and some other more complicated relations. You can use these to define a- recursive algorithm for generating number walls. . Here are some cool images created using the functions in this package: .
src/NumberWall.hs view
@@ -17,7 +17,13 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE ConstraintKinds #-} module NumberWall- ( NumberWall, Col, Row, numberWall, pagoda, rueppel, ternary, saveImage, showSection, printSection+ ( -- * Creating number walls+ Col, Row, numberWall, NumberWall+ -- * Special sequences+ , pagoda, rueppel, ternary+ -- * Displaying number walls+ , saveImage, showSection, printSection+ -- * Modular arithmetic , module Data.Mod.Word ) where @@ -39,7 +45,6 @@ are not actually Euclidean domains, and using 'numberWall' with them often causes divide-by-zero errors. -}- type NumberWall a = (Eq a, Ring a, Euclidean a) type Col = Int@@ -51,7 +56,7 @@ {-| Generate the number wall for a sequence. -}-numberWall :: (NumberWall a, Show a) => (Int -> a) -> Col -> Row -> a+numberWall :: NumberWall a => (Int -> a) -> Col -> Row -> a numberWall s = memoFix2 \recurse col row -> let f a b = recurse (col + a) (row - b) in case row of