SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Common Lisp
  コードバトン
#1 g000001

 R6RS SchemeからCLに翻訳してみた
 CLには、標準ではmatchがない
     それ程複雑なパターンマッチでもない様子
     辞書エントリーのアクセサを定義すればOKかもし
     れない
アクセサが欲しかったので、defstruct(:type
list)で構造体を定義 
   entry-というアクセサ
   make-で定義した構造のリストも作れる
(defstruct (entry (:type list))
  word meaning ok-count ng-count)

(defun nomalize-dict (dict)
  (mapcar (lambda (e)
            (make-entry :word (entry-word e)
                        :meaning (entry-meaning e)
                        :ok-count (or (entry-ok-count e) 0)
                        :ng-count (or (entry-ng-count e) 0)))
          dict))
.

    sortには:keyを指定できるので単純に書ける

(defun sort-word-spec* (word-spec*)
  (sort word-spec*
        #'>
        :key (lambda (e)
               (- (entry-ng-count e) (entry-ok-count e)))))
再帰をやめてループ

(defun main (file)
  (let ((dict (sort-word-spec* (read-dict file))))
    (dolist (e dict)
      (pr "~&~A: " (entry-word e))
      (ready?)
      (pr "~&~A y/n? " (entry-meaning e))
    :again
      (case (query)
        ((#Y #y) (incf (entry-ok-count e)))
        ((#N #n) (incf (entry-ng-count e)))
        ((#Q #q) (return))
        (otherwise
           (pr "~&Please type Y for yes or N for no or Q for quit.~%")
           (go :again))))
    (write-dict file dict)))
#2 aka
 英単語を登録できる関数追加 (hige:pin)
 辞書のCSV一覧表示関数追加 (hige:pun)
 名前空間周りの整理
    case-sensitive
    package名での管理
 read-char,clear-inputのシーケンスread-lineに変更
 documentationストリングをまめに書く
 処理に無駄がないように、read time evaluation活用
 制御に関わる部分は命令的に。関数の性質がある部分は関数
 的に。
aka

 正答率でソートする部分は、学習効率を高めるためのストラテジ
 の部分なので、関数として外に出して交換しやすく(sort-dict-
 standard)
 とにかくCLらしく、ということで、(lambda を#'(lambdaにかえたり
#3 quek

 "~" という処理系拡張を解釈しない処理系のために
 (merge-pathnames ".hige/words.txt"
                             (user-homedir-pathname)
 (probe-file dict-file) で辞書ファイルの存在をチェック
 辞書ファイルがない場合は
  (ensure-directories-exist dict-file)
 でディレクトリだけは作成しておく
#4 snmsts

 ABCLとswingでぬるめのUI(ABCL限定)
#5 (び)

 SBCL+Mac OS X縛りで出題単語を読
 み上げ
 (sayコマンドを利用)
#6 naoya_t

  辞書から単語をassocしてくる search-dict を実装
 単語を入力し、search-dict で検索し、見つかれば意味を、見つ
 からなければ "Not found." と返す(hige:pan)を実装
 aifマクロを追加
 (loop :for ... :in ... :do ...) を dolist で置き換えてみた
#7 masatoi

   iKnow!風にn択問題(hige:pen)を実装.英単語から意味を問うの
   と意味から英単語を問うのと選べる
   繰り返しはnamed-let

;; named-let macro (from "Let Over Lambda")
(defmacro nlet (tag var-vals &body body)
  `(labels ((,tag ,(mapcar #'car var-vals) ,@body))
     (declare (optimize (speed 3))) ; for tail recursion optimization
     (,tag ,@(mapcar #'cadr var-vals))))
#8 cranebird

   with-系のマクロを追加
   CLと言えばマルチパラダイムなので CLOSで

(defclass dict ()
  ((entries
    :accessor entries-of
    :initform nil
    :initarg :entries
    :documentation "Entries"))
  (:documentation "Container class"))
cranebird

   print-objectを定義



CL-USER> (hige::make-dict '((hige "ひげ" 0 0)))
#<dict: entries: 1 total/ok/ng: 0/0/0>
#9 smeghead

    問題の単語表示時にもスコアを表示するように
    単語の一覧表示(hige:pun)で指定したスコア以下の単語のみ
   を表示する機能を追加。
   問題の単語表示時にもスコアを表示するように

[5]> (hige:pun :score-threshold 5)
starbug1,スターバグ1号,3,0
river,川,5,0

NIL
[6]>
#10 NANRI

 untabify
 format指示子を大文字に揃える
    "~a~%" => "~A~%"
 インデントを調整
 辞書が存在しない時の動作を修正
 パッケージ名がprintされないようにしてみやすく
 asdfのパッケージ化
    (asdf-install:install "http://gist.github.
    com/gists/280060/download")
    でインストールできるようになった
#11 snmsts 2回目

  (び)さんの変更がSBCL+OS Xなので
  read-time conditionalizationをらしく修正

#+(and SBCL DARWIN) (sb-ext:run-program "/usr/bin/say"
`(,(symbol-name word)) :wait t)
#12 making
   辞書ファイルをhttp経由で取得できるようにした。
   要drakma(ウェブクライアント)。

(hige:pin "http://gist.github.com/273424.txt")

でウェブから辞書を取得できる
#13 深町英太郎
   単語登録時に意味を空にした際にGoogle翻訳の結果を登録で
   きるように。要cl-ppcre。

(defun prompt-for-translate (word)
 ...)))

(defun google-translate (word)
  ...))))
#14 kurohuku

   Gray Stream(オブジェクト指向なストリーム)を利用して暗記
   ゲームの回答時にログをファイル出力

CL-USER> (hige:Pon)
;; setup dict...done
lisp (score: 0):

舌足らず [Ynq]: Y ;Yと解答した時点でログが出力されて欲しい
#15 kosh 

   空のエントリを登録しないようにした(add empty-entry-p)

(defun empty-entry-p (entry)
  ...))
 
(defun add-entry (entry &key (if-exists :overwrite))
  ...)))

   ログファイルもディレクトリがない場合は作成するように
(ensure-directories-exist ,filename)
   (newLisp版も作成)
そして伝説へ…

 
まとめ
  
参加した人は
結構楽しんでいた様子
      
勉強になるよ
    
またやろうよ
    
 


参加してね

Mais conteúdo relacionado

Mais procurados

おいしいLisp
おいしいLispおいしいLisp
おいしいLispKent Ohashi
 
並行プログラミングと継続モナド
並行プログラミングと継続モナド並行プログラミングと継続モナド
並行プログラミングと継続モナドKousuke Ruichi
 
From Java To Clojure
From Java To ClojureFrom Java To Clojure
From Java To ClojureKent Ohashi
 
コードで感じるKotlin入門
コードで感じるKotlin入門コードで感じるKotlin入門
コードで感じるKotlin入門iPride Co., Ltd.
 
Everyday Life with clojure.spec
Everyday Life with clojure.specEveryday Life with clojure.spec
Everyday Life with clojure.specKent Ohashi
 
2018年夏のPerl5
2018年夏のPerl52018年夏のPerl5
2018年夏のPerl5charsbar
 
HashTable と HashDos
HashTable と HashDosHashTable と HashDos
HashTable と HashDosYuya Takeyama
 
Local php-100828 2
Local php-100828 2Local php-100828 2
Local php-100828 2Akio Ishida
 
Computation Expressions for Haxe
Computation Expressions for HaxeComputation Expressions for Haxe
Computation Expressions for Haxeterurou
 
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜Kenta USAMI
 
Lisp Tutorial for Pythonista : Day 3
Lisp Tutorial for Pythonista : Day 3Lisp Tutorial for Pythonista : Day 3
Lisp Tutorial for Pythonista : Day 3Ransui Iso
 
Boost.勉強会#19東京 Effective Modern C++とC++ Core Guidelines
Boost.勉強会#19東京 Effective Modern C++とC++ Core GuidelinesBoost.勉強会#19東京 Effective Modern C++とC++ Core Guidelines
Boost.勉強会#19東京 Effective Modern C++とC++ Core GuidelinesShintarou Okada
 

Mais procurados (20)

Functional Way
Functional WayFunctional Way
Functional Way
 
おいしいLisp
おいしいLispおいしいLisp
おいしいLisp
 
並行プログラミングと継続モナド
並行プログラミングと継続モナド並行プログラミングと継続モナド
並行プログラミングと継続モナド
 
From Java To Clojure
From Java To ClojureFrom Java To Clojure
From Java To Clojure
 
Project coin
Project coinProject coin
Project coin
 
ret2libc
ret2libcret2libc
ret2libc
 
コードで感じるKotlin入門
コードで感じるKotlin入門コードで感じるKotlin入門
コードで感じるKotlin入門
 
Haskell で CLI
Haskell で CLIHaskell で CLI
Haskell で CLI
 
Perl io layer
Perl io layerPerl io layer
Perl io layer
 
Everyday Life with clojure.spec
Everyday Life with clojure.specEveryday Life with clojure.spec
Everyday Life with clojure.spec
 
2018年夏のPerl5
2018年夏のPerl52018年夏のPerl5
2018年夏のPerl5
 
HashTable と HashDos
HashTable と HashDosHashTable と HashDos
HashTable と HashDos
 
Local php-100828 2
Local php-100828 2Local php-100828 2
Local php-100828 2
 
R spec勉強会
R spec勉強会R spec勉強会
R spec勉強会
 
Computation Expressions for Haxe
Computation Expressions for HaxeComputation Expressions for Haxe
Computation Expressions for Haxe
 
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
 
Lisp Tutorial for Pythonista : Day 3
Lisp Tutorial for Pythonista : Day 3Lisp Tutorial for Pythonista : Day 3
Lisp Tutorial for Pythonista : Day 3
 
Php5.4
Php5.4Php5.4
Php5.4
 
Boost.勉強会#19東京 Effective Modern C++とC++ Core Guidelines
Boost.勉強会#19東京 Effective Modern C++とC++ Core GuidelinesBoost.勉強会#19東京 Effective Modern C++とC++ Core Guidelines
Boost.勉強会#19東京 Effective Modern C++とC++ Core Guidelines
 
Php2 s1
Php2 s1Php2 s1
Php2 s1
 

Destaque

Building Bridges between Academic Tribes
Building Bridges between Academic TribesBuilding Bridges between Academic Tribes
Building Bridges between Academic TribesMartin Rehm
 
Finding and sharing resources
Finding and sharing resourcesFinding and sharing resources
Finding and sharing resourcesLis Parcell
 
Unit 1.3 Introduction to Programming (Part 3)
Unit 1.3 Introduction to Programming (Part 3)Unit 1.3 Introduction to Programming (Part 3)
Unit 1.3 Introduction to Programming (Part 3)Intan Jameel
 
Open Educational Resources and Practices for Higher Education
Open Educational Resources and Practices for Higher EducationOpen Educational Resources and Practices for Higher Education
Open Educational Resources and Practices for Higher EducationLis Parcell
 
Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9Terri Weiss
 
A Long Walk to Water - Lssn 8
A Long Walk to Water - Lssn 8A Long Walk to Water - Lssn 8
A Long Walk to Water - Lssn 8Terri Weiss
 
A Long Walk to Water: Lesson14 unit2
A Long Walk to Water: Lesson14 unit2A Long Walk to Water: Lesson14 unit2
A Long Walk to Water: Lesson14 unit2Terri Weiss
 
Inbound Marketing Cookbook
Inbound Marketing CookbookInbound Marketing Cookbook
Inbound Marketing CookbookEddie Choi
 
Corey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and MobileCorey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and MobileChandra Shekhar Tekwani
 
Risk management v imp
Risk management v impRisk management v imp
Risk management v impSIVA GOPAL
 
SHARE-IT - A Blog “from Researchers for Researchers”
SHARE-IT - A Blog “from Researchers for Researchers”SHARE-IT - A Blog “from Researchers for Researchers”
SHARE-IT - A Blog “from Researchers for Researchers”Martin Rehm
 
Examenopleiding energieconsulent mfl
Examenopleiding energieconsulent mflExamenopleiding energieconsulent mfl
Examenopleiding energieconsulent mflwweijmans
 
Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213Lis Parcell
 
Finding and sharing good stuff: open practice, open educational resources and...
Finding and sharing good stuff: open practice, open educational resources and...Finding and sharing good stuff: open practice, open educational resources and...
Finding and sharing good stuff: open practice, open educational resources and...Lis Parcell
 
Communes, Commonism and Co-ops: Rethinking the university as a hackerspace
Communes, Commonism and Co-ops: Rethinking the university as a hackerspaceCommunes, Commonism and Co-ops: Rethinking the university as a hackerspace
Communes, Commonism and Co-ops: Rethinking the university as a hackerspaceJoss Winn
 
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...Guy Haviv
 

Destaque (20)

Building Bridges between Academic Tribes
Building Bridges between Academic TribesBuilding Bridges between Academic Tribes
Building Bridges between Academic Tribes
 
Finding and sharing resources
Finding and sharing resourcesFinding and sharing resources
Finding and sharing resources
 
Unit 2.9 Tables
Unit 2.9 TablesUnit 2.9 Tables
Unit 2.9 Tables
 
Unit 1.3 Introduction to Programming (Part 3)
Unit 1.3 Introduction to Programming (Part 3)Unit 1.3 Introduction to Programming (Part 3)
Unit 1.3 Introduction to Programming (Part 3)
 
Open Educational Resources and Practices for Higher Education
Open Educational Resources and Practices for Higher EducationOpen Educational Resources and Practices for Higher Education
Open Educational Resources and Practices for Higher Education
 
Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9
 
Unit3 lesson6
Unit3 lesson6Unit3 lesson6
Unit3 lesson6
 
A Long Walk to Water - Lssn 8
A Long Walk to Water - Lssn 8A Long Walk to Water - Lssn 8
A Long Walk to Water - Lssn 8
 
Iran pagana
Iran paganaIran pagana
Iran pagana
 
Agile Memcached
Agile MemcachedAgile Memcached
Agile Memcached
 
A Long Walk to Water: Lesson14 unit2
A Long Walk to Water: Lesson14 unit2A Long Walk to Water: Lesson14 unit2
A Long Walk to Water: Lesson14 unit2
 
Inbound Marketing Cookbook
Inbound Marketing CookbookInbound Marketing Cookbook
Inbound Marketing Cookbook
 
Corey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and MobileCorey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and Mobile
 
Risk management v imp
Risk management v impRisk management v imp
Risk management v imp
 
SHARE-IT - A Blog “from Researchers for Researchers”
SHARE-IT - A Blog “from Researchers for Researchers”SHARE-IT - A Blog “from Researchers for Researchers”
SHARE-IT - A Blog “from Researchers for Researchers”
 
Examenopleiding energieconsulent mfl
Examenopleiding energieconsulent mflExamenopleiding energieconsulent mfl
Examenopleiding energieconsulent mfl
 
Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213Jisc RSC Wales ISS 260213
Jisc RSC Wales ISS 260213
 
Finding and sharing good stuff: open practice, open educational resources and...
Finding and sharing good stuff: open practice, open educational resources and...Finding and sharing good stuff: open practice, open educational resources and...
Finding and sharing good stuff: open practice, open educational resources and...
 
Communes, Commonism and Co-ops: Rethinking the university as a hackerspace
Communes, Commonism and Co-ops: Rethinking the university as a hackerspaceCommunes, Commonism and Co-ops: Rethinking the university as a hackerspace
Communes, Commonism and Co-ops: Rethinking the university as a hackerspace
 
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
 

Semelhante a Lisp batton - Common LISP

Cookpad Summer Intern 2015 - Programming Paradigm
Cookpad Summer Intern 2015 - Programming ParadigmCookpad Summer Intern 2015 - Programming Paradigm
Cookpad Summer Intern 2015 - Programming ParadigmMinero Aoki
 
初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)Masahiro Hayashi
 
やや関数型を意識した風Elixir/Phoenixご紹介
やや関数型を意識した風Elixir/Phoenixご紹介やや関数型を意識した風Elixir/Phoenixご紹介
やや関数型を意識した風Elixir/Phoenixご紹介fukuoka.ex
 
第1回勉強会スライド
第1回勉強会スライド第1回勉強会スライド
第1回勉強会スライドkoturn 0;
 
asm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesasm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesNoritada Shimizu
 
Clojure programming-chapter-2
Clojure programming-chapter-2Clojure programming-chapter-2
Clojure programming-chapter-2Masao Kato
 
メタメタプログラミングRuby
メタメタプログラミングRubyメタメタプログラミングRuby
メタメタプログラミングRubyemasaka
 
Material
MaterialMaterial
Material_TUNE_
 
Scalaで萌える関数型プログラミング[完全版]
Scalaで萌える関数型プログラミング[完全版]Scalaで萌える関数型プログラミング[完全版]
Scalaで萌える関数型プログラミング[完全版]Ra Zon
 
Lisp tutorial for Pythonista : Day 2
Lisp tutorial for Pythonista : Day 2Lisp tutorial for Pythonista : Day 2
Lisp tutorial for Pythonista : Day 2Ransui Iso
 
関数型言語&形式的手法セミナー(3)
関数型言語&形式的手法セミナー(3)関数型言語&形式的手法セミナー(3)
関数型言語&形式的手法セミナー(3)啓 小笠原
 
PythonでLispを実装した (evalつき)
PythonでLispを実装した (evalつき)PythonでLispを実装した (evalつき)
PythonでLispを実装した (evalつき)t-sin
 
普通のプログラミング言語R
普通のプログラミング言語R普通のプログラミング言語R
普通のプログラミング言語RShuyo Nakatani
 
Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Ransui Iso
 
第2回勉強会スライド
第2回勉強会スライド第2回勉強会スライド
第2回勉強会スライドkoturn 0;
 
Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)Shintaro Fukushima
 

Semelhante a Lisp batton - Common LISP (20)

Cookpad Summer Intern 2015 - Programming Paradigm
Cookpad Summer Intern 2015 - Programming ParadigmCookpad Summer Intern 2015 - Programming Paradigm
Cookpad Summer Intern 2015 - Programming Paradigm
 
初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)初心者講習会資料(Osaka.R#7)
初心者講習会資料(Osaka.R#7)
 
やや関数型を意識した風Elixir/Phoenixご紹介
やや関数型を意識した風Elixir/Phoenixご紹介やや関数型を意識した風Elixir/Phoenixご紹介
やや関数型を意識した風Elixir/Phoenixご紹介
 
第1回勉強会スライド
第1回勉強会スライド第1回勉強会スライド
第1回勉強会スライド
 
asm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesasm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web games
 
ATN No.2 Scala事始め
ATN No.2 Scala事始めATN No.2 Scala事始め
ATN No.2 Scala事始め
 
Clojure programming-chapter-2
Clojure programming-chapter-2Clojure programming-chapter-2
Clojure programming-chapter-2
 
メタメタプログラミングRuby
メタメタプログラミングRubyメタメタプログラミングRuby
メタメタプログラミングRuby
 
Material
MaterialMaterial
Material
 
Scalaで萌える関数型プログラミング[完全版]
Scalaで萌える関数型プログラミング[完全版]Scalaで萌える関数型プログラミング[完全版]
Scalaで萌える関数型プログラミング[完全版]
 
Lisp tutorial for Pythonista : Day 2
Lisp tutorial for Pythonista : Day 2Lisp tutorial for Pythonista : Day 2
Lisp tutorial for Pythonista : Day 2
 
関数型言語&形式的手法セミナー(3)
関数型言語&形式的手法セミナー(3)関数型言語&形式的手法セミナー(3)
関数型言語&形式的手法セミナー(3)
 
PythonでLispを実装した (evalつき)
PythonでLispを実装した (evalつき)PythonでLispを実装した (evalつき)
PythonでLispを実装した (evalつき)
 
普通のプログラミング言語R
普通のプログラミング言語R普通のプログラミング言語R
普通のプログラミング言語R
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
 
Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6
 
たのしい関数型
たのしい関数型たのしい関数型
たのしい関数型
 
第2回勉強会スライド
第2回勉強会スライド第2回勉強会スライド
第2回勉強会スライド
 
Unix
UnixUnix
Unix
 
Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)
 

Lisp batton - Common LISP

  • 2. #1 g000001 R6RS SchemeからCLに翻訳してみた CLには、標準ではmatchがない それ程複雑なパターンマッチでもない様子 辞書エントリーのアクセサを定義すればOKかもし れない
  • 3. アクセサが欲しかったので、defstruct(:type list)で構造体を定義  entry-というアクセサ make-で定義した構造のリストも作れる (defstruct (entry (:type list))   word meaning ok-count ng-count) (defun nomalize-dict (dict)   (mapcar (lambda (e)             (make-entry :word (entry-word e)                         :meaning (entry-meaning e)                         :ok-count (or (entry-ok-count e) 0)                         :ng-count (or (entry-ng-count e) 0)))           dict))
  • 4. . sortには:keyを指定できるので単純に書ける (defun sort-word-spec* (word-spec*)   (sort word-spec*         #'>         :key (lambda (e)                (- (entry-ng-count e) (entry-ok-count e)))))
  • 5. 再帰をやめてループ (defun main (file)   (let ((dict (sort-word-spec* (read-dict file))))     (dolist (e dict)       (pr "~&~A: " (entry-word e))       (ready?)       (pr "~&~A y/n? " (entry-meaning e))     :again       (case (query)         ((#Y #y) (incf (entry-ok-count e)))         ((#N #n) (incf (entry-ng-count e)))         ((#Q #q) (return))         (otherwise            (pr "~&Please type Y for yes or N for no or Q for quit.~%")            (go :again))))     (write-dict file dict)))
  • 6. #2 aka 英単語を登録できる関数追加 (hige:pin) 辞書のCSV一覧表示関数追加 (hige:pun) 名前空間周りの整理 case-sensitive package名での管理 read-char,clear-inputのシーケンスread-lineに変更 documentationストリングをまめに書く 処理に無駄がないように、read time evaluation活用 制御に関わる部分は命令的に。関数の性質がある部分は関数 的に。
  • 8. #3 quek "~" という処理系拡張を解釈しない処理系のために (merge-pathnames ".hige/words.txt"                             (user-homedir-pathname) (probe-file dict-file) で辞書ファイルの存在をチェック 辞書ファイルがない場合は  (ensure-directories-exist dict-file) でディレクトリだけは作成しておく
  • 10. #5 (び) SBCL+Mac OS X縛りで出題単語を読 み上げ (sayコマンドを利用)
  • 11. #6 naoya_t  辞書から単語をassocしてくる search-dict を実装 単語を入力し、search-dict で検索し、見つかれば意味を、見つ からなければ "Not found." と返す(hige:pan)を実装 aifマクロを追加 (loop :for ... :in ... :do ...) を dolist で置き換えてみた
  • 12. #7 masatoi iKnow!風にn択問題(hige:pen)を実装.英単語から意味を問うの と意味から英単語を問うのと選べる 繰り返しはnamed-let ;; named-let macro (from "Let Over Lambda") (defmacro nlet (tag var-vals &body body)   `(labels ((,tag ,(mapcar #'car var-vals) ,@body))      (declare (optimize (speed 3))) ; for tail recursion optimization      (,tag ,@(mapcar #'cadr var-vals))))
  • 13. #8 cranebird with-系のマクロを追加 CLと言えばマルチパラダイムなので CLOSで (defclass dict ()   ((entries     :accessor entries-of     :initform nil     :initarg :entries     :documentation "Entries"))   (:documentation "Container class"))
  • 14. cranebird print-objectを定義 CL-USER> (hige::make-dict '((hige "ひげ" 0 0))) #<dict: entries: 1 total/ok/ng: 0/0/0>
  • 15. #9 smeghead  問題の単語表示時にもスコアを表示するように  単語の一覧表示(hige:pun)で指定したスコア以下の単語のみ を表示する機能を追加。 問題の単語表示時にもスコアを表示するように [5]> (hige:pun :score-threshold 5) starbug1,スターバグ1号,3,0 river,川,5,0 NIL [6]>
  • 16. #10 NANRI untabify format指示子を大文字に揃える "~a~%" => "~A~%" インデントを調整 辞書が存在しない時の動作を修正 パッケージ名がprintされないようにしてみやすく asdfのパッケージ化 (asdf-install:install "http://gist.github. com/gists/280060/download") でインストールできるようになった
  • 17. #11 snmsts 2回目 (び)さんの変更がSBCL+OS Xなので read-time conditionalizationをらしく修正 #+(and SBCL DARWIN) (sb-ext:run-program "/usr/bin/say" `(,(symbol-name word)) :wait t)
  • 18. #12 making 辞書ファイルをhttp経由で取得できるようにした。 要drakma(ウェブクライアント)。 (hige:pin "http://gist.github.com/273424.txt") でウェブから辞書を取得できる
  • 19. #13 深町英太郎 単語登録時に意味を空にした際にGoogle翻訳の結果を登録で きるように。要cl-ppcre。 (defun prompt-for-translate (word)  ...))) (defun google-translate (word)   ...))))
  • 20. #14 kurohuku Gray Stream(オブジェクト指向なストリーム)を利用して暗記 ゲームの回答時にログをファイル出力 CL-USER> (hige:Pon) ;; setup dict...done lisp (score: 0): 舌足らず [Ynq]: Y ;Yと解答した時点でログが出力されて欲しい
  • 21. #15 kosh  空のエントリを登録しないようにした(add empty-entry-p) (defun empty-entry-p (entry)   ...))   (defun add-entry (entry &key (if-exists :overwrite))   ...))) ログファイルもディレクトリがない場合は作成するように (ensure-directories-exist ,filename) (newLisp版も作成)