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 hidden or 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 |
あるプログラミング言語で実際にWebAppを開発できるようになるまで、何が必要だろうか。言語仕様の習得は終えているとしよう。おそらく、最低限以下のような知識が必要だと思われる。とりあえずElixirについて知っていることを書いた。
標準添付です。
clojureのleiningenに強い影響を受けてる。らしい。
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 Exenv < Formula | |
homepage 'https://github.com/mururu/exenv' | |
url 'https://github.com/mururu/exenv/tarball/v0.1.0' | |
sha1 '8254e6351c9c5614aaa79923b152671d3585a188' | |
def install | |
prefix.install Dir['*'] |
This file contains hidden or 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
class Array | |
def add_up | |
Hash.new(0).tap{|h| self.each{|v| h[v]+=1 } } | |
end | |
end |