7 ms·
Getting Started with Functional Programming in F#
- keithnz 10y agoI've recently got back in to F#, one thing I like is the fact you can leverage the world of .NET For instance, first thing I did was I used suave.io to expose a webservice for a digital IO module ( http://www.mccdaq.com/ http://www.mccdaq.com/ ) and it amounted to around 50 ish lines of code. Runs flawlessly. The F# community is pretty awesome as well with a good ratio between experts and people learning the language.
- jackmott 10y agoSuaveIO is really nice to work with. Peformance is terrible but that could be fixed. Its on my list of things to have a go at improving some time with some PRs. I think the big low hanging fruit would be switching from async await to either Hopac or TPL, which is above my pay grade but there are lrobably othwr areas that could be tweaked. I encourage perf junkies to have a go at it, as it wonderful to work with.
- kirse 10y agoThere's a new F# project out there to utilize ASP.NET Core, which has got Kestrel under the hood. I just discovered it and have yet to do any performance testing, but I'd imagine it's pretty in-line with C# results. https://dusted.codes/functional-aspnet-core https://dusted.codes/functional-aspnet-core
- jackmott 10y agoThat looks promising!
- enricosada 10y agothe Suave extension for ASP.NET Core (https://www.nuget.org/packages/Suave.AspNetCore/ https://www.nuget.org/packages/Suave.AspNetCore/) is fast and you can use lots of suave specific features, with same performant kestrel as base, because suave is added as middleware. Or there is also a new attempt (https://github.com/dustinmoris/AspNetCore.Lambda https://github.com/dustinmoris/AspNetCore.Lambda) to use api similar to suave, more integrated with asp.net core itself (security/auth/etc).
- deleted 10y ago[deleted]
- Rapzid 10y agofsharp would really take off if it had a framework as attractive as phoenix.
- pjmlp 10y agoIs phoenix actually taking off outside SV startups? There are zero Elixir jobs on my part of the planet. Whereas F# is on my PC thanks to a full VS install done by IT, and I can at least use it instead of Powershell.
- i_s 10y agoI've thought about this too, and unfortunately it is not feasible, because of the poor/nonexistent meta programming support in F#. Phoenix uses macros for optimizing functions from templates at compile time, handling translations in a clean way, and removing a lot of boilerplate. Source: Have spent a lot of time with F#, including writing Type Providers (which would not solve the problem).
- Rapzid 10y agoI'm not sure what you mean by optimizing functions. I understand quoting isn't the best thing going vs true macros, but fsharp has full metaprogramming capabilities and operator overload plus custom operators produce some nice DSL's. Anyway, I don't think to be "attractive" it needs to match Phoenix/elixir macros. Nice frameworks can be made in fsharp, and its type system and tooling blows type specs and dialyzer out of the water. Really it needs to be: * (x-platform && easy to use) which is why I'm so keen for the official 4.1 fsharp release. The ecosystem around fsharp and dotnet core needs all the sharp edges ground down. * Smooth OOTB experience * Community momentum * Excellent plug/middleware solution(building on top of asp.net core might be the right approach) Then just let fsharp shine on its own merits.
- pryelluw 10y agoI just started learning F# with the help of a well known F# dev. It's been a fun challenge. Give yourself the chance to try it out. Do check out http://fsharpforfunandprofit.com http://fsharpforfunandprofit.com Its a great resource.
- verinus 10y agoThat site sold me on F# and functional programming! Really good content I can recommend too. Another good Source: http://blog.ploeh.dk/ http://blog.ploeh.dk/
- mcintyre1994 10y agoI'd especially recommend this article: http://fsharpforfunandprofit.com/posts/is-your-language-unreasonable/ http://fsharpforfunandprofit.com/posts/is-your-language-unre... for a very convincing counter-argument to my thinking about #c had enough functional features that learning f# isn't worth it. It's very high on my todo list basically because of this article.
- enricosada 10y agothat website is gold anyway, not only for f#. Lots of nice concepts, explained simply. And lots of good tutorial/ideas
- hacker_9 10y agoOnly problem is their tutorial code is all broken, I had to visit the github link to find what was missing and add it in.
- bogle 10y agoI worked through quite a few of the exercises on http://exercism.io/ http://exercism.io/ and can recommend the challenge and the community around it for learning by writing code.
- pryelluw 10y agoNice, thx. Ill check it out.
- Rapzid 10y agoWhen is 4.1 with .net core support going to be out?
- Scuds 10y agoI can do this - PS C:\foo> dotnet --version 1.0.0-rc4-004771 <- vs 2017 RC4 PS C:\foo> dotnet new mvc -lang F# Pretty certain this is 4.1 and already out. Articles have been around for a while https://medium.com/real-world-fsharp/using-f-with-net-core-aa6cfc9ef547 https://medium.com/real-world-fsharp/using-f-with-net-core-a...
- Rapzid 10y agoFsharp 4.1 does not appear to be released yet. The download for windows is still 4.0. Last I looked ionide did not support .net core. I'm betting it will be released as part of the VS 2017 visualfsharp update. They just called for help testing RC3. I'm looking forward to the release and the subsequent smoothing of the .net core fhsarp ecosystem.
- jimmcslim 10y agoFirst RTM release of VS 2017 due early March, but I think there will be many updates thereafter.
- enricosada 10y agoDepends what you mean released. rtm not, but rc are out, and works. Or use VS2017-rc, to use f# 4.1 with .NET framework Or use .NET Core sdk and .net core https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-rc4 https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-... the default templates use new f# 4.1 Ionide in vscode support .net core (both project.json and msbuild sdks), atm there is a temporary issues with rc4, but feel free to use a previous sdk (are really similar, no need to stay bleeding edge, and will be fixing sooner than later). See wiki https://github.com/dotnet/netcorecli-fsc/wiki https://github.com/dotnet/netcorecli-fsc/wiki for more info about f# and .net core, or new sdk (all version, with how-to and workaround if needed)
- 10y ago
- smortaz 10y agoGreat video! If you want to get an intro to the language w/o installing anything, give Jupyter notebooks a try - F# intro/tutorial: https://notebooks.azure.com/library/fsharp/html/FSharp%20for%20Azure%20Notebooks.ipynb https://notebooks.azure.com/library/fsharp/html/FSharp%20for... (you can just browse it, or sign in to clone & run & edit & ... )
- elcapitan 10y agoI'm currently learning F#, and liked everything so far, in particular that you can learn both functional style as well as interaction with existing .net apis, which allows you to build typical use-cases faster (as you would know them from imperative/oo languages, like building a small crawler). I wish there was a good ML-style language for the JVM. VS Code has good integration, check out the Ionide plugin. For a language introduction, this wikibook is quite ok: https://en.wikibooks.org/wiki/F_Sharp_Programming https://en.wikibooks.org/wiki/F_Sharp_Programming
- fnl 10y ago> I wish there was a good ML-style language for the JVM. Scala?
- elcapitan 10y agoML?
- fnl 10y agohttps://en.wikipedia.org/wiki/Scala_(programming_language) https://en.wikipedia.org/wiki/Scala_(programming_language) (first paragraphs and "influenced by") https://www.quora.com/What-are-the-influences-of-the-ML-language-on-Scala https://www.quora.com/What-are-the-influences-of-the-ML-lang... ...
- elcapitan 10y agoOk, yeah, influenced. Javascript could also be called a LISP with C-Syntax, but that wouldn't make it a LISP. But I get what you mean.
- fnl 10y agoYou should compare the actual syntax and constructs. I agree that JS and LISP certainly are as far apart as anything else, and Python is as "functional" as any other imperative language. But Scala indeed is very similar to (1) OCaml and then (2) ML, and last, (3) Haskell in terms of type inference, syntax, and many other FP concepts [1]. [1] http://www.appservgrid.com/hyper/hyp/ml http://www.appservgrid.com/hyper/hyp/ml
- j_s 10y agohttp://www.tryfsharp.org/Create http://www.tryfsharp.org/Create With Silverlight installed, you can try it in the browser. They really need to update this to work with just a modern browser!