Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# coding: utf-8
target = ARGV[0]
module ProjectFile
module ModuleMethods
def root
@root ||= File.dirname(__FILE__)
end
class TypeClass<T> {
private static class Id<T> {
public static T __id__
}
public static trait Mixin<T> {
public T id() { return this.__id__ }
public void id(T a) { this.__id__ = a }
public String toString() { return "${this.class.getName()}<${T.getName()}>(${id()})" }
module SandboxHelper
require 'set'
class Sandbox
def initialize(application)
@base = application
@virt = application.clone
end
//
// 新規タブでクロネコヤマトの荷物問い合わせする関数
//
//
// function kuroneko(id) {
//
// var target = 'kuroneko'
//
// window.open('',target);
def add = { a -> { b -> { c ->
return a + b + c;
}}};
println add(1)(2)(3);
function curry(f) {
if (f.length <= 1) {
return f;
} else {
return function(x) {return curry(f.bind(null,x));};
}
}
@emanon-was
emanon-was / clojure.scm
Last active April 17, 2016 13:44
Clojureっぽくスクリプトを書きたい
(define-module (clojure core)
#:use-module (ice-9 format)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-45)
#:use-module (oop goops)
#:replace (map filter)
#:export (-> ->> doto loop str println time slot lazy-seq seq first rest nth take drop dorun doall doseq range line-seq fib-seq))
(define-syntax ->
(syntax-rules ()
(define-syntax ->
(syntax-rules ()
((_ x) x)
((_ x (form more ...)) (form x more ...))
((_ x form) (form x))
((_ x form more ...) (-> (-> x form) more ...))))
(define-syntax ->>
(syntax-rules ()
;;-----------------------------
;; Load *.config.el
;;-----------------------------
(defvar loaded-config '())
(defun config-el-p (conf)
(string-match "\\.config\\.el$" conf))
(defun loaded-config-p (conf)
(defmacro -> (x &rest forms)
(if (null forms) x
(let ((head (car forms)))
(cond ((listp head)
`(-> (,(car head) ,x ,@(cdr head)) ,@(cdr forms)))
((symbolp head)
`(-> (,head ,x) ,@(cdr forms)))
(t
`(-> ,head ,@(cdr forms)))))))