<commit_before>{-# LANGUAGE NPlusKPatterns #-}
module Ch6examp where
-- ghci -XNPlusKPatterns
import qualified Data.List as D 

 
-- Remember order of arg evaluation doesn't matter as much in Pure FP.

-- 6.1 -- 
factorial               :: Int -> Int 
factorial n             = product(take n [1..n])

f2ctorial               :: Integral a => a -> a         
f2ctorial n             = product(D.genericTake n [1..n])
-- Int v. Integer in factorial results; perhaps it's the repl only?  
fact4rial               :: Int -> Int 
fact4rial 0		= 1
fact4rial (n + 1)       = (n + 1) * factorial n              

f2ct4rial               :: Integral a => a -> a <commit_msg>Gone is ref to arg order<commit_after>{-# LANGUAGE NPlusKPatterns #-}
module Ch6examp where
-- ghci -XNPlusKPatterns
import qualified Data.List as D 

-- 6.1 -- 
factorial               :: Int -> Int 
factorial n             = product(take n [1..n])

f2ctorial               :: Integral a => a -> a         
f2ctorial n             = product(D.genericTake n [1..n])
-- Int v. Integer in factorial results; perhaps it's the repl only?  
fact4rial               :: Int -> Int 
fact4rial 0		= 1
fact4rial (n + 1)       = (n + 1) * factorial n              

f2ct4rial               :: Integral a => a -> a 
{'fraction_non_alphanumeric': 0.11032308904649331, 'fraction_numerical': 0.0252167060677699, 'mean_word_length': 1.6736842105263159, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3984345', 'n_tokens_mistral': 426, 'n_tokens_neox': 407, 'n_words': 139}