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
299999.prime_division.map{|a,b| a**b}.inject(:*) |
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
require './lisp_base.rb' | |
LISP do (cons 1,2) end | |
LISP do (cond true,(cond false,(cons 1,2),(cons 3,4)),(cons 5,6)) end | |
LISP do (defun :fact,:x,(cond (eq :x,0),1,(mult (sqrt (square :x)),(fact (minus :x,1))))) end | |
LISP do (defun :abs,:x,(cond (lt :x,0),(minus 0,:x),:x)) end | |
LISP do | |
(defun :sqrtrec,:x,:y,:d, | |
(cond (lt :d,0.0000000001), | |
:y, | |
(cond (lt (mult :y,:y),:x), |
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
#!/usr/bin/env ruby | |
# Okinawarb.new.H.e.l.l.o.comma.space.w.o.r.l.d!.flush("\n") | |
# => output 'Hello, wrold!' | |
class String | |
CharTable = {comma:',', space:' '} | |
def flush str | |
print self, str | |
end |
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
data HookMonad a = Hook (a -> a) a | |
instance Monad HookMonad where | |
return = Hook id | |
Hook h x >>= f = f . h $ x | |
nonMinusPoint = Hook (\x -> if x < 0 then 0 else x) | |
getValue (Hook f x) = f x |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "fedora-19" | |
config.vm.provision :puppet do |puppet| |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# script location : pypy top directory | |
import sys | |
from pypy.objspace.std import StdObjSpace | |
from pypy.interpreter.pyparser import pyparse, pytoken | |
from pypy.interpreter.pyparser.test import expressions | |
from pypy.interpreter.pyparser.error import SyntaxError, IndentationError | |
from pypy.interpreter.pycode import PyCode |
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
compctl -K _hoge hoge | |
_hoge() { | |
local words completions | |
read -cA words | |
completions="$(look ${words[-1]})" | |
reply=("${(ps:\n:)completions}") | |
} |
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
; east asian ambiguous settings | |
(defun set-east-asian-ambiguous-width (width) | |
(cond ((= emacs-major-version 22) (set-east-asian-ambiguous-width-22 width)) | |
((> emacs-major-version 22) (set-east-asian-ambiguous-width-23 width)))) | |
; for emacs 22 | |
(defun set-east-asian-ambiguous-width-22 (width) | |
(if (= width 2) | |
(utf-translate-cjk-set-unicode-range |
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
; east asian ambiguous character table | |
(defun east-asian-ambiguous-characters () | |
'( | |
(#x00A1 . #x00A1) (#x00A4 . #x00A4) (#x00A7 . #x00A8) | |
(#x00AA . #x00AA) (#x00AD . #x00AE) (#x00B0 . #x00B4) | |
(#x00B6 . #x00BA) (#x00BC . #x00BF) (#x00C6 . #x00C6) | |
(#x00D0 . #x00D0) (#x00D7 . #x00D8) (#x00DE . #x00E1) | |
(#x00E6 . #x00E6) (#x00E8 . #x00EA) (#x00EC . #x00ED) | |
(#x00F0 . #x00F0) (#x00F2 . #x00F3) (#x00F7 . #x00FA) | |
(#x00FC . #x00FC) (#x00FE . #x00FE) (#x0101 . #x0101) |
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
data B = T | F | |
deriving (Eq, Show) | |
(&&&) :: B -> B -> B | |
b &&& T = b | |
_ &&& F = F | |
(|||) :: B -> B -> B | |
_ ||| T = T | |
b ||| F = b |