Skip to content

Instantly share code, notes, and snippets.

View tnoda's full-sized avatar

Takahiro Noda tnoda

View GitHub Profile
require 'rake'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
;; ess-R-object-popup.el
;;
;; I have defined a function, ess-R-object-popup, that when
;; invoked, will return a popup with some information about
;; the object at point. The information returned is
;; determined by which R function is called. This is controlled
;; by an alist, called ess-R-object-popup-alist. The default is
;; given below. The keys are the classes of R object that will
;; use the associated function. For example, when the function
;; is called while point is on a factor object, a table of that
@tnoda
tnoda / m-fib.clj
Last active December 11, 2015 01:19 — forked from plaster/memotest.clj
元は, @plaster による `memoize` を使ったメモ化再帰 (memotest.clj). オリジナルで atom を使っていたところを var に置きかえてみました (m-fib.clj).
(def ^:dynamic *m-fib*)
(defn fib
[n]
(let [fib* (memoize (fn
[x]
(if (< 1 x)
(+ (*m-fib* (dec x))
(*m-fib* (- x 2)))
1)))]
;;;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])
@tnoda
tnoda / problem.md
Created November 14, 2012 12:25 — forked from Kuchitama/Probrem1.clj
Nine solutions to Problem 1 of Project Euler in Clojure

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.


Retrieved from http://projecteuler.net/problem=1, on Nov 14 2012.

@tnoda
tnoda / big.clj
Created September 5, 2012 05:53 — forked from halcat0x15a/big.clj
user> (bench insert-vector [] 1000)
"Elapsed time: 117.616 msecs"
[835 483 229 138 454 643 450 636 792 357 35 455 986 249 181 25 966 519 590 71 ...]
user> (bench insert-vector' [] 1000)
"Elapsed time: 61.382 msecs"
[545 468 921 491 728 783 577 15 620 231 787 537 8 435 730 842 334 55 527 534 ...]
@tnoda
tnoda / hoge.clj
Created July 14, 2012 16:07 — forked from ponkore/hoge.clj
RubyにおけるシーケンスはObject#repeatに任せなさい!を Clojure でやってみた
;;; http://melborne.github.com/2012/07/12/object-repeat-take-care-of-sequence/
;;; を Clojure でやってみた。
;;; 9.、10. は挫折www
;;; 1. 初項1、公差2の等差数列の最初の20項を求めなさい。
(take 20 (iterate #(+ % 2) 1))
;;; => (1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39)
;;; 2. 初項3、公比2の等比数列の最初の20項を求めなさい。
(take 20 (iterate #(* % 2) 3))
@tnoda
tnoda / cljdoc.el
Created April 9, 2012 01:57 — forked from tavisrudd/cljdoc.el
cljdoc.el --- eldoc mode for clojure
;;; cljdoc.el --- eldoc mode for clojure
;; Copyright (C) 2011 tomykaira
;; Version 0.1.0
;; Keywords: eldoc clojure
;; Author: tomykaira <tomykaira@gmail.com>
;; URL: https://gist.github.com/1386472
;; This file is not part of GNU Emacs.