(注:2016/1/21、頂いたフィードバックをもとに記事を修正いたしました。) 『 Programming in Scala (Scalaでプログラミング) 』の初版を読み始めた(でも読み終えていない)5年前からJavaの代わりにScalaを使うようになりました。最初はテストの時に使用していましたが、すぐにちょっとしたユーティリティクラスでも使用するようになり、気付いたらプロジェクト全てで使用するようになっていました。 Scalaに対する不満は多く存在しますが、この記事は違います。これは非難するものではなく、むしろ称賛するものです。 Scalaに興味ある開発者や聞いたことがあっても詳しく見たことがない人、「スムーズなプログラミングの妨げになる」と思い使用を先送りしていた人のために書きました。もちろんScalaファンに読んでもらうのも、他の人にも紹介してもらうのも大歓迎です。 この記事は3
なぜScalaがバカ向けなのか。 ぼくの経験を元に、バカ向け言語と非バカ向け言語を比較しながら見て行きましょう 非バカ向け言語 C プログラマーとして最初に携わったのがC言語です。 それは以下のようなものでした。 何十ものファイルにまたがるグローバル変数 緻密な制御が必要であるにも関わらず、無秩序に取得/開放が行われているメモリー管理 このような複雑な構造を、ぼくのようなポケコン並の処理能力しか持たないバカに把握可能でしょうか。もちろん不可能です そこで、次のようなコーディングを心がけました。 グローバル変数を使わず、関数に引数を定義して渡す メモリーの取得/解放を同一ファイル内に限定する これで、メモリーや変数参照の影響範囲を限定し、ぼくのようなバカでも理解できるようになります。 ですが、わざわざそんな事をやらなくても全てを理解できるエリート様達は、 「なぜ引数で渡すんだ。グローバル変数
Photo by Luca Sartoni こんにちは。谷口がお送りします。 プログラミングをこれから学ぼうとしている方や、これから研修や実務に入る新人ITエンジニアの皆さんの中には「Scalaを学習したい」という方も多くいらっしゃるかと思います。 Scalaはオブジェクト指向言語と関数型言語の特徴を統合したマルチパラダイムのプログラミング言語です。 ScalaはJavaの良さを継承し、かつスクリプト言語や関数型言語のメリットを吸収した言語で、Javaの後継を担うものとして注目されています。 Scalaの利点は、Javaの良さを継承しつつ、スクリプト言語や関数型言語の良いところも吸収し、先進的な機能や文法を取り入れている点にあります。また、簡易に並列処理プログラミングを行うことができるライブラリも付属しています。 Scalaは、海外ではTwitterやLinkedInなどが利用していること
わざと両方のタイトルをblogのタイトルに入れてみました(ながい・・・) レビューに少しだけ関わりました。自分が翻訳したわけではありません。あくまでもレビューです 原著 Functional Programming in Scala Scala関数型デザイン&プログラミング ―Scalazコントリビューターによる関数型徹底ガイド (impress top gear) 作者: Paul Chiusano,Rúnar Bjarnason,株式会社クイープ出版社/メーカー: インプレス発売日: 2015/03/20メディア: 単行本(ソフトカバー)この商品を含むブログ (7件) を見る http://book.impress.co.jp/books/1114101091 作者達はおそらく訳されて今の時期にでることをあまり知らない?だろうから、知らせるのと感謝の意を伝えるtweet↓(そしてサンプ
前回の記事では、Scala では implicit parameter を利用することで型クラスと同等のことが実現できることがわかりました。しかし前回の疑問として、「で、それの何がうれしいのよ」というのは残っていましたね。 今回はそのうれしみをなるべくわかりやすく説明したいと思います。 たとえば、色んなクラスに flipFlap メソッドを生やしたい まず、前回と同じく「値をひっくり返す」という flipFlap について考えてみましょう。 前回は関数を作りましたが、Scalaらしく、こういう動きにしたいですね 1.flipFlap // => -1 true.flipFlap // => false "string".flipFlap // => gnirts Scala ではクラスを拡張するときには implicit conversion を使うのが一般的ですね。 class IntF
2016/2/14 開催の第一回 hs.hs 勉強会で用いたスライドです。 流れは以下の通りです。 1. はじめに 自己紹介や本発表の目的について 2. GHC 7.8 からの変更点 GHC 7.8 の前後で起きたライブラリの変化と、その変化への対処法について 3. Haskell が遅いと言われるワケとか 遅延評価や各種データ構造の内部表現に起因する諸問題と、その対処法について 4. 知らないと損する言語拡張たち 型の表現力を高めたり、計算速度を向上させる種々の言語拡張について 5. FFI の話 Haskell での FFI の扱いと、身近なライブラリから見る実装例について(※一部抜粋) 6. おまけ(その他便利グッズの話) あるとコーディングがある程度便利になる言語拡張について 一部訂正あり: http://qiita.com/func-hs/items/51b314a2323b83
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く