Skip to content

Instantly share code, notes, and snippets.

@oskimura
oskimura / categorize.hs
Created April 27, 2011 04:22
適当につくったスクリプト
import Control.Applicative
import Control.Monad
import Text.Printf
splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy p [] = []
splitBy p xs = a : (splitBy p $ dropWhile p $ b)
where
(a, b) = break p xs
{-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-}
{-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-}
{-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Applicative
import Data.List
import Text.Printf
splitBy :: (a -> Bool) -> [a] -> [[a]]
{-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-}
{-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-}
{-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Applicative
import Data.List
import Text.Printf
splitBy :: (a -> Bool) -> [a] -> [[a]]
{-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-}
{-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-}
{-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Applicative
import Data.List
import Text.Printf
splitBy :: (a -> Bool) -> [a] -> [[a]]
{-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-}
module Main where
import Data.List
import Control.Monad
import Data.Array
import Control.Applicative
import Text.Printf
import Data.Bits
divid :: [Int] -> [([Int], [Int])]
@oskimura
oskimura / gist:980353
Created May 19, 2011 07:30
jquery-frontier-calのテストコード
<!DOCTYPE html>
<html><head><title></title>
<link rel="stylesheet" type="text/css" href="css/frontierCalendar/jquery-frontier-cal-1.3.2.css" />
<!-- Include CSS for color picker plugin (Not required for calendar plugin. Used for example.) -->
<link rel="stylesheet" type="text/css" href="css/colorpicker/colorpicker.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui/smoothness/jquery-ui-1.8.1.custom.css" />
<script type="text/javascript" src="js/jquery-core/jquery-1.4.2-ie-fix.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/smoothness/jquery-ui-1.8.1.custom.min.js"></script>
<!-- Include color picker plugin (Not required for calendar plugin. Used for example.) -->
<script type="text/javascript" src="js/colorpicker/colorpicker.js"></script>
//import scala.collection.mutable.HashMap
//import scala.collection.mutable.Map
import scala.collection.mutable.Stack
import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical._
import scala.util.parsing.combinator.lexical._
//-------------------------------------------------------------------
//import scala.collection.mutable.HashMap
//import scala.collection.mutable.Map
import scala.collection.mutable.Stack
import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical._
import scala.util.parsing.combinator.lexical._
//-------------------------------------------------------------------
import scala.collection.mutable.Stack
import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical._
import scala.util.parsing.combinator.lexical._
//----------------------------------------------------------------------------------------------
abstract class Instraction
case class POP[A] extends Instraction
case class PUSH extends Instraction
-module (fact).
-export ([fact/1]).
print(X) ->
io:format("~p\n",[X]).
fact(0,Pid) ->
Pid ! 1;
fact(N,Pid) ->
Id = spawn(fun () ->