Code Monkey home page Code Monkey logo

fsharpaux's People

Contributors

caroott avatar doganck avatar forki avatar freymaurer avatar hlweil avatar kmutagene avatar muehlhaus avatar omaus avatar thorium avatar zimmerd avatar

Stargazers

 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

fsharpaux's Issues

[Feature Request] Set functions of basic collections

Description

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).

Inproper exception when `JaggedArray`/`JaggedList.transpose` is used on arrays/lists with different lengths

Description

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.

Repro steps

  1. Run this exemplary code snippet:
JaggedList.transpose [[1;2;3]; [4;5]]
JaggedArray.transpose [|[|1;2;3|]; [|4;5|]|]
  1. See errors.

Expected behavior

Throws an exception that tells the user that array/list elements are varying in length.

Actual behavior

Throws following exceptions:
System.ArgumentException: The input list was empty. (Parameter 'list'), resp.
System.IndexOutOfRangeException: Index was outside the bounds of the array..

FSharpAux.IO.SeqIO.Seq.CSV: Incorrect collection formatting

Description

The FSharpAux.IO.SeqIO.Seq.CSV function with the parameter flatten = false, does not perform as intended.

Repro steps

  1. Define a Record type with a field of type array.
  2. FSharpAux.IO.SeqIO.Seq.CSV function with the parameter flatten = false, using an instance of your type with an array of Length > 20.
  3. Look at the string.

Expected behavior

Nicely formatted output.

Actual behavior

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.

Known workarounds

FSharpAux.IO.SeqIO.Seq.CSV calls FSharpAux.IO.SeqIO.Seq.CSVwith. Simply replace the parameter strFunction with a version that does the formatting correctly.

[BUG] `String.first` and `String.last` raise `IndexOutOfRangeException` when applied to empty strings

Description

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.

Repro steps

Please provide the steps required to reproduce the problem

  1. Write
String.first ""
String.last ""
  1. Execute

Expected behavior

Proper error message.

Actual behavior

System.IndexOutOfRangeException.

Rename request :)

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

`map4`

Description

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.

[BUG] Random number generators in shuffle functions are not random.

Description

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.

Repro steps

for i=0 to 10 do
printfn "%A" (Array.shuffleFisherYates [|0 .. 10|])

Solution

Provide the random number generator as parameter and define it outside the loop.

Check if FSharpAux is Fable compatible

Description

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.endsWith`

Description

String.startsWith is already there, but its counterpart, String.endsWith, is missing.

[Bug] shuffle functions modify input data

Description

The shuffle functions assign the shuffled values to the original input data.

affected modules:

  • JaggedArray
  • Array2D
  • Array

affected functions:

  • shuffle
  • shuffleRowWise
  • shuffleColumnWise

Expected behavior

The input Array/Array2D/JaggedArray must not be modified.

Solution

The input data has do be copied before shuffling.

Function to get `Dictionary` items

Description

A lot of times we use self-built functions to access Dictionary items [1][2][3][4][5]. Thus, it might be nice to have them available as packages so we don't need to write them every time in any of our libraries.

[BUG] `Array.groupWhen` returns an empty array if the predicate never returns `true`

Description

Array.groupWhen returns an empty array if the predicate never returns true.

Repro steps

  1. Use this exemplary code in a script environment:
let isOdd = n % 2 <> 0
Array.groupWhen isOdd [|4;4;2;4;0;2|]
  1. Run the code

Expected behavior

Returns [|[|4;4;2;4;0;2|]|]

Actual behavior

Returns [|[||]|]

Known workarounds

Introduce a case where the predicate returns true. Not well applicable.

Related information

  • Operating system: Win10 Home64bit
  • main
  • .NET Runtime, CoreCLR or Mono Version: 5.0.403

[BUG] `Seq.groupWhen` returning incorrect results

Description

Seq.groupWhen returns incorrect results under specific circumstances (s. below).

Repro steps

  1. Copy
#r "nuget: FSharpAux"
open FSharpAux

let testArr = [|
    3
    3
    2
    4
    1
    2
    1
|]

let isOdd n = n % 2 <> 0

Seq.groupWhen isOdd testArr
  1. Execute

Expected behavior

val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2]; [1]]

Actual behavior

val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2; 1]]

Last item is not grouped alone even if it should be.

Known workarounds

n/a

Related information

  • Win10-64bit Pro
  • main
  • .NET Core 5.0.403

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.