So we're given the task of determining whether a given integer is a palindrome in base 10.
Seems easy enough:
isPalindrome :: Integer -> Bool
isPalindrome n = show n == reverse (show n)
Done. That was a short article.
-- | This module defines a function that produces a complete binary tree | |
-- from a breadth-first list of its (internal) node labels. It is an | |
-- optimized version of an implementation by Will Ness that avoids | |
-- any "impossible" cases. See | |
-- | |
-- https://stackoverflow.com/a/60561480/1477667 | |
module Bftr (Tree (..), bft, list, deftest) where | |
import Data.Function (fix) | |
import Data.Monoid (Endo (..)) |
So we're given the task of determining whether a given integer is a palindrome in base 10.
Seems easy enough:
isPalindrome :: Integer -> Bool
isPalindrome n = show n == reverse (show n)
Done. That was a short article.
;;;; SHA-1 and SHA-2 implementations. | |
;;;; Uses R7RS bytevector and byte I/O interfaces. | |
;;;; Requires SRFIs 1, 26, 43, and 60. | |
;;; Auxiliary definitions to avoid having to use giant tables of constants. | |
(define primes80 '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 | |
79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 | |
163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 | |
241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 |
import Data.Generics | |
import Language.Haskell.Parser | |
import Language.Haskell.Pretty | |
import Language.Haskell.Syntax | |
main = do | |
input <- getContents | |
case parseModule input of | |
ParseOk mod -> putStrLn $ prettyPrint $ everywhere (mkT desugarExp) mod | |
ParseFailed loc msg -> failed loc msg |