F#'s DescriptiveStatistics unknown? - f#

I am currently converting a project in F# to Python, I am a relative amateur in F#, please...what on earth does this line do...
let stats = new DescriptiveStatistics(list)
I cant find a good definition of DescriptiveStatistics anywhere! Please help!
Many thanks

That is very likely from MathNet.
Check the beginning of your F# for the line:
using MathNet.Numerics.Statistics;

https://numerics.mathdotnet.com/DescriptiveStatistics.html
"...in case you need to gather a whole set of statistical characteristics in one pass, is provided by the DescriptiveStatistics class:..." Thanks for your help guys

Related

F# equivalent of SortedDictionary from C#

new to F#
i need to store a bunch of lists of objects according to a float number where the collection of lists are sorted according to the float number. I know in C# i would use
SortedDictionary<float, List<obj>>
as the implementation is a red black tree, allowing for log(n) insert and search. But whats the best way to attack the situation in F#. I attempted to use SortedDitionary but i can't refer to SortedDictionary[int] to find the value so it renders it as useless essentially (i could be doing it wrong).
thanks for the help
The syntax is
sorteddictionary.[int]
then it works as you would expect
The first thig to do is read Okasaki's book Purely Functional Data Structures
It has ML implementations that may help you
You can use sorteddictionary.[int] as John Palmer already said but it may be worth pointing out that the F# standard library includes a purely functional sorted dictionary collection called Map.

do record_info and tuple_to_list return the same key order in Erlang?

I.e, if I have a record
-record(one, {frag, left}).
Is record_info(fields, one) going to always return [frag,
left]?
Is tl(tuple_to_list(#one{frag = "Frag", left = "Left"}))
always gonna be ["Frag", "Left"]?
Is this an implementation detail?
Thanks a lot!
The short answer is: yes, as of this writing it will work. The better answer is: it may not work that way in the future, and the nature of the question concerns me.
It's safe to use record_info/2, although relying on the order may be risky and frankly I can't think of a situation where doing so makes sense which implies that you are solving a problem the wrong way. Can you share more details about what exactly you are trying to accomplish so we can help you choose a better method? It could be that simple pattern matching is all you need.
As for the example with tuple_to_list/1, I'll quote from "Erlang Programming" by Cesarini and Thompson:
"... whatever you do, never, ever use the tuple representations of records in your programs. If you do, the authors of this book will disown you and deny any involvement in helping you learn Erlang."
There are several good reasons why, including:
Your code will become brittle - if you later change the number of fields or their order, your code will break.
There is no guarantee that the internal representation of records will continue to work this way in future versions of erlang.
Yes, order is always the same because records represented by tuples for which order is an essential property. Look also on my other answer about records with examples: Syntax Error while accessing a field in a record
Yes, in both cases Erlang will retain the 'original' order. And yes it's implementation as it's not specifically addressed in the function spec or documentation, though it's a pretty safe bet it will stay like that.

Haskell function to parse a string and return any urls found

What I've been looking for is the function in the title. I could write something in parsec, but before I do, anyone know of anything like this?
Thanks for your help!
You might find this useful: http://johnmacfarlane.net/pandoc/scripting.html#queries-listing-urls
I think regexes are a better tool for the job. Parsec is good when the whole document has a rigid syntax -- regexes are good for finding well-formed data within random trash.
Here's one (I haven't checked it).
There is an out-of-the-box Megaparsec solution for this now. Combine
Text.URI.parser
with
Replace.Megaparsec.sepCap.

typeset problem/solution pair (example) in latex

I'd like to know if there is a way in latex to show the following:
Example 1: problem statement here
Solution: solution here
and wrap that in a box so that it will be noticeable.
Seems like a common enough problem that there should be ready made solutions
If there are any suggestions it would be much appreciated!
This can be done using the exercise package. For more information, look at the manual or a previous topic on this subject. A (modified) example from the manual:
\begin{ExerciseList}
\Exercise Discuss\ldots
\Answer $\ldots$
\end{ExerciseList}

infix to postfix conversion and evaluation

I have a complex problem, I am getting formulas form the database and I need to evaluate them. I choose to convert them to post fix...and evaluate them the problem is that..
my formulas are like
roundoff(vd,2);
udV=lookup(uv*dse,erd);
ude=if(er>es)?sr:ss;
Can anyone find a solution for these type of conversions and evaluations...
No, not without some more clarification from you. Perhaps you could tell us what sort of technology you are using and what some, at least, of your functions mean. As it stands I recommend that you use Mathematica because it's probably powerful enough to tackle this type of problem. If you don't have access to Mathematica, perhaps you could hook in to Wolfram Alpha for evaluations.

Resources