-
2015/03/28 浜松Ruby会議01
-
Hamamatsu.rb 石垣 良
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
import Data.Vect | |
%default total | |
Num Type where | |
(+) = Either | |
(*) = Pair | |
fromInteger 0 = Void | |
fromInteger 1 = Unit | |
fromInteger 2 = Bool |
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
レンズは余状態余モナドの余代数だった | |
=================================== | |
余余余〜!別名`関数的参照`とも呼ばれる[レンズ](https://hackage.haskell.org/package/lens)はJavaのGetter, Setterと同等と[言われる](https://twitter.com/plt_borat/status/228009057670291456)関数型プログラミングのデザインパターンの一つです。 | |
レンズは余状態余モナドの余代数だと[聞いて](https://twitter.com/hiratara/status/317602743219003392)そうなのかーと思ってたのですが、ふと自分で実装してみたくなったので **余状態余モナドの余代数** として実装してみることにしました。 | |
ちなみにこの文章は`literate Haskell`という形式で書かれているのでダウンロードしてghciでロードすればすぐにでも自分で試すことができます。 | |
まず最初におまじない | |
> {-# LANGUAGE RankNTypes #-} |
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
nim js -o:hellonim.js hellonim.nim |
WebRTC スタックについて
- 作
@voluntas
- バージョン
0.0.3
- url
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
/* Copyright 2015 daiz, app Ui design project. */ | |
function getFlexibleWidth(column, margins, stage_width, min_width, max_width) { | |
/** | |
column: 標準カラム指定 | |
margins: margin-left, margin-right を要素に持つ配列 | |
stage_width: 表示領域の横幅 | |
min_width: multi column の場合のcolumn横幅の最小値 | |
この値より小さい横幅になる場合はカラムを減らす | |
max_width: multi column の場合のcolumn横幅の最大値 | |
この値より大きい横幅になる場合はカラムを増やす |
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
# -*- encoding: utf-8 -*- | |
# ソート詰め合わせパック | |
# * バブルソート(単純交換ソート) | |
# * 単純選択ソート | |
# * シャトルソート(単純挿入ソート) | |
# * シェルソート | |
# * クイックソート | |
# * ヒープソート | |
# Copyright 2015 daiz. All Rights Reserved. |
本稿ではNim言語 (旧称: Nimrod) の構文を紹介します。
Nim言語の概要やインストール方法については、ブログ記事があるのでそちらをご参照下さい。
これは stfuawsc_itg Advent Calendar 2014 4日目の記事です。
プログラミングをしていると、いろいろなバージョンの環境を行ったり来たりしたくなることがあります。たとえば言語処理は python 2 へ nltk を入れてやりたい。シミュレーションは python 3 へ numpy 入れてやりたいとか。
そういうふうに言語やモジュールのバージョンをいろいろ組合せた環境を気軽に切り替えられると便利です。
実際そういうことを可能にするツールはたくさんあります。virtualenv, pyenv など。
ここで紹介する conda というツールもその1つです。
virtualenv などでは、モジュールを入れるときは通常の python の流儀でインストールするのですが、インストールがうまくいかないというのはよくあることです。conda ではあらかじめビルドされたものを入れるので、楽です。もちろん conda に用意されていないモジュールもありますが、そういうのは pip 等通常の方法で入れて共存できます。
ではさっそく conda で python の環境を作る方法です。
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
import Control.Monad | |
import Data.IORef | |
main = do | |
a <- newIORef 0 | |
let f = do | |
a' <- readIORef a | |
let a'' = a' + 1 | |
print a'' | |
writeIORef a a'' |