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
# go勉強会、ソースコードリーディングの会vol.1 | |
福岡でGoやってる! なにそれ?面白そう? とか、Goroutine気になるだとか! | |
CやC++でシステムプヨグヤミングやりたくないぽよ! とか思う人のためのGo勉強会でつ! | |
==================================== | |
システムプログラミングで良く使われ、並列処理でGoroutineだとか面白い機能があり、 | |
DockerやCockrouchDBで使われ出したりとか、現在注目をされているGo言語の勉強会です。 | |
## 今回メンバー構成 |
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
(defmacro ++ (&rest rest) | |
`(concatenate 'string ,@rest)) | |
(let ((name "John")) | |
(princ (++ "Hello, " name "\n"))) |
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
# 問題: 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2, 1, 3, ... | |
# という数列のn番目の数字を求める関数を書け | |
f = (n) -> n + 5 | |
solve = (index)-> | |
ret = "" | |
cnt = 0 | |
while true | |
ret += f(cnt++) |
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 (expr num1) | |
(lambda (op) | |
(cond [(member op '("+" "*" "-" "/")) | |
(lambda (num2) (expr ((eval (string->symbol op)) num1 num2)))] | |
[else num1]))) | |
((((((((expr 4) "+") 3) "*") 2) "-") 1) "=") |
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 (expr x) | |
(define (calc op oprnd ans) | |
(if (null? op) | |
ans | |
(calc (cdr op) (cdr oprnd) ((car op) ans (car oprnd))))) | |
(define (expr-sub x op-stack oprnd-stack) | |
(cond [(number? x) | |
(lambda (y) (expr-sub y op-stack (cons x oprnd-stack)))] | |
[(member x '("+" "*" "-" "/")) | |
(lambda (y) (expr-sub y (cons (eval (string->symbol x)) op-stack) oprnd-stack))] |
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 "./rpn" | |
describe "rpn" do | |
it "" do | |
expect(expr(4).("+").(3).("*").(2).("-").(1).("=")). | |
to eq(->(){ | |
comp1 = 3 * 2; | |
comp2 = 3 + comp1; | |
comp3 = comp2 - 1; | |
return comp3 }.call) |
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
(function (global) | |
{ | |
var expr = function (n) | |
{ | |
var utilities = { | |
"+": function (a, b) { return a + b; }, | |
"-": function (a, b) { return a - b; }, | |
"*": function (a, b) { return a * b; }, | |
"/": function (a, b) { return a / b; } |
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
(function (global) | |
{ | |
var expr = function (n) | |
{ | |
var utilities = { | |
"+": function (a) { return function(b){ return a + b; } }, | |
"-": function (a) { return function(b){ return a - b; } }, | |
"*": function (a) { return function(b){ return a * b; } }, | |
"/": function (a) { return function(b){ return a / b; } } |
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
(function () | |
{ | |
function partial(fun) | |
{ | |
var _slice = [].slice, | |
args = _slice.call(arguments); | |
args.shift(); | |
return function () | |
{ | |
return fun.apply(this, args.concat(_slice.call(arguments))); |
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
var Switch = function(expr){ | |
return new YetSucceed(expr); | |
} | |
var Succeed = { case : function(cond,proc){ return this; } }; | |
var YetSucceed = function(expr){ this.expr = expr; }; | |
YetSucceed.prototype.case = function(cond, proc){ | |
if(cond() === this.expr){ | |
proc(); |