Talk:F Sharp (programming language)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Interactive Only On Windows?[edit]

The article says that F# Interactive is only available on Windows but I've been working through tutorials on Ubuntu using fsharpi:

 <me>@<myhost>:~$ lsb_release -a
 No LSB modules are available.
 Distributor ID: Ubuntu
 Description:    Ubuntu 18.10
 Release:        18.10
 Codename:       cosmic
 <me>@<myhost>:~$ fsharpi
 
 Microsoft (R) F# Interactive version 4.1
 Copyright (c) Microsoft Corporation. All Rights Reserved.
 
 For help type #help;;
 
 > 3+4;;
 val it : int = 7

Adrian85716 (talk) 01:10, 10 November 2018 (UTC)[reply]

I am sorry. Looks like misunderstood. I was the one who added it in first place. I has removed it just now. read (talk) 18:19, 9 February 2019 (UTC)[reply]

Comment[edit]

The first paragraph in the Overview section is a mess. I don't know what it's trying to say or I'd fix it. Someone who knows about F# should get on that. :-) —Preceding unsigned comment added by 71.8.227.34 (talk) 20:26, 28 August 2009 (UTC)[reply]

Isn't this funny??

When I see this article's name in Wikipedia's title and in the top of my window, a strange character appears. However, when I click on the downward-pointing triangle and this article appears at one of the choices, a real sharp sign appears. Any other articles of this kind?? Georgia guy 01:50, 6 December 2005 (UTC)[reply]

Fixed, now it is similar to C# and others. Pavel Vozenilek 18:40, 6 December 2005 (UTC)[reply]

Why is linking to .NET libraries a disadvantage?[edit]

"A weakness of F# is its setting within .NET. A key design aim is seamless .NET interoperability, both via direct use of .NET APIs from F# and authorship of natural .NET components in F#. Consequently, the main F# libraries are the .NET libraries themselves (e.g. DirectX, Windows Forms, and ASP.NET, as well as alternatives like Gtk#)." Why is this a disadvantage? I would have thought that it is an advantage.

I can't possibly see how that would be a disadvantage. Also, taking a look at the article's history, it's evident that it's typical vandalism. Reverting. Chuboltite 12:38, 17 July 2007 (UTC)[reply]
I can't see how it's a disadvantage either. That's like saying it's a disadvantage to have Java run by the Java Virtual Machine. Managed languages are run by VM's (the CLR in this case) so if that's a criticism then it should be about the paradigm of managed languages, not F#.
Does the article still claim that? Where? --soum talk 18:29, 25 March 2008 (UTC)[reply]
I assume the author's intent was that the BCL APIs can be rather un-functional in flavor, which may be seen as a disadvantage to using them in the context of functional (or mostly functional) F# codebases. I think it's a strange way to write this (libraries are not languages, after all, and there's nothing in the language spec that requires it run on the CLR or have access to the BCL, I don't think), but this is a criticism I've heard before (especially in comparison to OCaml, though it's worth noting that in F# there are the OCaml compatibility libraries). S. Ugarte (talk) 16:50, 25 March 2010 (UTC)[reply]
Nice point. I mean, I get your basic point that there is a discrepancy between the functional language and the backup, but being a newb that's about it. What are the disadvantages exactly? How exactly does the discrepancy slow down implementation, or whatever? Would love to know.

Also, what is your point exactly vis a vis "libraries are not languages"? Finally, do you think F# has a chance of becoming important, i.e get a job with it? Is ruby more up and coming? I played about with lisp and loved it but it's not on my course and there is only so much I can do with it if it's not on the course and not employable. I'm already thirty, spent years studying ontology and aesthetics and I'm poor. Is F# going to make waves or what? I think I prefer the functional languages though - did a bit of logo when a kid and it left its turtly recursive trail. —Preceding unsigned comment added by 89.100.19.185 (talk) 19:45, 27 March 2010 (UTC)[reply]

An example of the "un-functional" feel of the .NET APIs can be seen in the comparison between OCaml Maps (which are available in F# by way of the OCaml compat libs in the FSharp PowerPack) and the System.Collections.Generics.Dictionary type. In the former, one creates and manipulates a Map by way of various functions that take and return a Map as an argument, whereas in the latter instance methods are used to manipulate a given instance of the Dictionary. E.g. "Map.add" is of type "'a -> 'b -> m<'a, 'b> -> m<'a, 'b>", in other words, you do things like "Map.add key value mymap" and you get back an altered map (a map instance being immutable). In comparison, Dictionary instances are mutable, and add is an instance method of type "'a -> 'b -> unit" (or void); usage is "mydict.Add(key, value)". This distinction can seem like hair-splitting (though, really, immutable types are a huge lifesaver sometimes), and maybe it is (I mostly write C#).
It's very hard to predict what languages will be important in a general sense. In specific fields, there is often a specific language (or a few) you may want to learn, but in the general case it's difficult. I would say that learning a few different general types of languages is good; if you learn a standard OO language and a functional language and a scripting language, you probably have the background you need if, say, you go somewhere and they use Python (and you know Ruby, so you can get used to Python) or they use Lisp and you know F# so you can get used to Lisp, or they use Java and you know C# so it's no trouble at all. Good employers will recognize that experience and talent are as or more important than skills in a given language, and good employees will be able to pick up a related language quickly.
Hope that helps. And I must say, good luck with the career change. That's something I've always wanted to (and hopefully will eventually) do. Don't let some snot-nosed kid push you around with how Ruby on Rails is awesome or whatever. ;)
S. Ugarte (talk) 20:41, 14 April 2010 (UTC)[reply]

"Cross-platform"?[edit]

Not if someone uses "DirectX, Windows Forms, and ASP.NET" in it - an easy trap, which microsoft is setting up with these "#" languages, but arguably not the fault of the language. I don't know how cross-platform "Gtk#" is. In any case, as I said adding citation-needed, "one has to doubt how cross-platform a Microsoft product is. Someone find an independent source that explains exactly what platforms [F#] works on, how well, and how freely!" E.g. can I easily start making GUIs with F# on PowerPC NetBSD without agreeing to any non-free licenses? (presuming I already have a generic powerpc netbsd system and know how to use it) And if I do, what systems will those GUI programs then run on, and how easily? —Isaac Dupree(talk) 14:21, 17 July 2007 (UTC)[reply]

Would something like this satisfy you? You also mentioned Gtk_Sharp, it *is* cross-platform, read the article. I'm not sure why you raise the "non-free" issue, F# can be used freely, read the license agreement. Mono (software) is a free implementation of the CLI on which compiled F# applications *do* run. 222.225.196.13 13:14, 4 August 2007 (UTC)[reply]
You should be able to create GUI programs with F# on PowerPC NetBSD system and run it without much problems. Both PowerPC and NetBSD are supported Mono platforms. Sanxiyn 07:16, 14 August 2007 (UTC)[reply]
Actually, the F# compiler itself runs on mono --SealedSun (talk) 13:11, 30 December 2007 (UTC)[reply]

What's missing[edit]

A good start, but it seems that there's still quite a lot of things missing. For one thing, many features that make F# remarkable in its family aren't covered - for example, active patterns aren't even mentioned, and there's no explanation that both sequence comprehensions and async workflows are just specific applications of the "computation expression" language feature, which is user-extensible (see [1]), and how it all relates to monads.

I think the differences between F# and other ML languages (such as lack of functors and structural typing) also deserve their own section.

Light syntax should be mentioned, as #light is present in the examples. —Preceding unsigned comment added by 193.87.80.3 (talk) 09:33, 26 May 2009 (UTC)[reply]

Number Agreement[edit]

  • Every statement in F#, including if statements and loops, are composable expressions with a definite return type as well. isn't it "every statement is"? --195.50.80.2 (talk) 08:58, 25 June 2009 (UTC)[reply]
 Fixed by 75.42.158.92 (diff) 11:16, 17 September 2009 (UTC)[reply]

Examples[edit]

All the first three examples seems to be the same thing in the following section:

(* print a list of numbers recursively *)
let rec printList lst =
    match lst with 
    | [] -> ()
    | h :: t -> 
        printf "%d\n" h
        printList t
 
(* Same thing, using matching against list elements *)
let rec printList2 l =
    match l with
    | []     -> ()
    | h :: t -> printfn "%A" h
                printList2 t
 
(* Using shorthand for match *)
let rec printList3 = function
    | []     -> ()
    | h :: t -> printfn "%A" h
                printList3 t
 
(* Or, using a higher-order function *)
let printlist4 lst = List.iter (printfn "%A") lst

Did somebody break this part in purpose? —Preceding unsigned comment added by 149.169.164.142 (talk) 20:50, 25 April 2011 (UTC)[reply]

this entire 4-examples on printing a list doesn't really add any value -- the other examples already show both recursive and iterative ways or writing fibonacci 173.165.30.89 (talk) 01:33, 10 March 2012 (UTC)[reply]

Why is this article about ML?[edit]

Most of this article sounds as if an article about ML in general had been taken and had all instances of ML replaced with F#. Even half of the examples might as well be OCaml examples. Perhaps it would be better if half this article were thrown out and the remains were merged into a subsection of OCaml? It seems like it would fit well alongside MetaOCaml. Aij (talk) 21:09, 26 July 2011 (UTC)[reply]

Broken External Link[edit]

The link to the F# Survival Guide is broken (all other links I can find, including the corresponding link on Microsoft's F# site, appear to be broken too, so it looks as if this web book is not currently available). Digitig (talk) 23:52, 20 October 2011 (UTC)[reply]

Extended type system[edit]

The article currently says "The F# extended type system is implemented as generic .NET types". IMHO this is at best unclear, and at worst plain wrong. You can write both polymorphic and non-polymorphic types in F#, the type system is pretty much the same as any other statically typed language in .NET. And why does it say "implemented"? What does implementation have to do? — Preceding unsigned comment added by Mausch11 (talkcontribs) 15:51, 3 August 2012 (UTC)[reply]

Extending syntax[edit]

"F# also allows extending the syntax to support embedding custom domain-specific languages within the F# language itself.". The F# syntax does allow easy implementations of EDSLs, but F# does not allow syntax extensions. Examples of syntax extensions would be Nemerle's macros, Camlp4 and Template Haskell. F# does not have anything like that. Mausch11 (talk) 15:55, 3 August 2012 (UTC)[reply]

primes code example[edit]

This code is incredibly inefficient. It uses a separate sieve of Eratosthenes for every number in the range, making it O(n*sqrt(n)*m) where m is the range size, instead of O(sqrt(n)*m). Terrible illustration of the parallelism features. — Preceding unsigned comment added by Geoffroy Carrier (talkcontribs) 11:38, 20 January 2013 (UTC)[reply]

Latest stable release was not in 2012[edit]

http://blogs.msdn.com/b/fsharpteam/archive/2013/11/28/announcing-the-f-3-1-compiler-library-code-drop-from-the-visual-f-tools-team-at-microsoft.aspx — Preceding unsigned comment added by 60.241.96.32 (talk) 23:51, 11 January 2014 (UTC)[reply]

Hash tables as an Imperative Language Feature?[edit]

On the one hand, I'm glad that the dict keyword was mentioned since I didn't know about it. But why is it listed as an imperative feature? After all, the resulting IDictionary is readonly and therefore it's basically a kind of function declaration.Noblethrasher (talk) 04:38, 14 February 2014 (UTC)[reply]

Add Q Sharp to list of influenced languages[edit]

Microsoft recently released the Q# language (https://en.wikipedia.org/wiki/Q_Sharp), the syntax of which was modeled primarily on F# — Preceding unsigned comment added by Pheidias (talkcontribs) 17:49, 31 January 2018 (UTC)[reply]