$ git clone https://gist.github.com/5480012.git chapter1
$ cd chapter1
# create new file
$ make new TARGET=q1
$ ls
0-My-SICP-Template-README.md Makefile README.md q1.scm template.scm utils.scm
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 'formula' | |
class ElixirBuild < Formula | |
homepage 'https://github.com/mururu/elixir-build' | |
url 'https://github.com/mururu/elixir-build/tarball/v20121112' | |
sha1 '6d3ae172359e26ee94370ce309edad79c996ea78' | |
head 'https://github.com/mururu/elixir-build.git' | |
option "without-exenv", "Don't install as an exenv plugin" |
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
#!/bin/sh | |
curl -s https://status.github.com/api/messages.json | \ | |
ruby -rjson -rtime -e \ | |
'JSON.parse(STDIN.gets).each{|s|c = {"good"=>"\e[32m", "minor"=>"\e[33m"}[s["status"]] || "\e[31m"; puts %{#{Time.parse(s["created_on"]).localtime}: #{c}#{s["body"].gsub("\n", " ")}\e[0m}}' |
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 false #f) | |
(define true #t) | |
(define (p a) | |
(print a)) | |
(define (pb a) | |
(print a) | |
(print "")) |
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 false #f) | |
(define true #t) | |
(define (p a) | |
(print a)) | |
(define (pb a) | |
(print a) | |
(print "")) |
あるプログラミング言語で実際にWebAppを開発できるようになるまで、何が必要だろうか。言語仕様の習得は終えているとしよう。おそらく、最低限以下のような知識が必要だと思われる。とりあえずElixirについて知っていることを書いた。
標準添付です。
clojureのleiningenに強い影響を受けてる。らしい。
iex(1)> import SigilMruby
nil
iex(2)> %m( [1,2,3].map do |i|
...(2)> i + 1
...(2)> end) |> Enum.each(&IO.inspect/1)
2
3
4
:ok
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
(load "./stream.scm") | |
(define (average x y) (/ (+ x y) 2)) | |
(define (sqrt-improve guess x) | |
(average guess (/ x guess))) | |
(define (sqrt-stream x) | |
(define guesses |
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
defmodule StringIO do | |
def new(string) when is_binary(string) do | |
spawn_link(fn -> string_io_process(string) end) | |
end | |
def string_io_process(string) do | |
loop(:infinity, String.to_char_list!(string)) | |
end | |
def loop(wait, buf) do |