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
newDog name message | |
| message == "bark" = "Bowwow!" | |
| message == "hey " ++ name = name ++ " came at you." | |
| otherwise = "?" | |
dog = newDog "Pochi" | |
main = mapM_ print [dog "bark", dog "hey Pochi", dog "hey John", dog "run"] | |
{- | |
output: |
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 <stdio.h> | |
#define map(TYPE, SOURCE, RESULT, FUNC)\ | |
TYPE RESULT[sizeof(SOURCE) / sizeof(SOURCE[0])] = {0};\ | |
for (int i = 0; i < (sizeof(SOURCE) / sizeof(SOURCE[0])); i++) {\ | |
RESULT[i] = FUNC(SOURCE[i]);\ | |
} | |
int square(int n) { | |
return n * n; |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
) | |
#define map(TYPE_S, TYPE_F, SOURCE, FUNC)\ | |
func (f func(TYPE_S) TYPE_F) []TYPE_F {\ | |
r := make ([]TYPE_F, len(SOURCE));\ |
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
#define proc do | |
#define void(m)\ | |
m :: IO ();\ | |
m = | |
void(main) proc | |
a <- getLine | |
b <- getLine | |
putStrLn $ a ++ b |
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 java.io.*; | |
public class Main { | |
static int small = 1; | |
static int big = 100; | |
private static int guessMyNumber() { | |
return (small + big) / 2; | |
} |
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
;;; * (read-hand) | |
;;; > rock | |
;;; ROCK | |
;;; > very-dangerous-words | |
;;; hands: rock, paper, scissor | |
;;; > | |
(defun read-hand () | |
(princ "> ") | |
(finish-output) ;SBCLの最適化によるIO順序の入れ替わりを防ぐ | |
(let ((p-hand (read))) |
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
(defclass (Eq a) | |
(as = (Func a a Bool)) | |
(as /= (Func a a Bool)) | |
(defmethod (= x y) (not (/= x y)) | |
(defmethod (/= x y) (not (= x y))))) | |
(defdata TrafficLight ((Red) (Yellow) (Green))) | |
(definstance (Eq TrafficLight) | |
(defmethod (= Red Red) True) |
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> | |
int small = 1; | |
int big = 100; | |
int guessMyNumber() | |
{ | |
return (small + big) / 2; | |
} |
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.Monoid | |
class Group g where | |
gidentity :: g | |
gop :: g -> g -> g | |
ginverse :: g -> g | |
instance Num a => Group (Sum a) where | |
gidentity = Sum 0 | |
(Sum x) `gop` (Sum y) = Sum (x + y) |
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
➜ roswell git:(master) sh bootstrap | |
configure.ac:14: installing './compile' | |
configure.ac:10: installing './install-sh' | |
configure.ac:10: installing './missing' | |
src/Makefile.am:30: warning: CLEANFILES multiply defined in condition TRUE ... | |
src/Makefile.am:24: ... 'CLEANFILES' previously defined here | |
src/Makefile.am: installing './depcomp' | |
➜ roswell git:(master) ✗ ./configure | |
checking for a BSD-compatible install... /usr/bin/install -c |
OlderNewer