##GitHub Pagesの開設のしかた(2012年9月版)
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from gi.repository import Skk | |
import sys | |
Skk.init() | |
dictionaries = [] | |
dictionary = Skk.FileDict.new("/usr/share/skk/SKK-JISYO.L", "EUC-JP") | |
dictionaries.append(dictionary) |
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
// papamitraさんの「Scalaの限定継続で四天王問題解いてみた」 | |
// http://d.hatena.ne.jp/papamitra/20100912/continuations | |
// | |
// について、何が起こっているのかわからなかったので、println仕込んで解析してみた。 | |
// | |
// 実行方法 | |
// scalac -P:continuations:enable Amb.scala | |
import scala.util.continuations._ |
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
//scalac -P:continuations:enable | |
import scala.util.continuations._ | |
object Amb{ | |
def amb[T](elements: T*):T @suspendable = shift{k:(T=>Unit) => elements.foreach(k)} | |
def block(body : => Unit @suspendable): Unit = reset(body) | |
def main(args: Array[String]) { | |
block { | |
val a = amb(1, 2, 3) | |
val b = amb("A", "B", "C") | |
println(a, b) |
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
// 後置インクリメントは限定継続を使って表せるし、 | |
// 逆に限定継続の一番身近な例が後置インクリメント | |
// http://www.kmonos.net/pub/Presen/fltv/FLTV.pdf | |
class BigInt { | |
BigInt&/<noreturn> operator++(int) { | |
var f = rest_of_full_expression(); | |
var g = after_full_expression(); | |
var r = f(*this); | |
this->incr(); | |
g(r); |
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
/** | |
* Returns a free port number on localhost. | |
* | |
* Heavily inspired from org.eclipse.jdt.launching.SocketUtil (to avoid a dependency to JDT just because of this). | |
* Slightly improved with close() missing in JDT. And throws exception instead of returning -1. | |
* | |
* @return a free port number on localhost | |
* @throws IllegalStateException if unable to find a free port | |
*/ | |
private static int findFreePort() { |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
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
hippo-password-strength の master の最新の変更を取り込んでPRする。 | |
(すでにPR出している場合) | |
``` | |
git remote add upstream git@github.com:kurotaky/hippo-password-strength.git | |
git checkout master | |
git pull upstream master | |
git checkout using-img-src | |
git rebase master using-img-src | |
git push -f origin using-img-src |
This post also appears on lisper.in.
Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.
Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):
The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.
OlderNewer