This program is written in only 99 lines of actual code and remains enough readability. I used few short-coding technics. 1. no XAML. 2. pre-calculate every useful data for the purpose of eliminating useless states 3. using record type with set property as an alternative of view-model 4. initialize everything in one place. 5. encapsulate all states in one place.
17 people like thisPosted: 13 years ago by nagat01
It's a joke one liner implementation of Tennis Kata.Please see this code not seriously.
1 people like thisPosted: 13 years ago by nagat01
Bi directional map to implement toString and fromString function for descriminated unions.
4 people like thisPosted: 13 years ago by nagat01
I learned how to implement this by reading this great good project http://code.google.com/p/fsharp-typeclasses/ But I can't understand why the project needs ternary operator. I used binary operator and seems it's okay.
6 people like thisPosted: 12 years ago by nagat01
This script facilitates to load all the .fs files in the specified F# project in correct compilation order.
5 people like thisPosted: 12 years ago by nagat01
This snippet automatically speeches text of question,answers and comments in a Stackoverflow article. It requires HtmlAgilityPack(available from Nuget package manager).(Attention: You need reset F# interactive to stop the speech)
6 people like thisPosted: 12 years ago by nagat01
Placeholder syntax like scala or clojure. It can be used when the situation point-free style can't be applied. It only works for binary operators. But it's quite simple and can be used somewhat.
1 people like thisPosted: 11 years ago by nagat01
Untyped version of toml parser. The lines of code was reduced 173 to 45. It's based on some implementations in other languages (https://github.com/mojombo/toml#implementations). I was surprised that even a parser written in Objctive-c was simpler than mine (http://fssnip.net/jd). Then I read some others code and found that removing types which describes toml values simplifies the implementation. The code may seem little crazy, but I'm fine :)
0 people like thisPosted: 11 years ago by nagat01
Sequence expression which deals with cartesian product of sequences with for ... do expression. It replaces nested for .. do expression to single one.
0 people like thisPosted: 11 years ago by nagat01
I read all the suggestions on http://fslang.uservoice.com/ . They are great suggestions! I found some of then are realized well by using current language features. Then I introduce them.
6 people like thisPosted: 10 years ago by nagat01
PI number calculation based on the wikipedia page(http://en.wikipedia.org/wiki/Pi#cite_note-59). I used Newton's , Machine's and Ramanujan's formula. (updated: line 21: Seq.take => Seq.truncate)
4 people like thisPosted: 13 years ago by nagat01
This small script converts continuous 4 spaces to 2 spaces by using Regex. It gets the source code from a clip board text and save it to clip board. Since this program doesn't parse the source code, conversion is not perfect. But writing script which interacts with clipboard is so easy, you can automate your trivial coding work with a small effort. Using F#interactive with Clipboard is my favorite way of meta-programming.
3 people like thisPosted: 13 years ago by nagat01
I started to write pure F# + WPF application in about half a year ago. Today, I found a good way to compose WPF controls with dependent values. It's only writing a dependency object type as a class and give it to constructors of GUI controls. In this snippet "Volume","ColorVolume" and "ShapeContainer" has no properties. But works as a View which represents internal Model and allows users to change internal data. You only need calling a constructor of them. It means that you can compose GUI controls and it's functionality as a immutable data structure. (Update 2011/12/02 8:33:00(UTC+09:00) : Removed some user defined operators and renamed a type similar to DependencyObject in this snippet Reactor to SharedValue.) (Update 2011/12/02 9:04:01(UTC+09:00) : renamed some variables..)
22 people like thisPosted: 12 years ago by nagat01
This script opens a window with a red rectangle which is moved by dragging. I like writing interactive GUI without MVVM, FRP and Markup language.
8 people like thisPosted: 12 years ago by nagat01
TicTacToe game simulator implemented by using Joinads(http://tomasp.net/blog/joinads-async-prog.aspx). Game logic in this snippet was simplified so nicely by using Joinads. You can run this snippet on Try Joinads (http://tryjoinads.org/).
4 people like thisPosted: 12 years ago by nagat01
This is a small example of invoking Win32 API. It gets the url which is opened by Google chrome's main window.
3 people like thisPosted: 11 years ago by nagat01
Parser for Tom's Obvious, Minimal Language (https://github.com/mojombo/toml).
5 people like thisPosted: 11 years ago by nagat01
AsyncBuilder extension for maniplating some other containers directory in asynchronous workflow. Bind methods in the extension enables you to retrieve inner values of 'a IObservable and 'a IEvent by using let! or do! keyword without Async.AwaitEvent or AsyncAwaitObservable. For method in the extension omits let! binding. Yield method in the extension enables you to yield value in for expression in asynchronous workflow.
3 people like thisPosted: 11 years ago by nagat01
User Story 1 at http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR 1. Define a function which retrieves text of a single digit with specified index in text of a number. 2. Make a sequence of texts of each digit of account number. 3. Find indices of text of 0 to 9 digit which satisfies structural equality to them.
0 people like thisPosted: 11 years ago by nagat01