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
gosh> (define-syntax for | |
(syntax-rules (in do) | |
((for var in lis do expr ...) | |
(let loop ((xs lis)) | |
(if (not (null? xs)) | |
(begin (let ((var (car xs))) expr ...) | |
(loop (cdr xs)))))))) | |
#<undef> | |
gosh> (for x in '(1 2 3 4 5) do (print (* x x))) | |
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
bounce = (val) -> val = val() while typeof val == 'function'; val | |
factorial = (n) -> | |
fact = (a, n) -> if n > 0 then -> fact a * n, n - 1 else a | |
bounce fact 1, n | |
console.log factorial 10 |
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
def curryargs(arg=None, args=()): | |
def _ca(next=None): | |
return curryargs(next, args + (arg,)) | |
if arg: | |
return _ca | |
else: | |
return args | |
def printargs(args): | |
for arg in args: |
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
# -*- coding: utf-8 -*- | |
module Kernel | |
alias m_original_method_missing method_missing | |
def method_missing funcname, *args, &blk | |
if funcname.to_s =~ /^(.*?)nnn(.*?)$/ | |
m_funcname = "#{$1}nn#{$2}" | |
puts "もしかして: #{m_funcname}" | |
puts caller |
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 OAuth= require('oauth').OAuth; | |
var events = require('events'); | |
var http = require('http'); | |
var eyes = require('eyes'); | |
var _ = require('underscore'); | |
tweet = function() { | |
var oAuth= new OAuth("http://twitter.com/oauth/request_token", | |
"http://twitter.com/oauth/access_token", | |
"vknnKEthhunReqNATrhjvg", "", |
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
/** | |
* update.js | |
* New update() with validation of Mongoose | |
* | |
* written by yuribossa | |
* https://twitter.com/yuribossa | |
*/ | |
/** | |
* setNewUpdate |
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
# -*- coding: utf-8 -*- | |
class Module | |
private | |
def decorators | |
@decorators ||= [] | |
def decorator *args, &blk |
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
#!/usr/local/bin/gosh | |
(use srfi-1) | |
(use util.match) | |
(use gauche.parseopt) | |
;;; | |
;;; - christmas tree | |
;;; http://parametron.blogspot.com/2010/12/blog-post.html | |
;;; - ansi coloring |
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
{ - if分はスマートに書けねえ・・。 | |
そんなスマートじゃなくてすいません。 - } | |
num x = do | |
if x `mod` 3 == 0 | |
then "fizz" | |
else if x `mod` 5 == 0 | |
then "buzz" | |
else if x `mod` 15 == 0 | |
then "fizzbuzz" | |
else show x |
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
# -*- coding: utf-8 -*- | |
module Ecosys | |
extend self | |
class FoodWeb | |
def initialize | |
@creatures = [] |
OlderNewer