Code Monkey home page Code Monkey logo

fsharpforfunandprofit.com's People

Contributors

akeeton avatar brianium avatar cartermp avatar codybartfast avatar dedale avatar dividead avatar djcarter85 avatar djtango avatar donal-lgc avatar fourchaux avatar gsuuon avatar hangindev avatar itsecmedia avatar janhohenheim avatar jdefontes avatar kragt avatar ludwigpacifici avatar merlinmm avatar mikecoop avatar roald87 avatar rsivth avatar samuel-dufour avatar schibu007 avatar shalokshalom avatar starychfojtu avatar swlaschin avatar timba avatar trickycat avatar tysonmn avatar vabc3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fsharpforfunandprofit.com's Issues

Incorrect command on the 'Installing and using F#' page

Thanks for all of your hard work in providing this great resource.

Just a small error in the 'Shell scripts in F#' section on the 'Installing and using F#' page.

The command given to run the shell script example is -
fsi ShellScriptExample.fsx http://google.com google_homepage

this should be -
dotnet fsi ShellScriptExample.fsx http://google.com google_homepage

Broken Links

Some links appear to be broken in Why Use F#: "Many common programming tasks are much simpler in F#. This includes things like creating and using [/posts/conciseness-type-definitions/](complex type definitions), doing list processing, [/posts/convenience-types/](comparison and equality), state machines, and much more."

This is a fantastic website btw!

Not a typo, not an error, but something I did struggle with ...

I really enjoyed the series "Map and Bind and Apply, Oh my!", and each step clicked nicely, until I tried to make sense of this line in "Understanding traverse and sequence".

        retn cons <*> (f head) <*> (mapOption f tail)

As a C# programmer, I fell in the trap of reading it automatically like this

        return ( cons <*> (f head) <*> (mapOption f tail) )

And of course, no matter how many times I went back to read the apply chapter, I could not get it.

I don't know (yet) if this is a valid F# syntax but if it was, that would be one way to make it harder to fall into this trap.

        (retn cons) <*> (f head) <*> (mapOption f tail)

Or maybe an additional note could warn the unsuspecting C# programmer of the danger ahead.

Comparing F# with C#: Sorting, incorrectly rendered source code

The post "Comparing F# with C#: Sorting" has incorrectly rendered source code in Correctness section. The if statement and last curly bracket should be placed in new lines. Please look at the images below.

image

However it's rendered correctly, when I open this post at GitHub.

image

Checked at:
Internet Explorer version 11.1098.17763.0
Opera version 65.0.3467.56
Chrome version 80.0.3987.149

Wrong statement in "Understanding F# types" series - Discriminated Unions - Union representation

https://fsharpforfunandprofit.com/posts/discriminated-unions/#union-representation

At the end of the page it reads:
Union types have a nice default string representation, and can be serialized easily. But unlike tuples, the ToString() representation is unhelpful.

type Contact = Email of string | Phone of int
let email = Email "[email protected]"
printfn "%A" email // nice
printfn "%O" email // ugly!

But the console output is the same for both:
Email "[email protected]"
Email "[email protected]"

which is a contradiction to the initial statement (ToString() representation is unhelpful).

Cheers

Newsletter Mailchimp issue

Firstly, I would like to commend you on this book. I'm not writing in F# ( elixir and elm at the moment ) but your explanations address how to think about the problem vs how to write code. Thank you again for all of your insight.

I enjoyed your book so much that I would like to subscribe to your newsletter...but I receive this message.
screen shot 2019-01-27 at 7 11 09 pm

int generators distribution no longer clustered around zero

In the post Understanding FsCheck, it was mentioned ints generated are not uniformly distributed but clustered around zero.

// see how the values are clustered around the center point
intGenerator
|> Gen.sample 30 10000
|> Seq.groupBy id
|> Seq.map (fun (k,v) -> (k,Seq.length v))
|> Seq.sortBy (fun (k,v) -> k)
|> Seq.toList

I believe it is no longer true since FsCheck 2.14.0 release. I verified that the results are now uniformly distributed by running the code snippet above.

Please post source code in F# featured in your great book (fun and profit)

Scott - Thanx for your great book which is helping an old C guy learn a new func language. Do you think you could upload all of your F# fs files into GitHub so that we can download them and open them in Visual Studio? It would be easier than copying and pasting from the eBook or PDF book.

Thanks
Tony D

Reinventing the Reader monad - Zero value brakes the code

First, Thanks for your blog, it is changing my mind for programming... I've read it entirelly twice, and now I'm in the third reading...

I noticed that in the Reinventing the Reader monad, when I tried to run the sample code, I always got a failure from the executeApiAction func... I tried to run the code related to the api outside the result expression and it worked, so I thought that the problem should be in the builder... after some digging I noticed that the Zero value for the builder is Failure, and I noticed it gets binded to to the actual result in every for in loop... and as binding to a failure gives a failure, the result of the computation expression is always a failure....

as a work arround is to change the zero value to a Success (), but then the meaning of the zero would be wrong, because it should be starting from a failure.... I'm thinking about other possibilities.

Invalid link: Why use F#? series -> Four Key Concepts post

In the end of the post, last sentence: "In order to work with the Shape type, a function needs to handle each case of the Shape, which it does with pattern matching."

<a href="conciseness-pattern-matching.html">pattern matching</a>

click, redirect to https://fsharpforfunandprofit.com/posts/key-concepts/conciseness-pattern-matching.html, 404 Not Found

Update the F# "Installing and Using" page

I believe now it's easier to get up and running with VS Code and F# than ever before with .NET 5 (and next ones). There is no need for Mono anymore I believe, all what's really needed is .NET SDK, VS Code and Ionide. Easy to set up on both Windows and Linux, including WSL (I don't have Mac machine available, so I cannot tell but it should not be very different).

There are some links on that page which have expired / will expire. It also seems like F# PowerPack is no longer maintained / needed. Maybe the VS v2008 (obsolete?) part could be removed. Screenshots could be updated too. Or maybe the whole section for installation could be referenced to MS sites where all the install info can be found.

I would be happy to do the updates if you prefer and send for your review.

The properties for a sorted list are insufficient

In "Choosing properties for property-based testing", it says a sorted list should be:

In fact, these two properties, adjacent pairs from a list should be ordered and a sorted list has same contents as the original list should indeed ensure that any implementation is correct.

This (as implemented in the article by checking the length and permutation-ness) is true of a list without duplicates, and the EDFH would have a hard time implementing such an algorithm, but this case passes the tests and is wrong:

sort [2; 2; 1; 3] -> [1; 1; 2; 3]

404 - Page not found in link on Choosing between collection functions

On the page entitled "Choosing between collection functions" (https://fsharpforfunandprofit.com/posts/list-module-functions/), there is a link or two in this paragraph:

If you want to know what changed between F# v3 and F# v4, please see this chart (from here). The chart shows the new APIs in F# v4 (green), previously-existing APIs (blue), and intentional remaining gaps (white).

The link to the 404 is: https://learn.microsoft.com/en-us/archive/blogs/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-71-metablogapi/3125.collectionapi_5f00_254ea354

I appreciate fsharpforfunandprofit.com. It seems to be just what I need to get more up to speed in F#. And I hope this post is helpful in maintaining the website by calling attention to this issue.

Ron Lewis

eBook download

Hey!
I'm getting redirected to GitBook main page when trying to download the ebook PDF (also end-up trying for ePub and Kindle and got the same problem).

Thanks for your time!

Union type without Of in Low overhead type definitions example

I was following this site and when at this page I've found this problem,
There is a union type of Address which consists of three other types.
type Address = USAddress | UKAddress | InternationalAddress
The problem is compiler does not understand that these three are itself another type and thus I can not assign a UkAddress variable in an Address variable.
For now, I've found a workaround for this. which is like that,
type Address = UsAddress of USAddress | UkAddress of UKAddress | InternationalAddress of InternationalAddress
Also, I think if there is a Customer variable with some dummy data then it would be much more understandable.

Broken Link https://fsharpforfunandprofit.com/posts/concurrency-reactive/

Hi Scott,

There is a broken link in the following section of fsharpforfunandprofit.

https://fsharpforfunandprofit.com/posts/concurrency-reactive/

the broken link is correspondind to the Observable module in the summary section.

I suggest to replace it with https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ee370313(v=vs.100)?redirectedfrom=MSDN but microsfot indicates that is no longer update this content regularly.

Thanks for your wonderful content

is it just me !?

or does no one else in the world think that date and time of an article is important?

would this be more or less relevant if it was from 1897 or 2021? some maybe not, TECH probably relevant!

date and time at the TOP of every blog post webpage youtube or whatever for some date CONTEXT please, things move fast in this world, #datestampit, please.

https://fsharpforfunandprofit.com/monadster/
for ref

Font issue on Firefox

Since about 3 years at least, the fonts on Firefox look very disturbing.
We already tried to evaluate that, leaving this issue here to track the issue.
Thanks a lot for all.

Screenshot_20190604_104759

Broken link in recursive types and fold series

Hello,

First of all, thanks for the excellent content.

The msdn links for the fold and fold back documentation are broken for this page.

First broken link:
Text: If we compare the signature with the List.fold documentation we ....
Correct link (suggestion):
https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-listmodule.html#fold

Secondbroken link:
Text: Again, if we compare the signature with the List.foldBack documentation ....
Correct link (suggestion):
https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-listmodule.html#foldBack

There is a C# interactive, contradicting an article

Hi! I was just reading this page, and near the bottom the following is said:

F# has an interactive window where you can test the code immediately and play around with it. In C# there is no easy way to do this.

Just like how F# has an interactive REPL, C# has one too, which works just fine:

View -> Other Windows -> C# Interactive

Domain Modelling Made Functional Book

Hi,

Domain Modelling Made Functional Book

Just bought the book from amazon.co.uk. Could you please post the diagram that is meant to be on the top of page 18! The diagram that is in my copy ‘Book version: P1.0-January 2018’ has the same diagram on page 18 as is on page 17 i.e. the ‘Problem space (real world) - Solution space (domain world). I have looked around and can find no mention of this error or the correct diagram.

Best regards

Stephen

Please add page numbers and section numbers to ebook

Hi Scott,

thank you so much for all your work and effort that you have put into this website. I find it especially awesome that you also provide an offline version of the page as ebook.

There is only one flaw to it, namely, it is fairly difficult to navigate for the following reason. The table of contents only includes section numbers but not page numbers. The content itself, however, does not include the section numbers at all, but only the page number.

Could you please extend your ebook generator in such a way that:

  1. The Table of Contents contains both the section numbers and the page numbers.
  2. The header of each page also includes the section number.

I would be ever so grateful for that.

Once again, thank you for everything and keep up the good work!

"Computation expressions: Introduction" - HttpWebRequest is deprecated

The first computation expressions tutorial has some code snippets that use HttpWebRequest from System.Net in the "Asynchronous calls with callbacks" section.

open System.Net
let req1 = HttpWebRequest.Create("http://fsharp.org")
let req2 = HttpWebRequest.Create("http://google.com")
let req3 = HttpWebRequest.Create("http://bing.com")

req1.BeginGetResponse((fun r1 ->
    use resp1 = req1.EndGetResponse(r1)
    printfn "Downloaded %O" resp1.ResponseUri

    req2.BeginGetResponse((fun r2 ->
        use resp2 = req2.EndGetResponse(r2)
        printfn "Downloaded %O" resp2.ResponseUri

        req3.BeginGetResponse((fun r3 ->
            use resp3 = req3.EndGetResponse(r3)
            printfn "Downloaded %O" resp3.ResponseUri

            ),null) |> ignore
        ),null) |> ignore
    ),null) |> ignore

I get the following warning when running this.

warning FS0044: This construct is deprecated. WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.

Here's an alternative using HttpClient

open System.Net.Http
open System.Threading.Tasks



let url1 = "http://fsharp.org"
let url2 = "http://google.com"
let url3 = "http://bing.com"

let client = new HttpClient()


client.GetAsync(url1).ContinueWith(fun (task1 : Task<HttpResponseMessage>) ->
    let result1: HttpResponseMessage = task1.Result
    printfn "Heres the result: %A" result1
    client.GetAsync(url2).ContinueWith(fun (task2 : Task<HttpResponseMessage>) ->
        printfn "Heres the result: %A" task2.Result
        client.GetAsync(url2).ContinueWith(fun (task3 : Task<HttpResponseMessage>) ->
            printfn "Heres the result: %A" task3.Result
            )
        )
    )

However, this isn't very didactic (have to explain what a Task is, etc.) and it only runs if you load the file in an interactive fsi session;
RunSynchronously results in an exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.