More Noise
Than Signal!
Pain
abstract class Command
{
public virtual void Execute();
}
abstract class MarsRoverCommand : Command
{
protected MarsRover Rover { get; private set; }
public MarsRoverCommand(MarsRover rover)
{
this.Rover = rover;
}
}
class BreakCommand : MarsRoverCommand
{
public BreakCommand(MarsRover rover)
: base(rover)
{
}
public override void Execute()
{
Rover.Rotate(-5.0);
}
}
class TurnLeftCommand : MarsRoverCommand
{
public TurnLeftCommand(MarsRover rover)
: base(rover)
{
}
public override void Execute()
{
Rover.Rotate(-5.0);
}
}
http://stepheneasey.wordpress.com/tag/c/
Pain
Tuple
{
return new Tuple
}
int Reduce(Func
{
return f(t.Item1) + f(t.Item2) + f (t.Item3);
}
Bind a static value
Bind a static function
Bind a local value
Bind a local function
Type inference. The safety of C# with the succinctness of a scripting language
Anonymous
Function value
Declare a
function value
A pair
of function values
predicate = 'a -> bool
send = 'a -> unit
threadStart = unit -> unit
comparer = 'a -> 'a -> int
hasher = 'a -> int
equality = 'a -> 'a -> bool
One simple
mechanism,
many
uses
A function type
Range
Expressions
List via query
Array via query
IEnumerable
via query
✓ Copy & Update
Generated Lists
On-demand sequences
Pipelines
Looks Weakly typed?
Maybe Dynamic?
Weakly Typed? Slow?
Constructing Objects
new FileInfo(@"c:\misc\test.fs")
Inputs to object construction
Exported properties
Exported method
Internal (pre-computed) values and functions
Immutable inputs
Internal tables
Publish access
Internal state
Publish internal state
Mutate internal state
In parallel programming,
F# is a power tool
for good architects and good developers
Compute 22 and 7 in parallel
Async.Parallel [WebRequest.Async "http://www.live.com";
WebRequest.Async "http://www.yahoo.com";
WebRequest.Async "http://www.google.com" ]
Get these three web pages and wait until all have come back
Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:
Email: Нажмите что бы посмотреть