We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 2 columns, instead of 1 in line 2.
This file contains hidden or 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
aa,bb | |
cc,"dd,ee""F""" | |
"gg | |
hh" |
This file contains hidden or 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
(ns euler.problem011 | |
(:require [clojure.string :as string])) | |
(defn parse-numbers | |
[input] | |
(for [line (->> (string/split-lines input) | |
(map #(re-seq #"\d+" %))) | |
:when (not-empty line)] | |
(map #(Long/parseLong %) line))) |
This file contains hidden or 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
(define-syntax apply-> | |
(syntax-rules () | |
((_ e (f a ...)) (f e a ...)) | |
((_ e (f)) (f e)) | |
((_ e f) (f e)))) | |
(define-syntax %-> | |
(syntax-rules () | |
((_ e1 e2 e3 ...) (%-> (apply-> e1 e2) e3 ...)) | |
((_ e1 e2) (apply-> e1 e2)) |
This file contains hidden or 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
(ns multitable | |
(:use [clojure.pprint :only (cl-format)])) | |
(defn make-row-seq | |
[deltas row] | |
(lazy-seq | |
(cons row (make-row-seq deltas (map + deltas row))))) | |
(defn make-table | |
[n m] |
This file contains hidden or 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
from functools import partial as p | |
from itertools import ifilter | |
fth = lambda init, *fs: reduce(lambda a,f: f(a), fs, init) | |
is_prime = lambda n: n+1 == fth( | |
xrange(1, n+1), | |
p(ifilter, lambda potential: n%potential==0), | |
p(reduce, lambda x,y: x+y)) |
This file contains hidden or 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
from functools import partial as p | |
from itertools import ifilter | |
add = lambda x,y: x + y | |
is_factor = lambda n, potential: n%potential==0 | |
factors = lambda n: ifilter(p(is_factor, n), xrange(1, n+1)) | |
is_prime = lambda n: n+1 == reduce(add, factors(n)) |
This file contains hidden or 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
;;-coding: utf-8 -*- | |
;; leiningen プロジェクトの core.cljです。 | |
(ns pkginfo-gen.core | |
(:gen-class) | |
(:require [clojure.java.io :as io]) | |
(:require [clojure.string :as string])) | |
(def coding "utf-8") | |
(def info-filename "package-info.java") |
This file contains hidden or 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
#-*- coding:utf-8 -*- | |
import sqlite3 | |
import csv | |
import time | |
import os | |
from datetime import datetime | |
from itertools import islice | |
from itertools import izip_longest | |
from itertools import takewhile |