sjs --module ./mod.js --output fn.built.js fn.js
sjs --module ./mod.js --output fn2.built.js fn2.js
sjs --module ./mod.js --output fn3.built.js fn3.js
This file contains 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
hello |
This file contains 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 FlexibleInstances #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
format :: String -> String -> String | |
format [] _ = [] | |
format ('%':'%':s) x = '%' : '%' : format s x | |
format ('%':'s':s) x = escape x ++ s | |
format (x:xs) y = x : format xs y | |
escape :: String -> String |
$ ghc -O2 a.hs
$ time ./a
./a 1.39s user 1.70s system 69% cpu 4.479 total
$ ghc -O2 b.hs
$ time ./b
./b 1.52s user 1.73s system 73% cpu 4.448 total
$ ghc a.hs
$ time ./a
./a 1.51s user 1.67s system 77% cpu 4.082 total
$ ghc b.hs
$ time ./b
./b 1.58s user 1.68s system 78% cpu 4.126 total
This file contains 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
Theorem syllogism : forall (A B C : Prop), (B -> C) -> (A -> B) -> A -> C. | |
Proof. | |
intros A B C H H0 H1. | |
apply H. | |
apply H0. | |
apply H1. | |
Qed. |
This file contains 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 #-} | |
module Main where | |
import Data.ByteString | |
default (ByteString) | |
s = "hello world" | |
-- :: ByteString | |
-- デフォルトが ByteSTring になる |
This file contains 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
#include <string> | |
#include <vector> | |
#include <list> | |
#include <iostream> | |
template<class Iterator> | |
void print_all(Iterator first, Iterator last) | |
{ | |
while (first != last) | |
{ |
This file contains 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
#include <iostream> | |
typedef void (*f_t)(); | |
class Base { | |
public: | |
virtual void f(); | |
}; | |
struct Derivied : public Base { |
This file contains 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
import Data.IORef | |
doWhile :: Monad m => m Bool -> m a -> m a | |
doWhile test body = do | |
x <- body | |
testResult <- test | |
if testResult | |
then doWhile test body | |
else return x |