Shammer's Philosophy

My private adversaria

2016-04-01から1ヶ月間の記事一覧

Directory traversal check with Lisp

I want to write code to check directory traversal. In other words, replace ".." with other values if strings includes "..". For example, the string "/aaa/../index.html" should be replaced with "/index.html". And I want to write this code a…

別パッケージのコンディションを使用する

目的 Lispのパッケージで可読性が・・・ - Shammerismで、同一パッケージのソースコードを複数ファイルに分割可能とわかった。次のステップとしてアプリ・システム全体で独自のコンディションを使用してみる。個々の処理ごとに発生する可能性のあるコンディ…

Lispのパッケージで可読性が・・・

パッケージを多用した際の問題点 load したファイルで in-package しているとどうなる? - Shammerismで書いた内容に近いだろうか。Lispで大きいアプリケーションを書いていると、メソッド呼出の際のパッケージ名があちこちに入ってコードが読みにくくなる。…

rewrite http-read-line of http://d.hatena.ne.jp/shammer/20160320/p1

In the article Lisp HTTP Client handling chunked responses - Shammerism, I wrote a HTTP client which can handle chunked response. In this article, the function whose name is http-read-line uses do loop, but I would like to rewrite as recur…

Lisp repeat-string

I wrote this article to concatenate some character without dotimes, using with-output-to-string instead. But, I noticed more easy way to recursive function. Here is a last version. (defun str (x) (typecase x (cons (concatenate 'string (str…

How to add same character repeatedly without dotimes?

Sometimes I want to add some character repeatedly like generating something depended on how many there are. For example, organizing a file name with sequence numbers which might be different length, the length of sequence number 0 is 1, bu…

my is-dot-cons is a bad function...

I wrote is-dot-cons to check if it is a dot cons written at Is normal cons? Is dot cons? - Shammerism, but it has a bug. This function is not considered the following cons. ("100" . '(10 20 30))This is a dot cons, but cdr is not atom, so m…