-
山下実則
- やました みのり
-
Twitter or Facebookのアカウント or HN等
-
@ympbyc
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
;; Initialize Biwascheme interpreter on frontend(browser) then send and receive expressions with websocket client | |
;; INSTALL websocket.el, LOAD this file and RUN interactive function `load-ws` from Emacs | |
;; ws-close to close server | |
;; send expression (e.g functions) to browser with `C-c C-s` ... Tip# cursor should be on function name | |
(require 'websocket) | |
(require 'scheme) | |
(defun biwa-start () | |
(interactive) | |
;(load-file "~/.emacs.d/websocket.el") |
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 (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 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
// IO a -> a | |
function unsafePerformIO (io) { | |
var tuple = io({"memo" : "This is the real world!!"}); | |
var newWorld = tuple[0]; | |
var value = tuple[1]; | |
return value; | |
} | |
// IO a -> (a -> IO b) -> IO b | |
function bind (io1, f) { |
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
require('allthemagicalstuff'); | |
//event object constructor; | |
function event (target, eventName) { | |
return { | |
target: target | |
, eventName: eventName | |
}; | |
}; |
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
module LISP where | |
import Text.ParserCombinators.Parsec | |
import Control.Monad.State | |
data Value = Sym Identifier | |
| Int Int | |
| Str String | |
| List [Value] | |
| Closure [Identifier] Expr Env |
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
require 'regparsec' | |
module HTMLParsers | |
extend RegParsec::Regparsers | |
ValidTags = ->(state) { one_of(*state.valid_tags) } | |
OpenTag = between('<', '>', ValidTags) | |
CloseTag = between('</', '>', ValidTags) | |
Line = try /[^\<\n]+/, &:to_s |