csbiology / fsharpaux Goto Github PK
View Code? Open in Web Editor NEWAuxiliary functions and data structures for the F# programming language
License: MIT License
Auxiliary functions and data structures for the F# programming language
License: MIT License
Set functions on basic collections (Sequence, Array, List) would be appreciated in cases where these basic collections cannot be converted to Sets (i.e. when the type does not support comparison constraint).
When calling JaggedArray.transpose
or JaggedList.transpose
on arrays resp. lists with differently long arrays/lists inside, an exception is thrown. But this exception does not help detect the problem in a, say, long pipeline.
JaggedList.transpose [[1;2;3]; [4;5]]
JaggedArray.transpose [|[|1;2;3|]; [|4;5|]|]
Throws an exception that tells the user that array/list elements are varying in length.
Throws following exceptions:
System.ArgumentException: The input list was empty. (Parameter 'list')
, resp.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
.
The template has not been adapted after migration. I bet the package has been causing problems for that reason ๐คฆโโ
The FSharpAux.IO.SeqIO.Seq.CSV function with the parameter flatten = false, does not perform as intended.
Nicely formatted output.
The array is spread accross mutliple lines if it exceeds a certain length. This happens because "sprintf "%A" x" is used to format collections. This introduces line-brakes into the string.
FSharpAux.IO.SeqIO.Seq.CSV calls FSharpAux.IO.SeqIO.Seq.CSVwith. Simply replace the parameter strFunction with a version that does the formatting correctly.
String.first
and String.last
return IndexOutOfRangeException
when applied to empty strings. It would be better to instead check for empty strings and throw an explicit error message.
Please provide the steps required to reproduce the problem
String.first ""
String.last ""
Proper error message.
System.IndexOutOfRangeException
.
Hi @muehlhaus et al,
Could I request that the name of this repo be adjusted? e.g. FSharp.Care to FSharp.Utilities.Care or some other second-level qualification?
Generally we always try to avoid polluting the "second level" FSharp.* namespace for F#, and instead at least qualify by a normal-looking second name.
This is covered in various discussions about package naming in the F# community, e.g. http://fsharp.github.io/2014/09/19/fsharp-libraries.html
Thanks
Don Syme
Atm., a String.trim
function is missing.
It is tedious to work with 4 enumerable collections (i.e., seqs, arrays, lists) at once without proper functions. FSharp.Core.Collections
already provides mapping functions for one, two, or three collections, yet a mapping function for four is missing.
If functions with random number generators (all shuffle functions in Array, JaggedArray, and Array2D) are used in a loop where they are called multiple times within a short time period, they yield the same result due to an identical seed.
for i=0 to 10 do
printfn "%A" (Array.shuffleFisherYates [|0 .. 10|])
Provide the random number generator as parameter and define it outside the loop.
Since FSharpAux is used in a lot of the libraries of CSBiology we should check if it is Fable-compatible since some of our libraries must work with Fable.
String.startsWith
is already there, but its counterpart, String.endsWith
, is missing.
The shuffle functions assign the shuffled values to the original input data.
The input Array/Array2D/JaggedArray must not be modified.
The input data has do be copied before shuffling.
We need to update docs. This is unacceptable :D http://csbiology.github.io/FSharpAux/
Array.groupWhen
returns an empty array if the predicate never returns true
.
let isOdd = n % 2 <> 0
Array.groupWhen isOdd [|4;4;2;4;0;2|]
Returns [|[|4;4;2;4;0;2|]|]
Returns [|[||]|]
Introduce a case where the predicate returns true. Not well applicable.
Seq.groupWhen
returns incorrect results under specific circumstances (s. below).
#r "nuget: FSharpAux"
open FSharpAux
let testArr = [|
3
3
2
4
1
2
1
|]
let isOdd n = n % 2 <> 0
Seq.groupWhen isOdd testArr
val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2]; [1]]
val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2; 1]]
Last item is not grouped alone even if it should be.
n/a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.