This file contains hidden or 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
    
  
  
    
  | open System | |
| #r "System.ComponentModel.DataAnnotations" | |
| open System.ComponentModel.DataAnnotations | |
| open System.Collections.Generic | |
| type Person() = | |
| let mutable name = "" | |
| let mutable phone = "" | |
| let mutable age = 0 | 
  
    
      This file contains hidden or 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
    
  
  
    
  | static class ExtentionMethods | |
| { | |
| /// <summary> | |
| /// sequenceをn要素のリストに分割する。 | |
| /// sequenceの要素数がnで割り切れない場合は最後のリストの要素数はn個より少なくなる。 | |
| /// </summary> | |
| /// <typeparam name="T"></typeparam> | |
| /// <param name="list"></param> | |
| /// <param name="n"></param> | |
| /// <returns></returns> | 
  
    
      This file contains hidden or 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
    
  
  
    
  | /// <summary> | |
| /// コンテナのキー等で型の別名を定義したいときに使うクラス | |
| /// </summary> | |
| /// <typeparam name="T"></typeparam> | |
| public class NewType<T> : IEquatable<NewType<T>> | |
| { | |
| /// <summary> | |
| /// 生の値を取得します | |
| /// </summary> | |
| public T Value { get; private set; } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | (require '[clojure.contrib.io :as io]) | |
| (defmacro with-out-string | |
| [& body] | |
| `(let [writer# (java.io.StringWriter.)] | |
| (io/with-out-writer writer# | |
| ~@body) | |
| (-> writer# .toString))) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | ;; 39 | |
| (fn [as bs] (mapcat list as bs)) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | ;; 40 | |
| (fn interpose- [i l] | |
| (let [[x & xs] l] | |
| (if (nil? xs) | |
| (list x) | |
| (lazy-seq | |
| (cons x | |
| (cons i (interpose- i xs))))))) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | 趣旨 | |
| 簡単なプログラムを通じて、 | |
| Clojureの基本的なライブラリを探訪しよう | |
| www.4clojure.com | |
| (= __ (.toUpperCase "hello world")) | |
| => "HELLO WORLD" | 
  
    
      This file contains hidden or 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
    
  
  
    
  | (defn xml->hiccup [xml] | |
| (cond | |
| (string? xml) xml | |
| (map? xml) | |
| (let [{:keys [tag attrs content]} xml] | |
| (-> [tag] | |
| (#(if (nil? attrs) % (conj % attrs))) | |
| (#(if (empty? content) % ((comp vec concat) % (map xml->hiccup content)))))) | |
| )) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | (defn my-encode-params | |
| "Turn a map of parameters into a urlencoded string." | |
| [params] | |
| (letfn [(encode [s] (URLEncoder/encode (as-str s) "UTF-8"))] | |
| (str-join "&" | |
| (for [[k v] params] | |
| (str (encode k) "=" (encode v)))))) | |
| (alter-var-root (var encode-params) (fn [_] my-encode-params)) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | actionmailer (2.3.2) | |
| actionpack (2.3.2) | |
| activerecord (2.3.2) | |
| activeresource (2.3.2) | |
| activesupport (2.3.2) | |
| hoe (2.0.0, 1.7.0) | |
| hpricot (0.6.161) | |
| mechanize (0.7.8) | |
| rails (2.3.2) | |
| rake (0.8.7) |