F# in the Classroom and the Lab

1,959 views

Published on

Richard Minerich's talk at the F# in Education Workshop

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,959
On SlideShare
0
From Embeds
0
Number of Embeds
851
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

F# in the Classroom and the Lab

  1. 1. F# in the Classroom and the Lab<br />Richard Minerich<br /> Senior Researcher at Bayard Rock<br /> and F# MVP<br />
  2. 2. F# is Open Source<br />You don’t need to buy <br />Visual Studio to use F#<br />You don’t need to <br />have Windows to use F#<br />
  3. 3.
  4. 4. “Today’s students, from freshmen to seniors, desire relevant assignments that are engaging, challenging, and creative, that also prepare them for their careers.”<br />- Game2Learn: Building CS1 Learning Games for Retention Tiffany Barnes et al. <br />
  5. 5. Play in the Classroom<br />Teach<br />Play<br />Discuss<br />
  6. 6. Interactive Teaching<br />Hot swap code to try different approaches and encourage coding as play/exploration<br />
  7. 7. Simple Engaging APIs<br />-> No complex background needed to start<br />-> Powerful for building easy to use DSLs<br />
  8. 8. Teaching with Games in F#<br />The Students are Given:<br /><ul><li> An Obfuscated Library
  9. 9. A Simple API </li></ul>- A Simple Template Example<br />- Time to play<br />- Motivation via Competition<br />
  10. 10. Ants Everywhere!<br />
  11. 11. Ant<br />Visible Cells<br />Visible Cells<br />Nest Cells<br />Has Food?<br />Properties?<br />Properties?<br />Are Full?<br />Yes<br />No<br />Out of<br />Ideas?<br />No Nest <br />Cells?<br />Food?<br />Phero?<br />Food but <br />no Phero?<br />Nest <br />Cell?<br />Take Food<br />Move Toward Max Phero<br />Drop Pheromones<br />Move Toward Nest<br />Yes<br />No<br />Move to a Random Cell<br />Move to a Random Nest Cell<br />Drop Food<br />
  12. 12. match ant with<br />| HasFood-><br />matchvisibleCellswith<br /> | HasUnownedFood cells<br />when not here.HasPheromone->DropPheromone (here)<br /> | AreNestnestCells-><br />matchnestCellswith<br /> | CanDropdropCell->DropFooddropCell<br /> | CantDrop-> Move (randomEmptyCellnestCells)<br /> | AreNotNest cells -> Move (closestToHomevisibleCells)<br />| HasNoFood-><br />matchvisibleCellswith<br /> | HasUnownedFood cells ->TakeFood (maximizeFood cells)<br /> | HasPheromones cells -> Move (maximizePhero cells)<br /> | _ -> Move (randomEmptyCellvisibleCells)<br />
  13. 13. A Framework for F# Assignments<br />Obfuscated Library<br />CI Server<br />Student<br />Assignment<br />Template<br />
  14. 14. Engaging<br />Classwork<br />Automated<br />Grading<br />Everyone <br />Wins<br />
  15. 15. F# in the Lab<br />Like Matlab but better in many ways.<br />
  16. 16. Ranking a PEP List<br />
  17. 17. Pain<br />% Matlab<br />function [varargout] = CalcPepIndex (A, E) <br /> A=spconvert(A);<br /> E=full(spconvert (E));<br /> c=0;<br /> d=0;<br /> R=E;<br /> while c < 1000<br /> R1=.975*(A*R)+.025*E;<br /> d=norm(R1-R,1);<br /> c=c+1;<br /> R=R1;<br /> end<br />varargout (0) = R;<br />end function;<br />Pleasure<br />//F#<br />let calcPepIndex (A: matrix) <br /> (E: Vector<_>) =<br /> let rec calc R =<br /> let R' = 0.975*(A*R) + 0.025*E<br /> let d = Vector.norm(R' - R)<br /> if d = 0.0 then R <br /> else calc R'<br /> calc E <br />
  18. 18. F# vsMatlab<br />Fast<br />Specific<br />General Purpose Tools<br />Easy Deployment<br />Integrates R&D<br />Slow<br />Imprecise<br />Domain Specific Tools<br />Painful Deployment<br />Segregates R&D<br />
  19. 19. Learning in F#<br />Researching with F#<br />Finding Opportunities with .NET<br />
  20. 20. Questions? Rick@BayardRock.com<br />

×