Skip to content

Instantly share code, notes, and snippets.

View y2q-actionman's full-sized avatar
🕹️
👾👾👾👾👾👾👾👾👾

Yokota Yuki y2q-actionman

🕹️
👾👾👾👾👾👾👾👾👾
View GitHub Profile
@y2q-actionman
y2q-actionman / puyopuyo.lisp
Last active July 6, 2018 03:59
ぷよぷよ19連鎖
;; http://d.hatena.ne.jp/yarb/20110202/p1
;; http://okajima.air-nifty.com/b/2011/01/2011-ffac.html
;;; solving time (19 chain) -- 1h26min :/
;; -rw-r--r-- 1 y2q staff 4656 5 16 04:58 puyopuyo.lisp
;; -rw-r--r-- 1 y2q staff 22 5 16 03:32 puyopuyo.lisp~
(ql:quickload "alexandria")
(in-package :cl-user)
@y2q-actionman
y2q-actionman / twitter-test.lisp
Last active March 7, 2019 03:39
twitter に所定の時間に自動投稿する
(in-package :cl-user)
#|
(ql:quickload :chirp)
(setf chirp:*oauth-api-key* "**************************"
chirp:*oauth-api-secret* "***************************"
chirp:*oauth-access-token* "*******************************"
chirp:*oauth-access-secret* "***************************")
|#
(in-package :cl-user)
;; https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
;; 1:00
(defun problem1-for (numlist)
(let ((ret 0))
(dolist (n numlist ret)
(incf ret n))))
@y2q-actionman
y2q-actionman / advent-2014-12-11.org
Last active January 17, 2021 07:08
Lisp Advent Calendar 2014-12-11

C系言語から Common Lisp に移行した時に戸惑ったこと

この文章は、 Lisp Advent Calendar 2014 の 12/11 担当分の記事として書かれました。

概要

C系言語から Common Lisp に移行した時、「どうして Lisp はこんなに書き辛いんだ?」と思っていたことを記憶しています。

;; 前置きとして…
;; どんな言語にもあると思いますが、 Common Lisp にも一般的なスタイルがあります。
;; まずは、それに目を通すことをおすすめします。
;;
;; Google Common Lisp Style Guide
;; en: https://google-styleguide.googlecode.com/svn/trunk/lispguide.xml
;; jp: http://lisphub.jp/doc/google-common-lisp-style-guide/
;;
;; Tutorial on Good Lisp Programming Style
;; en: http://www.norvig.com/luv-slides.ps
@y2q-actionman
y2q-actionman / join.lisp
Created October 25, 2014 07:34
cl:reduce で文字列として join する。
(defun join (lis &optional (sep " "))
(reduce #'(lambda (x y)
(concatenate 'string
(princ-to-string x) sep (princ-to-string y)))
lis))
#|
CL-USER> (defun join (lis &optional (sep " "))
(reduce #'(lambda (x y)
(concatenate 'string
@y2q-actionman
y2q-actionman / agenda.org
Last active December 27, 2021 07:26
型宣言を付けたら遅くなった話

型宣言を付けたら遅くなった話

@y2q-actionman
y2q-actionman / dollar_sign.lisp
Created August 12, 2014 03:06
Haskell の $ もどき in Common Lisp
;; Haskell の $ もどき in Common Lisp
;; http://practical-scheme.net/wiliki/wiliki.cgi?Gauche%3A%24
;; (fn1 $ fn2 $ fn3 $ fn4 x) -> (fn1 (fn2 (fn3 (fn4 x))))
(defun $-expand (forms)
(cond ((null forms)
nil)
((eq '$ (car forms))
(list ($-expand (cdr forms))))
(t
@y2q-actionman
y2q-actionman / revattack.lisp
Created August 11, 2014 10:49
簡易 method chain 的なやつ in Common Lisp
(defun suffix-transpose1 (form terminal)
(if form
(suffix-transpose1 (cdr form)
(list (cons (car form) terminal)))
terminal))
(defun suffix-transpose (form)
(car (suffix-transpose1 (cdr form)
(list (car form)))))
@y2q-actionman
y2q-actionman / gist:11133761
Last active August 29, 2015 14:00
Ubuntu 12 上の SBCL で ncurses が FFI から読めない問題

Ubuntu 12 上の SBCL で ncurses が FFI から読めない問題

症状

cl-charms (CFFI + ncurses) の場合

Common Lisp から、 NCURSES を触りたくなった。早速、Quicklisp で、 cl-charms をインストールしてみよう:

 * (ql:quickload "cl-charms")
To load "cl-charms":