When playing rock-paper-scissors (RPS), we show 0 fingers for rock, 2 for scissors and 5 for paper. This rule is also applied for this console-based game written in F#. Enjoy !0 people like this
Posted: 6 days ago by me
76a9142220867b1e79c403fafe339a809a65ed01cb697988ac2 people like this
Posted: 12 days ago by The streets
Hello everyone, I'm a student who's programed with F# for 8 months. With F#, I managed to write an interpreter for my own language. By using higher order functions and abstract syntax tree, my interpreter can turn the whole program written by programmers (in the form of a string) into a single unit->unit function which actually runs (exactly) what programmers wrote in the string. The thing is I'd like to know if there are ways to compile/ convert a function into a .exe file. If someone's willing to help me, feel free to leave a comment by editing this snipet. /// Please note that I'm asking how to compile a function (can be unit or unit->unit) at RUN-TIME. Thank you in advance. /// Oh, by the way, I left the link to the source code of my interpreter. This may be useful for you to help me. /// Please, just don't laught at my interpreter and the way I wrote it.1 people like this
Posted: 13 days ago by A Person Trying To Sharpen His Programming with F# Everyday
Based on Tomas Petricek's: http://fssnip.net/a7 .
Shows how to handle non OK (200) response codes, where .Net raises an exception upon GetResponse(), which makes it difficult to recover further error information. Here the snippet shows how to handle errors wrapping a Result
Posted: 16 days ago by Joan Arnaldich
With .NET Core 3 a template 'dotnet new worker' was created that allows services to be created. The template currently only works to create C# code so this snippet shows how I have translated the C# into F# and the steps needed to create the service.
dotnet new console -lang F# -o FsharpService
dotnet add package Microsoft.Extensions.Hosting.WindowsServices
dotnet add package System.Net.NameResolution
Update the program.fs as shown below and then build and install the service
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o "./published"
sc create fSharpService binPath= "<
Posted: 1 month ago by Jackson McCann
invokes op_Implicit when applied (for implicit conversions). I have found this to be very convenient when using C# libraries6 people like this
Posted: 2 months ago by Faisal Waris
Invoke the methods from incompatible types104 people like this
Posted: 8 years ago by Tao Liu
Implements iterate function from Haskell's Prelude. The function generates an infinite sequence by applying a function to the initial value (first) and then to the result of previous application.203 people like this
Posted: 9 years ago by Nick Palladinos
Some simple functions for writing more idiomatic F# tests with NUnit.88 people like this
Posted: 9 years ago by Ryan Riley
Two/Three/Four-element generic tuples implemented as a value types for writing more efficient F# code.59 people like this
Posted: 9 years ago by fholm
Continuations provide a means whereby heap space can be traded for stack depth (heap space being generally more plentiful than stack depth). They are especially useful where tail recursion is not possible. Here are a couple of simple continuation examples that can be extended to cover more complex scenarios.89 people like this
Posted: 9 years ago by Neil Carrier
Show's how to define units of measure to add stronger typing to your numerical functions.75 people like this
Posted: 9 years ago by Robert Pickering
Tuomas Hietanen (71) Eirik Tsarpalis (88) Faisal Waris (33) NIck Palladinos (14) Samuel Bosch (12) Kit Eason (51) fholm (26) devshorts (11) Joel Huang (14) Ryan Riley (25) Cesar Mendoza (17) Tomas Petricek (144) Dmitry Soshnikov (7) nagat01 (19) Robert Pickering (11) mavnn (17) Mauricio Scheffer (7) Antonio Cisternino (8) Nick Palladinos (66) Brian Berns (8)
Database contains 2445 snippets out of which 1636 is public.