Closed mratsim closed 7 years ago
I've update the code with your remarks. Regarding the test case, it's only checking compilation because the output of both functions would be complicated:
List((Field0: ?, Field1: false), (Field0: s, Field1: false), (Field0: s, Field1: false), (Field0: e, Field1: true), (Field0: c, Field1: false), (Field0: c, Field1: false), (Field0: u, Field1: true), (Field0: s, Field1: false), (Field0: , Field1: false), (Field0: a, Field1: true), (Field0: , Field1: false), (Field0: t, Field1: false), (Field0: i, Field1: true), (Field0: , Field1: false), (Field0: s, Field1: false), (Field0: I, Field1: true))
List((Field0: I, Field1: true), (Field0: s, Field1: false), (Field0: , Field1: false), (Field0: i, Field1: true), (Field0: t, Field1: false), (Field0: , Field1: false), (Field0: a, Field1: true), (Field0: , Field1: false), (Field0: s, Field1: false), (Field0: u, Field1: true), (Field0: c, Field1: false), (Field0: c, Field1: false), (Field0: e, Field1: true), (Field0: s, Field1: false), (Field0: s, Field1: false), (Field0: ?, Field1: false))
Thank you.
Hello vegansk.
Here is a PR for
UnfoldRight
andUnfoldLeft
functionsI've also written two accompagnying tests: Splitting 12301230 into its digits in normal order (unfoldLeft) and reverse order (unfoldRight)
I've added the
{. inline .}
pragma as Haskell as a really long comment about it.I don't have a benchmark to check performance on Nim though.