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
module Main where | |
import Data.Array | |
-- mod m としたフィボナッチ数列 (繰り返しとなる時点で打ち切り) | |
fibMod :: Int -> [Int] | |
fibMod m = 0 : fibMod' 1 1 | |
where | |
fibMod' 0 1 = [] | |
fibMod' x y = x : fibMod' y (mod (x + y) m) |
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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TupleSections #-} | |
module Main where | |
import Control.Applicative | |
import Control.Arrow | |
import Control.Monad (void) | |
import Data.Attoparsec.ByteString.Char8 | |
import qualified Data.ByteString.Char8 as B |
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
// scala99 http://aperiodic.net/phil/scala/s-99/ | |
object Scala99 { | |
import Function.{const, uncurried} | |
//P01 (*) Find the last element of a list. | |
// Example: | |
// | |
// scala> last(List(1, 1, 2, 3, 5, 8)) | |
// res0: Int = 8 |
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
{-# LANGUAGE ViewPatterns, TransformListComp #-} | |
-- 元ネタはいつもどおり route150 の日記 | |
-- <http://d.hatena.ne.jp/route150/20120622/1340338820> | |
import GHC.Exts | |
import Control.Arrow | |
import Data.List | |
import Test.QuickCheck | |
-- GHC拡張(TransformListComp)使うと楽だったりする... |
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
// solution to http://qiita.com/items/cbc3af152ee3f50a822f | |
// using parser combinators | |
import scala.util.parsing.combinator.RegexParsers | |
case class Card(suit: String, rank: String) | |
trait CardsParser extends RegexParsers { | |
def cards = repN(5, card) | |
def card: Parser[Card] = (suit ~ rank) ^^ {case s~r => Card(s, r)} |
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
// mutable な trie と immutable な trie | |
// 久しぶりに scala 書いてみたらダーティ過ぎてワロタ。。。 | |
// 仕様は http://d.hatena.ne.jp/route150/20120624/1340542890 | |
// 破壊的操作はいいぞ(以下略 | |
package trie { | |
// trie base | |
abstract class Trie[A] { | |
type ChildrenT <: collection.Map[A, Trie[A]] | |
val children: ChildrenT |
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
function [ output_args ] = make_bsort( input_args ) | |
%BSORT2 この関数の概要をここに記述 | |
% 詳細説明をここに記述 | |
global stack | |
% 整列対象の要素数 | |
n_sort = 6; | |
stack = []; | |
bitonic_sort(1, n_sort, true); |
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
// Spring Roo 1.2.1.RELEASE [rev 6eae723] log opened at 2012-02-28 19:26:39 | |
project --topLevelPackage com.github.akihiro4chawon.singleroo --projectName spring-roo-exam-single --java 6 | |
hint | |
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY | |
entity jpa --class ~.domain.Person --sequenceName PERSON_SEQ | |
field string --notNull --fieldName firstName --sizeMin 3 --sizeMax 30 | |
field string --notNull --fieldName lastName --sizeMin 3 --sizeMax 30 | |
test integration --entity ~.domain.Person | |
web mvc setup | |
web mvc all --package ~.web |
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
module Main where | |
import Control.Monad | |
import Control.Monad.Trans | |
import Control.Monad.Trans.List | |
import System.Directory | |
getAllFilesIn :: FilePath -> IO [FilePath] | |
getAllFilesIn path = runListT $ getAllFilesIn' path | |
where |
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
package zkthisisanexam.fileexplorer; | |
import java.io.File; | |
import java.io.FileFilter; | |
import java.text.SimpleDateFormat; | |
import org.zkoss.zk.ui.Component; | |
import org.zkoss.zk.ui.event.Event; | |
import org.zkoss.zk.ui.event.EventListener; | |
import org.zkoss.zk.ui.event.Events; |
NewerOlder