Event : Visual Studio Users Community Japan #1
Date : 2019/09/14
ソフトウェア/サービス開発において最も後回しにされるものの代表が「パフォーマンスの向上」です。C#/.NET の最大の武器は開発生産性ですが、C# 7.0 以降はパフォーマンス向上のための機能追加が多数行われています。いくつかのポイントを押さえることで実装時からより高速なコードを書くことができるようになります。
このドキュメントでは、そんなポイントとなる箇所をふんだんにお届けします。
This document compares and contrasts Clojure and Elixir programming languages. It provides an overview of their origins, syntax, concurrency models, macro systems, and further reading recommendations. Key points include Clojure running on the JVM while Elixir runs on the BEAM VM, both having Lisp-like syntax with differences in collection types, and both supporting metaprogramming through macros while having different macro expansion approaches.
Scala is a blend of object-oriented and functional programming that runs on the Java Virtual Machine. It was designed by Martin Odersky at EPFL. Scala is more like an open-source "bazaar" that is constantly adapted and extended, rather than a carefully constructed "cathedral". Functions are first-class citizens in Scala - they can be defined anywhere, passed as parameters, and returned as results.
Domain Modeling Made Functional (DevTernity 2022)Scott Wlaschin
(video at https://fsharpforfunandprofit.com/ddd/)
Statically typed functional programming languages encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers. Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time. In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
This document discusses various programming languages and tools, including F#, C#, VB, .NET Framework, and related concepts. It compares features of F# to other languages like options vs null, pattern matching, pipe operators and more. It also covers F# tools for Visual Studio like F#Depth colorizer and various IDE editions for using F#.
This document compares and contrasts Clojure and Elixir programming languages. It provides an overview of their origins, syntax, concurrency models, macro systems, and further reading recommendations. Key points include Clojure running on the JVM while Elixir runs on the BEAM VM, both having Lisp-like syntax with differences in collection types, and both supporting metaprogramming through macros while having different macro expansion approaches.
Scala is a blend of object-oriented and functional programming that runs on the Java Virtual Machine. It was designed by Martin Odersky at EPFL. Scala is more like an open-source "bazaar" that is constantly adapted and extended, rather than a carefully constructed "cathedral". Functions are first-class citizens in Scala - they can be defined anywhere, passed as parameters, and returned as results.
Domain Modeling Made Functional (DevTernity 2022)Scott Wlaschin
(video at https://fsharpforfunandprofit.com/ddd/)
Statically typed functional programming languages encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers. Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time. In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
This document discusses various programming languages and tools, including F#, C#, VB, .NET Framework, and related concepts. It compares features of F# to other languages like options vs null, pattern matching, pipe operators and more. It also covers F# tools for Visual Studio like F#Depth colorizer and various IDE editions for using F#.
This document appears to be a collection of tweets and comments discussing various programming languages and tools including Scala, F#, SQL, Git, C#, Ruby, OCaml, Haskell, CommonJS, Amazon EC2, Coq, ZendEngine, AsakusaSatellite, and XYZ. Many Twitter handles are mentioned in the replies discussing topics like garbage collection, meta-object Lisps, and functional programming languages.
This document discusses the author's experiences with various programming languages and technologies over the years including Lightweight Language, Haskell, Scala vs Kotlin, Smalltalk, and Lexically scoped Lisp. It also mentions how AsakusaSatellite and @mzp have grown and reflects on the author's life in Nagoya.
iOS オールスターズ2でお話しした資料です! Swift らしさってなんだろう、そんなところを API デザインガイドラインと Swift 標準ライブラリの表現に着目して 7 つほど紹介してみました。あくまでも "指針" なので『そういう風に考えていくのね』みたいに捉えて、そこからは "自分らしい" 言葉を紡いでいってくれたらいいのかなって思います。
This document discusses the differences between using yield and return in computation expressions in F#. It presents several implementations of computation expressions to demonstrate how yield and return can be distinguished. The key differences are:
- yield continues the remaining computation expression, while return stops any remaining expressions from executing.
- Several approaches are presented: using exceptions, a state field on the builder, and passing state as an argument. The state argument approach provides a clear separation of yield and return without sharing state between uses of the builder.
- Continuations are also proposed as an implementation, where yield calls the continuation and return discards it. This approach makes the symmetry between yield and return very clear.
This document provides a summary of an individual's background and experiences including programming languages, conferences, and meetups. It includes the following information in 3 sentences:
The document identifies an individual named bleis-tift and lists their experiences with programming languages like F#, C#, Git, and Vim as well as their involvement with Meetup groups focused on test-driven development, source code management, and more. Various conferences and meetups are listed that they have attended related to programming topics such as .NET, Ruby, F#, JavaScript, functional programming, and more. Locations mentioned include Nagoya, Japan where several meetups on topics such as Perl, OCaml, Scala, and development practices were held.
This document discusses upcoming events related to functional programming languages and mobile development platforms. It lists upcoming talks on F# and Scala in Tokyo, and notes an online F# advent calendar from December 1st to 25th featuring short daily posts about F#. It also advertises an upcoming workshop on building Windows Phone applications using F# and C#.
The document discusses using Git for version control in Visual Studio and integrating it with test-driven development. It provides commands for rebasing a development branch onto the master branch and then deleting the development branch. It also mentions using Git from the command line, Git GUI tools, integrating with issue trackers like Redmine and GitHub, and continuous integration tools.
The document discusses using Jenkins for continuous integration of .NET projects. It recommends installing plugins for Git, MSBuild, NUnit and other tools to integrate them with Jenkins. The Groovy and PowerShell plugins allow adding custom build steps. Overall Jenkins is presented as a good option for continuous integration of .NET projects by automating builds and running tests on each code change.
This document discusses F# and FParsec. It provides examples of parsing expressions in FParsec using lazy evaluation and references, as opposed to NParsec which uses bindings. FParsec allows defining recursive parsers in a natural way in F#.
This document summarizes the key differences between centralized version control systems (CVS) and distributed version control systems (DVCS). It explains that DVCS allow for non-linear development with features like rebasing and branching that are not possible in CVS. Examples of DVCS like Git and Mercurial are given. The document also discusses how to migrate from CVS to a DVCS and advantages of using continuous integration with a DVCS.
The document discusses various topics related to Vim including Vim on Windows, vimrc configuration files, Vim commands, plugins, and Vim hacks. It provides instructions for installing Vundle and cloning Vim plugins from GitHub. It also includes mappings for quickly opening vimrc files and reloading configuration.
This document discusses continuous integration (CI) and using Jenkins for CI. It mentions using Vim, Git, LaTeX, and generating PDFs. It discusses setting up a private system build in CI that uses Ruby and sbt (Scala build tool). Jenkins is used to run builds from version control and ensure the system is properly integrated and built.
9. 式と文の違い (文)
Java
int[] f(int x) {
int[] res = new int[x];
for (int i = 0; i < x; i++)
res[i] = i * 2;
return res;
}
int sum(int[] xs) { ... }
// これはもちろん可能
int total = sum(f(10));
// これは出来ない
int total = sum(
int[] res = new int[x];
for (int i = 0; i < x; i++)
res[i] = i * 2;
return res;
);
10. 式と文の違い (式)
F#
let f x =
let res = Array.zeroCreate x
for i in 0..(x - 1) do
res.[i] <- i * 2
res
let sum xs = ...
// これはもちろん可能
let total = sum(f 10)
// これも可能!
let total =
sum (
let res = Array.zeroCreate 10
for i in 0..(10 - 1) do
res.[i] <- i * 2
res
)
13. さっきのコードをもう一回見てみる
let f x =
let res = Array.zeroCreate x
for i in 0..(x - 1) do
res.[i] <- i * 2 // 状態書き換えてる!
res
状態書き換えない版
let f x =
Array.init x ((*)2)
ループを自分で書く必要すらない!
→バグの抑制につながる
14. F#って静的型付き言語って言ったよね・ ?
・・
今までのコード、型書いてません。
でも、型推論によってコンパイル時に型が付いて
いたのです!
// int を受け取って int[] を返す関数
// 「int -> int[]」と記述する
let f x =
Array.init x ((*)2)
この関数にどうやって型が付いたのか見ていき
ます。
16. ((*)2) について
F#では、中置演算子を関数として扱える
2 * 4 // 8
(*) 2 4 // 8
そして、複数引数の関数に引数を「一部」与える
ことができる
let f x y = x * y
f 2 4 // 8
let g = f 2
g 4 // 8
つまり、((*)2) は「何かを 2 倍する関数」
17. 型推論のステップ
let f x =
Array.init x ((*)2)
1 Array.init は、int → (int → α) → α
[]
. 2 x は Array.init の第一引数として渡している
x の型は int
3 戻り値の型は Array.init の戻り値の型と同じ
.
f の戻り値の型はα
[]
4 掛け算「*」の型は int → int → int
((*)2) は引数を一つ与えているので、int → int
これを Array.init の第二引数として渡しているの
. で、(int → α) のαは int
全体として、f は「int → int ]
[ 」
30. 二分木の実装
Java の場合
public class BinTree {
final int value;
BinTree left = null;
BinTree right = null;
public BinTree(int value) {
this.value = value;
}
}
F#の場合
type BinTree =
| Leaf
| Node of BinTree * int * BinTree
// ↑ ↑
31. 二分探索木の探索
Java の場合
public boolean contains(int value) {
if (value == this.value)
return true;
if (value < this.value && lelft != null)
return left.contains(value);
if (this.value < value && right != null)
return right.contains(value);
return false;
}
F#の場合
let rec contains value = function
| Leaf -> false
| Node (l, v, r) when v = value -> true
| Node (l, v, r) when value < v -> contains value l
| Node (l, v, r) when v < value -> contains value r