Skip to content

Instantly share code, notes, and snippets.

require 'set'
module Fiasco
class Table < BasicObject
def inspect
"<Table>"
end
def method_missing(method, *args)
attr = method.to_s
%self total self wait child calls name
38.46 1.06 1.00 0.00 0.06 80000 Module#define_method
12.69 1.76 0.33 0.00 1.43 40000 OpenStruct#new_ostruct_member
11.92 2.39 0.31 0.00 2.08 40000 OpenStruct#method_missing
6.54 1.26 0.17 0.00 1.09 40000 Module#class_eval
6.54 2.60 0.17 0.00 2.43 1 Integer#times
5.38 0.14 0.14 0.00 0.00 40000 Hash#[]=
3.46 0.09 0.09 0.00 0.00 40000 OpenStruct#modifiable
2.69 0.07 0.07 0.00 0.00 40000 String#to_sym
2.31 0.06 0.06 0.00 0.00 40000 Symbol#id2name
|---------|
| |
| |
--row---- |---------|
en vez de
--row---- |---------|
require 'formula'
class Gauche <Formula
url 'http://jaist.dl.sourceforge.net/project/gauche/Gauche/Gauche-0.9.tgz'
homepage 'http://practical-scheme.net/gauche/'
md5 ''
def install
system "./configure", "--enable-multibyte=utf-8", "--prefix=#{prefix}"
system "make"
;; def m(n, l)
;; t = 0
;; u = n
;; while u < l
;; t = t + u
;; u = u + n
;; end
;;
;; t
;; end
(* http://ocaml.janestreet.com/?q=node/75 *)
(* 1ra *)
type connection_state =
| Connecting
| Connected
| Disconnected
type connection_info = {
(define *redis* (make-parameter #f))
;; Returns a new connection to the server
(define redis-open open-net-io)
;; Calls the procedure passing a connection to the server.
;; The connection is closed after proc returns.
(define (with-redis-connection host port proc)
(with-net-io host port
(lambda (in out)
# when handling a request on rack, thread_locals[:request] is set
module FrameworkStuff
def request
thread_locals[:request]
end
end
(define-module (chibi redis)
(export redis-open with-redis-connection redis-command *redis*
redis-info redis-get redis-set)
(import-immutable (scheme) (chibi net) (chibi io) (srfi 39))
(include "redis.scm"))
require "./late"
require "erb"
require "bench"
def purecode(context = {})
myfield = context[:myfield]
out = "The sum is "
out.concat (2+2).to_s
out.concat " Also substitute "
out.concat (myfield).to_s