| 更新: | 2025-10-15 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2025.3 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
| #!/bin/bash | |
| # Description: | |
| # Backlog + git-flow + WIP PR script | |
| # Usage: | |
| # wip-pr pj-123 | |
| # | |
| # Requirement: | |
| # use Mac OS X |
| 更新: | 2025-10-15 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2025.3 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
| (require '[clojure.test :refer (with-test are run-tests)]) | |
| (with-test | |
| (defn str-drop-while-same [& args] | |
| (if (some nil? args) args | |
| (->> (map #(concat % (repeat nil)) args) | |
| (apply map vector) | |
| (drop-while #(apply = %)) | |
| (take-while #(some identity %)) | |
| (apply map str)))) |
| (use 'clojure.test) | |
| (with-test | |
| (defn f | |
| [& {:as options}] | |
| options) | |
| (is (nil? (f))) | |
| (is (thrown? IllegalArgumentException (f nil))) | |
| (is (thrown? IllegalArgumentException (f :a))) | |
| (is (= (f nil nil) {nil nil})) |
| (defn fib [n] | |
| (let [a-fib (atom false)] | |
| (reset! a-fib (memoize (fn [n] (if (< 1 n) (+ (@a-fib (- n 1)) (@a-fib (- n 2))) 1)))) | |
| (@a-fib n) | |
| )) | |
| ;;; inspired by @tnoda | |
| (def ^:dynamic *m-fib*) | |
| (defn fibv [n] | |
| (binding [*m-fib* (memoize (fn [x] (if (< 1 x) (+ (*m-fib* (- x 1)) (*m-fib* (- x 2))) 1)))] |
| Notes on how to use AWS SNS: | |
| 1. Subscribe an HTTP endpoint (i.e. http://myhost/sns_endpoint) on AWS Console | |
| 2. AWS will send subscription confirmation right away | |
| 3. SNS_controller responds to subscription confirmation by sending confirmation using Fog. | |
| 4. Once AWS is happy, you can start sending notifications to your end point via SNS. |
| (use 'clojure.test) | |
| ;; ピタゴラス数チェック | |
| (defn pythagorean? | |
| [a b c] | |
| (= (* c c) (+ (* a a) (* b b)))) | |
| (is (pythagorean? 3 4 5)) | |
| ;; 合計が a+b+c かつ 0 < a < b < c になるような組の列挙 |
| ;;;A palindromic number reads the same both ways. | |
| ;;;The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. | |
| ;;;Find the largest palindrome made from the product of two 3-digit numbers. | |
| ;;;左右どちらから読んでも同じ値になる数を回文数という。 2桁の数の積で表される回文数のうち、 | |
| ;;;最大のものは 9009 = 91 × 99 である。 | |
| ;;;では、3桁の数の積で表される回文数のうち最大のものはいくらになるか。 | |
| (ns projecteuler.problem-4 | |
| (:require [clojure.string :as str]) |