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
;;;; 2014-01-12 | |
;;;; 数字キーを押した時に数字じゃなく記号が出るようになるelisp | |
;; キーボード最上段を押下時 !@#$%^&*()-=\` が出力されます | |
;; SHIFT押しながらだと 1234567890_+|~ が出力されます | |
;; US配列 | |
(defvar alternate-chars | |
'(("1" "!") | |
("2" "@") | |
("3" "#") |
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
(require 'cl) | |
(defmacro aif (test then &optional else) | |
(declare (indent 2)) | |
`(let ((it ,test)) | |
(if it | |
,then | |
,else))) | |
(defmacro acond (&rest clauses) |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int memo[50]; | |
class CorporationSalary | |
{ | |
public: | |
vector <string> data; |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
class BadNeighbors | |
{ | |
public: | |
int maxDonations(vector <int> donations){ | |
int tmp[2] = {0}; | |
bool isEven = donations.size() % 2 == 0; |
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
(ql:quickload :cl-ppcre) | |
(defmacro replace-patterns (before after str) | |
(gen-replaces (reverse before) (reverse after) str)) | |
(defun gen-replaces (before after str) | |
`(ppcre:regex-replace-all | |
,(first before) | |
,(if (rest before) | |
(gen-replaces (rest before) (rest after) str) |
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
;; brainfuck interpreter 2014-02-15 | |
(defun run (sorce) | |
(let ((tape (make-array '(10) :initial-element 0)) | |
(i 0) | |
(ptr 0)) | |
(while (< i (length sorce)) | |
(case (elt sorce i) | |
(#\> (incf ptr) (incf i)) | |
(#\< (decf ptr) (incf i)) |
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
## PIPE BY PAIP ON MATZ LISP | |
## 2014-12-23 | |
# (primes 10) | |
# => [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] | |
(def make_pipe(head,tail) [head,tail] end) | |
(def head(pipe) pipe[0] end) | |
(def tail(pipe) pipe[1].kind_of?(Proc) ? pipe[1] = pipe[1].call : pipe[1] end) | |
(def butlast(ary) (ary.first ary.size-1) end) | |
(def my_succ(n) n+1 end) |
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
;;;; 2014-12-17 | |
;;;; 麻雀あがり判定プログラム | |
;; (agari? "11122233344455m") | |
;; => | |
;; ("123m123m123m444m55m" | |
;; "111m234m234m234m55m" | |
;; "111m234m345m345m22m" | |
;; "111m222m333m444m55m") | |
;; 天和が出るまでひたすら配牌を繰り返す |
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
@echo off | |
setlocal enabledelayedexpansion | |
rem hh:mm:ssを3桁の英数字に変換する 2015-01-23 | |
rem 04:04:33 -> 45x | |
set hash=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX | |
for /l %%i in (0, 1, 9) do set hash[0%%i]=!hash:~%%i,1! | |
for /l %%i in (10, 1, 59) do set hash[%%i]=!hash:~%%i,1! |
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
(defmacro for (data &rest body) | |
(let* ((var (first data)) | |
(start (second data)) | |
(stop (third data)) | |
(gstop (gensym)) ) | |
`(do ((,var ,start (1+ ,var)) | |
(,gstop ,stop)) | |
((> ,var ,gstop)) | |
,@body))) | |
OlderNewer