thinking in linq

33
Thinking in LINQ Sudipta Mukherjee

Upload: sudipta-mukherjee

Post on 02-Jul-2015

391 views

Category:

Technology


6 download

DESCRIPTION

FuConf14 Thinking in LINQ

TRANSCRIPT

Page 1: Thinking in linq

Thinking in LINQSudipta Mukherjee

Page 2: Thinking in linq

About me

twitter.com/samthecoder [email protected]

codeplex.com/stringdefscodeplex.com/datedefs

SKILLS .INTERESTS. HOBBIES

C;C++; C#; F#; Framework Design; Data Structures; Algorithms; Tools Development; Text Processing; NLP; Machine Learning; Domain Specific Languages; Unit Testing; Expressive Computing; Usability; Refactoring; Web Crawlers; Data Visualization; Data Analysis; Sketching; Paintings; Geometry; Physics; Humor; Technical Writing;

200820122014

Page 3: Thinking in linq

Avail 30% Discount! (Code: LINQ14)

Here is how you can get the discount

Page 4: Thinking in linq

About this session

LINQ scripts solving real problems

Example from the book

Q & A

Page 5: Thinking in linq

LINQPadThe tool used in demo

The best C#/VB/F# snippet editor/compiler ever

Download from http://www.linqpad.net/

Use Dump() method to see anything. You can dump anything

DateTime.Today.Dump();

(new List<int>(){1,2,3}).Dump();

Page 6: Thinking in linq

Loop to LINQDitch the loop in favor of parallelization

Page 7: Thinking in linq

General strategy for Loop to LINQ

Page 8: Thinking in linq

Human Computer InteractionSimulating T9 and Gesture Keyboard (Swype)

Page 9: Thinking in linq

Human Computer Interaction

Page 10: Thinking in linq

T9 input in Action

Page 11: Thinking in linq

Show me code T9 Simulationhttps://gist.github.com/sudipto80/5c887a7df2971c84c196

Page 12: Thinking in linq

Swype in action

Page 13: Thinking in linq

Some amusing sub-sequences

ORNAMENTAL

Rental

Mental

Oral

Metal

Mental

World is not enough

Wine

Page 14: Thinking in linq

Show me code Swype Simulationhttps://gist.github.com/sudipto80/8b9819b37b8bd27448ff

Page 15: Thinking in linq

Spell CheckingCloning Peter Norvig’s Spell Checking using List Comprehension in LINQ

Page 16: Thinking in linq

Peter Norvig’s spell check

Page 17: Thinking in linq

Show me codehttps://gist.github.com/sudipto80/1d96feab131cc03c7cb4

Page 18: Thinking in linq

Memoization in ActionFibonacci Series and Friends

Page 19: Thinking in linq

Fibonacci Series

Calculate and Cache for faster evaluation

Page 20: Thinking in linq

Show me the codehttps://gist.github.com/sudipto80/6194ecce24861d2b3474

Page 21: Thinking in linq

Domain Specific Languages (DSLs)Creating a DSL for Mathematicians

Page 22: Thinking in linq

Creating Domain Specific Languages

Imperative Style

Embedded DSL

External DSL

Page 23: Thinking in linq

Armstrong in Action

Page 24: Thinking in linq

Show me the codehttps://gist.github.com/sudipto80/ccb75622b3f83b33b3f1

Please buy the book for explanation.

Page 25: Thinking in linq

Meta ProgrammingUsing LINQ and Roslyn

Page 26: Thinking in linq

Roslyn

Download CTP from http://www.microsoft.com/en-in/download/details.aspx?id=34685

Page 27: Thinking in linq

Show me the codeFor all these you need to create Roslyn Console Application

Finding all methods that don’t use all the parameters

https://gist.github.com/sudipto80/a008f7f992d7a8f01d71

Finding number of lines of code for all functions

https://gist.github.com/sudipto80/824c84bac10a9e1e3780

Finding number of local variables

https://gist.github.com/sudipto80/3c286e7167e99dc6a6bc

Page 28: Thinking in linq

Machine LearningIdentifying a flower using k-NN

Page 29: Thinking in linq

Iris flowers

Iris – virginica

Iris – versicolor

Iris-setosa

Page 30: Thinking in linq

Implementing k-NN in a line!

Can you guess the class of the green circle ?

Page 31: Thinking in linq

Show me the codehttps://gist.github.com/sudipto80/994bfb0495b3fcdac344

Iris.csv

Page 32: Thinking in linq

Need Training in LINQMail me at [email protected]

Page 33: Thinking in linq

Thanks!Questions?

[email protected]