📜 ⬆️ ⬇️

F #: a very beautiful example using DirectX

I wanted to make a link, but the text does not fit 500 characters ...
So, F # is a new language in the .NET line, a functional programming language. Soshnikov D.V. on platforma2009 at the end of the report, it shows a very interesting and beautiful example of using F #, building graphs of functions (time-dependent!) and launching rolling balls on graph surfaces.

This example can be taken here , the only thing that needs to be a little fiddling with it for the current version of F # CTP 1.9.6.2.
1. #I @ "C: \ WINDOWS \ Microsoft.NET \ Managed DirectX \ v9.02.2904" ;; I need to replace DirecX (SDK) with your installed version, I had it in #I @ "C: \ Windows \ Microsoft.NET \ DirectX for Managed Code \ 1.0.2902.0" ;; (I think you will have about the same place, the only thing is that the difference between the versions is the last numbers)
2. Add reference to the assembly:
#r "FSharp.PowerPack.dll" ;;
#r "FSharp.Core.dll" ;;
3. Replacement
open idioms
open compatibility
open list
on
open Microsoft.FSharp.Collections.List
4. In line 285, I had to add parameterization in the let meshGet mesh (i, j) = let X, Y = mesh in X. (i, j), Y. (i, j) function and let meshGet mesh ( i, j) = let (X: float [,], Y: float [,]) = mesh in X. [i, j], Y. [i, j]
5. On line 307, again remove the open Idioms and open List
6 On line 334, we change the let (doDrawScene, drawScene): event = IEvent.create () to let (doDrawScene, drawScene): event <time> = IEvent.create () (this is basically written on the forum - where the example came from)

That's all, run an example (it is made to run in F # Interactive).

Related Links:

')

Source: https://habr.com/ru/post/57056/


All Articles