You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
A companion booklet to ”Functional Programming in Scala” Chapter notes, errata, hints, and answers to exercises Rúnar Óli Bjarnason This book is for sale at http://leanpub.com/fpinscalacompanion This version was published on 2015-03-05 This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook usin
前置き: 特定の言語ではなく、関数型言語一般に関する説明です。 ここに書くのが良いのかわかりませんが、それを考える時間ももったいないのでとりあえず書きます。必要が生じたら移転します。 皆様のご要望や自分の気分(?)により随時加筆修正します。 「それは違うんじゃない?」というご指摘はもちろん、初心者の方の素朴な疑問・質問や、「ここがよくわからない」「こういうことも書いてほしい」みたいなコメントも歓迎します。すぐに対応できない場合もあると思いますがすみません。Twitterのesumii宛でも構いませんが、コメントのほうが他の方も見つけやすくて良いと思います。当然ながら(他者に対しても)誹謗中傷等はご遠慮ください。 いただいたコメントはほぼ本文に反映していますので、本文を読むために、必ずしもコメントを読む必要はありません。もちろん、興味と余裕(?)があればコメントも読んでいただければ非常に有用
Some explanations are in order! What is the id function for? What is the role of? Why should we need it here? id is the identity function, id x = x, and is used as the equivalent of zero when building up a chain of functions with function composition, (.). You can find it defined in the Prelude. In the above example, id function is the accumulator in the lambda function? The accumulator is a funct
J. Functional Programming 9 (4): 355–372, July 1999. Printed in the United Kingdom c ! 1999 Cambridge University Press 355 A tutorial on the universality and expressiveness of fold GRAHAM HUTTON University of Nottingham, Nottingham, UK http://www.cs.nott.ac.uk/-gmh Abstract In functional programming, fold is a standard operator that encapsulates a simple pattern of recursion for processing lists.
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
たまには Lua も書かないと忘れてしまいそうなので,久しぶりに Lua を書いてみた. お題は,最近の日記でも扱った,不動点コンビネータ. 散々既出だろうし,新規性は全くないけど,まぁ個人の blog だし その辺りは勘弁してください,ってことで. さて,知らない人のために説明すると,不動点コンビネータとは, function fix(f) -- 実装 end local fact = fix( function( fact, x ) return x > 1 and x * fact(x-1) or 1 end ) って感じで,ラムダ式で再帰を書けるようにする,ちょっと不思議な関数 fix のこと. 勿論,これは local function を使って local function fact(x) return x > 1 and x * fact(x-1) or 1 end と書けば
関数型言語での関数について、Haskell を用いて説明します。 関数の型 関数の型は、-> を使って書きます。例えば、Int を Char に変換する chr という関数の型は、以下のようになります。 chr :: Int -> Char 一引数の関数の型は、まぁこんなもんだと思えるでしょう。びっくりするのは、引数が増えたときです。たとえば、replicate という関数の型を見てみましょう。 replicate :: Int -> a -> [a] replicate は、第二引数で指定されたデータを第ー引数に指定された個数分用意して、リストにして返す関数です。([] は配列ではなく、リストです。) 次のように動きます。 > replicate 3 "foo" → ["foo","foo","foo"] a は型変数といって、任意の型を取れます。なじめない人は、具体的な型を当てはめてみ
C.U.F.P. (Companhia União Fabril Portuense) 関数型言語の国際会議 ICFP の今年の開催地は東京です。ICFP のアジアでの開催は初めてですね。F# も正式にリリースされましたし Haskell も Haskell Platform が立て続けに出てます。Coq や Agda などの依存型の言語ユーザも増えてきました。(OCaml もひっそりと順調にバージョンが 3.11 から 3.12 にあがりました。) (OO 寄りの Scala とか型の無い言語は僕よくわかりませんごめんなさい。触れてない型付関数型言語ユーザの方もごめんなさい。) そんな訳で関数型言語界隈はこのごろ活気付いています。 2011年は日本における関数型言語ブレイクの年になるか?なると嬉しいなあという方にお知らせです。 ICFP 2011 に併設されて CUFP workshop
以前、「JavaScript で引数束縛」において関数のカリー化を試みました。しかし、そこでカリー化された関数は、そのままでは一度しか部分適用ができず、また、最初の関数呼び出しは必ず部分適用として扱われていました。 function mean3(a, b, c) { return (a + b + c) / 3; } // 「JavaScript で引数束縛」における curry 関数。 var curriedMean3 = curry(mean3); curriedMean3(1)(2, 3); // => 2 curriedMean3(1)(2)(3); // => TypeError: curriedMean3(1)(2) is not a function // そのままでは部分適用を 2 回以上行えない。 // curry(curriedMean3(1))(2)(3) なら大丈夫
バグのないソフトウェアを作りたいお仕事では主にVB.NETとC#を。趣味のプログラミングでは関数型言語F#を利用しています。 私自身のF#スキル(関数型的な考え方)は、まだまだ実践レベルとはとても言えないシロモノだけど、 面白い発見と多くの可能性を感じられる言語なので、F#はさわっていてとても楽しい。 私はこれまでオブジェクト指向言語によるオブジェクト指向プログラミングをこよなく愛してきました。 というのも、「いかにバグを減らすか」、「バグのないソフトウェアを作ること」が私の最大の関心事だからです。 バグの多いコード、あるいは技術的負債の多いコードというのは、コスト的な問題があるばかりか、 開発者の身体や心までもを不健康にし、われわれに大きな不幸をもたらすことを経験的にわかっているからです。 わたしにとってオブジェクト指向技術は、それらの問題を防いだり解決をする手段として適した技術でした。
Takashi Miyamoto @tmiya_ オブジェクト指向はOOPの他にOOA,OODなど上流工程向けの方法論があるのだが、関数型言語についてもFPの他にFA,FDがあるのだろうか?誰か適切な論文/教科書とか知りませんか? 2010-05-30 09:26:38 Ikegami Daisuke @ikegami__ 探してみます。でも強い型付けか、弱い型付けかで、まるっきり異なるでしょう RT @tmiya_: オブジェクト指向はOOPの他にOOA,OODなど上流工程向けの方法論があるのだが、関数型言語についてもFPの他にFA,FDがあるのだろうか?誰か適切な論文/教科書とか知りませんか? 2010-05-30 09:30:40 Ikegami Daisuke @ikegami__ @tmiya_ 個人的な感想ですが、強い型付けのプログラミング言語で開発を行う場合、実装の前に、全体
FP (short for functional programming)[2] is a programming language created by John Backus to support the function-level programming[2] paradigm. It allows building programs from a set of generally useful primitives and avoiding named variables (a style also called tacit programming or "point free"). It was heavily influenced by APL developed by Kenneth E. Iverson in the early 1960s.[3] The FP lang
Robert Fischer claims Scala is not a functional language. But if you go by his post then Erlang isn't either. ModulesFischer says In OCaml, we define a function like this:let f x = x + 1;;In Scala, though, we define the function somewhat differently:object SomeHolderObject { val f(x:int):int = { x + 1 } } Now some Erlang -module(SomeHolderModule). -export([f/1]). f(X) -> X + 1. Erlang requires a f
Inspirations & experiments, mainly about denotative/functional programming in Haskell There is a lot of confusion about the meaning of “functional” and “declarative” as descriptions of programming languages and paradigms. For instance, Haskell is sometimes advertised as a “purely functional programming language” and other times as “the world’s finest imperative programming language”. I added some
純粋遅延関数型言語Concurrent Clean (Pure and lazy functional language : Concurrent Clean) 〜 The most functional language 〜 Concurrent Cleanは、オランダのネイメーヘン大学で開発している、純粋な関数型言語です。 メジャーな関数型言語としては、Lisp、Scheme、ML、Haskell等がありますが、それらに決して劣ることのない環境と言語仕様を持つ言語です。効率性・開発環境・言語仕様どれも最高位ではないかと思うくらいです。言語仕様的には、この中では、Haskellに一番似ているとされています(沿革的にはMirandaと言われる純粋関数型言語の中間言語から出発していますので、Mirandaに似ていると言う方が正確でしょうが)。 ここでは、著作者たるPlasmeijer教授
How to Design Programs An Introduction to Computing and Programming Matthias Felleisen Robert Bruce Findler Matthew Flatt Shriram Krishnamurthi The MIT Press Cambridge, Massachusetts London, England Copyright © 2001 Massachusetts Institute of Technology Illustrations © 2000 Torrey Butzer All rights reserved. No part of this book may be reproduced in any form by any electronic or mechanical means (
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く