<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>mojavy.com</title>
    <link>http://mojavy.com/blog</link>
    <description></description>
    <pubDate>Mon, 18 Feb 2013 20:30:00 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>LTSV for Common Lisp 作りました</title>
      <link>http://mojavy.com/blog/2013/02/18/ltsv-for-common-lisp/</link>
      <pubDate>Mon, 18 Feb 2013 20:30:00 JST</pubDate>
      <category><![CDATA[ltsv]]></category>
      <category><![CDATA[common lisp]]></category>
      <guid isPermaLink="true">http://mojavy.com/blog/2013/02/18/ltsv-for-common-lisp/</guid>
      <description>LTSV for Common Lisp 作りました</description>
      <content:encoded><![CDATA[<p><img alt="lisp" src="/images/lisp-alien-logo.png" /></p>
<p>ブームは過ぎ去ってしまいましたが、意外とまだなかったのでCommon LispのLTSVパーサつくりました。</p>
<p><a href="https://github.com/taksatou/cl-ltsv">https://github.com/taksatou/cl-ltsv</a></p>
<p><a href="http://ltsv.org/">http://ltsv.org/</a></p>
<h3 id="_1">インストール</h3>
<p>現在(2013-02-18) quicklisp登録申請中です。登録されれば以下でインストールできます。</p>
<div class="pygments_borland"><pre>(ql:quickload &#39;cl-ltsv)
</pre></div>

<h3 id="_2">使い方</h3>
<p>以下のように使います。</p>
<div class="pygments_borland"><pre>CL-USER&gt; (cl-ltsv:parse-line &quot;host:127.0.0.1    ident:- user:frank&quot;)
((&quot;host&quot; . &quot;127.0.0.1&quot;) (&quot;ident&quot; . &quot;-&quot;) (&quot;user&quot; . &quot;frank&quot;))

CL-USER&gt; (with-input-from-string (ss &quot;host:127.0.0.1    ident:- user:frank
host:127.0.0.1  ident:- user:jane
host:127.0.0.1  ident:- user:john&quot;)
           (cl-ltsv:with-ltsv-from-stream (entry ss)
             (print entry)))

((&quot;host&quot; . &quot;127.0.0.1&quot;) (&quot;ident&quot; . &quot;-&quot;) (&quot;user&quot; . &quot;frank&quot;)) 
((&quot;host&quot; . &quot;127.0.0.1&quot;) (&quot;ident&quot; . &quot;-&quot;) (&quot;user&quot; . &quot;jane&quot;)) 
((&quot;host&quot; . &quot;127.0.0.1&quot;) (&quot;ident&quot; . &quot;-&quot;) (&quot;user&quot; . &quot;john&quot;)) 
NIL

CL-USER&gt; (cl-ltsv:alist-ltsv &#39;((&quot;host&quot; . &quot;127.0.0.1&quot;) (&quot;ident&quot; . &quot;-&quot;) (&quot;user&quot; . &quot;frank&quot;)))
&quot;host:127.0.0.1 ident:- user:frank&quot;
</pre></div>

<ul>
<li>cl-ltsv:parse-lineするとalistを返します</li>
<li>cl-ltsv:with-ltsv-from-stream を使えば1行ずつパースしてループします</li>
<li>cl-ltsv:alist-ltsv でalistからltsv形式の文字列に変換できます</li>
</ul>
<h3 id="_3">まとめ</h3>
<p>ライブラリにするほどでもなかった気はしますが、Common Lispには文字列のsplitが標準でついてなくてちょっと面倒に感じることもあったのでないよりはましかな、ということで作りました。</p>
<p>フィードバック等ありましたらコメント頂けるとうれしいです。</p>]]></content:encoded>
    </item>
  </channel>
</rss>
