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
#================================================================================= | |
#【アプリ名】 ニコ生アラート(本家)のAPIを用いたTwitterBot | |
#【著作権者】 raa0121 | |
#【対応環境】 | |
# Linux Mac | |
# gem install twitter_oauth | |
# gem install mechanize | |
# 後は ruby nicolivealert.rb で起動が可能です。 | |
#【開発環境】 Cygwin (WindowsVista SP2 32bit) | |
#【開発言語】 Ruby(1.9.2-p180)(DL元:http://www.artonx.org/data/asr/ ) |
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
(define (then m k) | |
(bind m (lambda (_) k))) | |
(define (state-unit a) | |
(lambda (s) `(,a ,s))) | |
(define (state-bind m k) | |
(lambda (s) | |
(let* { [r (m s)] | |
[a (car r)] |
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
(ns macro-combinator | |
(:refer-clojure :exclude [=])) | |
(defn prim [x] (fn [a] `(fn [~x] ~a))) | |
(defn in [v a] (v a)) | |
(defn where [a v] (v a)) | |
(defn = [v b] (fn [a] `(~(v a) ~b))) | |
(defn <- [v b] (fn [a] `(>>= ~b ~(v a)))) | |
(println (in (= (prim 'x) 42) 'x)) | |
; ((clojure.core/fn [x] x) 42) |
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
setSlot("", method(x, "(" with(x) with(")"))) | |
o := method(if(call argAt(0)) then(return("(o" with(call argAt(0) code))) else(return(self with("o)")))) | |
(((o(*゚▽゚*)o))) println |
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
# -*- sh -*- | |
# objective.zsh | |
# $ pwd | |
# /Users/pasberth | |
# $ pwd.dirname | |
# /Users | |
# $ pwd.basename | |
# pasberth | |
# $ pwd.ls -Ahl --color=auto | |
# lrwxr-xr-x 1 pasberth staff 38 8 22 2012 .zlogin -> /Users/pasberth/.dotfiles/home/.zlogin |
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
(defn infixing-infix [rules infix-rule [a b & code]] (cond | |
(nil? b) `(~a) | |
(nil? (rules b)) (cond | |
(seq? a) (infixing-infix rules infix-rule `((~@a ~b) ~@code)) | |
:else (infixing-infix rules infix-rule `((~a ~b) ~@code))) | |
:else (let [ b-rule (rules b) ] (cond | |
(< (b-rule :priority) (infix-rule :priority)) `(~a (~b ~@code)) | |
(> (b-rule :priority) (infix-rule :priority)) (infixing-infix rules infix-rule `((~b ~a) ~@code)) | |
(= :left (b-rule :recur) (infix-rule :recur)) `(~a (~b ~@code)) |
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
(declare odd?) | |
(defn even? [x] | |
(if (== 0 x) | |
true | |
#(odd? (- x 1)))) | |
(defn odd? [x] | |
(if (== 1 x) | |
true |
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
(defprotocol Monad | |
(monad-context [this m])) | |
(defrecord MonadUnit [a]) | |
(defrecord MonadBind [m k]) | |
(extend-protocol Monad | |
MonadUnit | |
(monad-context [this m] m) | |
MonadBind |
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
(use 'granjure.control.monad.zip) | |
(use 'granjure.data.list) | |
(use 'granjure.data.maybe) | |
(import '[granjure.data.maybe Just Nothing]) | |
(println (do-mzip (x | x <- '(1 2 3)))) | |
; (1 2 3) | |
(println (do-mzip (x | x <- '(1 2 3) :when (even? x)))) | |
; (2) |
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
module Monad | |
def return!(a); end | |
def bind(m,k); end | |
def join(m,k); (bind m,->(_){k}); end | |
end | |
module MonadPlus; include Monad | |
def mzero; end | |
def guard(cond); cond ? (return! nil) : mzero; end |
OlderNewer