Find it here: https://github.com/bitemyapp/learnhaskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn p19-solution [] | |
(let [multiple? #(zero? (rem %1 %2)) | |
leap-year? #(or (and (multiple? % 4) | |
(not (multiple? % 100))) | |
(multiple? % 400)) | |
february #(if (leap-year? %) 29 28) | |
mdays [31 28 31 30 31 30 31 31 30 31 30 31] | |
mdays (map #(constantly %) mdays) | |
mdays (apply juxt (assoc (vec mdays) 1 february)) | |
months (mapcat mdays (range 1901 2001)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use feature ':5.10'; | |
use Marpa::XS; | |
use Data::Dumper; | |
# | |
# a simple CSS snippet for testing | |
# | |
my $text = q{ |