Skip to content

Instantly share code, notes, and snippets.

Yuya Kono takoeight0821

Block or report user

Report or block takoeight0821

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@takoeight0821
takoeight0821 / Dog.hs
Last active Aug 29, 2015
ちょっとオブジェクト指向っぽいDSL
View Dog.hs
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:
@takoeight0821
takoeight0821 / hello_cpp.go
Last active Aug 29, 2015
Cのプリプロセッサ on Go言語
View hello_cpp.go
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));\
View proc.hs
#define proc do
#define void(m)\
m :: IO ();\
m =
void(main) proc
a <- getLine
b <- getLine
putStrLn $ a ++ b
@takoeight0821
takoeight0821 / Main.java
Created Mar 17, 2015
Java で 数当てゲーム
View Main.java
import java.io.*;
public class Main {
static int small = 1;
static int big = 100;
private static int guessMyNumber() {
return (small + big) / 2;
}
View janken.lisp
;;; * (read-hand)
;;; > rock
;;; ROCK
;;; > very-dangerous-words
;;; hands: rock, paper, scissor
;;; >
(defun read-hand ()
(princ "> ")
(finish-output) ;SBCLの最適化によるIO順序の入れ替わりを防ぐ
(let ((p-hand (read)))
View haskell.lisp
(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)
@takoeight0821
takoeight0821 / guess_my_number.cpp
Created May 17, 2015
数当てさせゲーム
View guess_my_number.cpp
#include <iostream>
int small = 1;
int big = 100;
int guessMyNumber()
{
return (small + big) / 2;
}
View Group.hs
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)
@takoeight0821
takoeight0821 / log.txt
Created Jun 14, 2015
build roswell log
View log.txt
➜ 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
@takoeight0821
takoeight0821 / posix-tests.lisp.patch
Last active Aug 29, 2015
fix sb-posix/posix-tests.lisp failed on Japanese Mac OS X
View posix-tests.lisp.patch
diff --git a/contrib/sb-posix/posix-tests.lisp b/contrib/sb-posix/posix-tests.lisp
index ec5a49c..444b3b0 100644
--- a/contrib/sb-posix/posix-tests.lisp
+++ b/contrib/sb-posix/posix-tests.lisp
@@ -3,6 +3,9 @@
(in-package "SB-POSIX-TESTS")
+#+darwin(setf sb-alien::*default-c-string-external-format* :utf-8)
+#+darwin(setf sb-impl::*default-external-format* :utf-8)
You can’t perform that action at this time.