Skip to main content

Questions tagged [f#]

F# is a succinct, expressive and efficient functional and object-oriented language for .NET which helps you write simple code to solve complex problems.

f#
0 votes
1 answer
35 views

Simple DiffSharp example

How to convert this simple PyTorch snippet to DiffSharp? It's supposed to be similar but many functions are not to be found. # Define tensors with requires_grad=True to track computation history x = ...
Loco Barocco's user avatar
2 votes
1 answer
68 views

How to create a new operator '=??' for field bindings in F#?

I think this is simple, but I can't get it. I wish to create a new operator, e.g. (=??) , that can be used like '=' for property field bindings. That is the new operator will be used like: MyProperty =...
Alan Wayne's user avatar
  • 5,305
1 vote
1 answer
32 views

How to print examples when asked for --help in F# argu

Using this SO answer I can print info for all CLI options. How can I add an Examples section after --help is printed? Extending Argu's tutorial I would like to print the below on --help: USAGE: gadget....
inwenis's user avatar
  • 387
1 vote
0 answers
48 views

Why doesn't F# inline this inner function?

I have this active pattern: [<return: Struct>] let (|Integer|_|) self = let rec loop acc (isNegative: bool) self = match self with | C(digit, tail) when (...
Gabriel's user avatar
  • 11
0 votes
0 answers
38 views

Exception when converting an F# quotation to Lambda expression

This code is meant to execute a F# Query against an EF DbContext, using quotations to isolate the repeating let db() = serviceProvider.CreateScope().ServiceProvider.GetRequiredService<IMyDbContext&...
Franco Tiveron's user avatar
0 votes
2 answers
51 views

One at a time async in F#?

What is a good approach to wrapping an Async<'t> such that only one of them can run at a time? I have come up with a solution using MailboxProcessor although I wonder if a more lightweight ...
sdgfsdh's user avatar
  • 36k
5 votes
2 answers
79 views

How to iterate over ReadOnlySpan in F#?

You can get Spans via System.Memory to.NET Standard 2.0 compatible libraries. But how do you do this the most efficiently in F#: let myRsp = "test1".AsSpan() let test = Seq.forall (fun x -&...
Tuomas Hietanen's user avatar
-1 votes
0 answers
39 views

F# and XSLT Return matches found

I am a Novice at F# and am trying to understand code from a colleague. Below is a picture of the html Response. As you can see "lblMatchesFound" is 11. How would I code this to return the ...
EngineerRegex's user avatar
1 vote
0 answers
36 views

Parsing numbers with a comma decimal separator with FParsec

Is it possible to use FParsec's built-in parsers for numbers (e.g. pfloat, numberLiteral) with different culture settings and parse numbers with a comma as a decimal separator? And if not, what would ...
harmen's user avatar
  • 173
0 votes
1 answer
53 views

Error when using SQLProgrammabilityProvider when connecting to Azure?

in our project we have been using the SQLProgrammabilityProvider for quite a while now. However when we try to build now when having our Azure SQL DB connection string in the code we get the following ...
Glenn's user avatar
  • 35
2 votes
0 answers
104 views

F# discriminated unions simple use raises AOT and trimming warnings on publish

F#, .NET 8 console app with DUs generates AOT & trimming warnings even for simple usage. I am creating an F#, .NET 8 (SDK 8.0.302) console app and publish as a single file with AOT, trimming. I ...
tl-dr's user avatar
  • 21
1 vote
1 answer
32 views

How can ConditionalWeakTable be used with multiple references?

ConditionalWeakTable represents a thread-safe way to attach references to other references and not have to worry about garbage collection of the attached references. However, it can only be used with ...
cmeeren's user avatar
  • 4,140
0 votes
0 answers
29 views

How to make complex spa with fable feliz?

I am newbie in web dev, but I need fast dev medium level app. On start i confused how to compose react components with router and other components with props. Master pager(layouts,menu), theme(dark|...
Александр Вареник's user avatar
3 votes
1 answer
253 views

How do I use `DateTimeOffset`s to show 23 or 25 hours on a day when clocks change?

New York switched from Eastern Standard Time to Eastern Daylight Time on March 10th, 2024. I believe the time zone ID "Eastern Standard Time" maps to "America/New_York" in .NET. ...
capitalistcuttle's user avatar
0 votes
1 answer
42 views

How to catch printing errors from background thread in Elmish/F#

I have a print function in F# that uses an STA thread: let PrintProgressNoteAsync (encounterid:int) = async { let mutable printmsg = null let ...
Alan Wayne's user avatar
  • 5,305

15 30 50 per page
1
2 3 4 5
1135