Open jmagaram opened 6 years ago
Actually I’m realizing now how easy it is to create an iterable using the function* syntax. So maybe there is not much need for unfold, range, init, repeat, and other ways of creating an iterable in your library.
Wouldn't unfold
just be equivalent to a map
function?
I think init
/initInfinite
would be covered with a function*
generator function, yes.
Right now I'm just adding modules as I need them, but I'm open to ideas. I'm taking the .NET Framework and lodash as inspirations.
No. Unfold is like the inverse of fold. Take an initial state and from that generate a sequence, each time generating a new item to be emitted and the next state. Probably can do that with custom generators. Some good inspiration here too.
https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/collections.seq-module-%5Bfsharp%5D
From: Sean Genabe notifications@github.com Sent: Tuesday, May 29, 2018 4:35:07 AM To: seangenabe/starry Cc: Justin Magaram; Author Subject: Re: [seangenabe/starry] any basic generators? (#23)
Wouldn't unfold just be equivalent to a map function?
I think init/initInfinite would be covered with a function* generator function, yes.
Right now I'm just adding modules as I need them, but I'm open to ideas. I'm taking the .NET Framework and lodash as inspirations.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/seangenabe/starry/issues/23#issuecomment-392745111, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANecS-fbB6GVLWfqiWfpfa-c8tZlA4jWks5t3TJrgaJpZM4T-Xvm.
Does the library have any basic generators, like "the numbers from 1 to 1000"? This would be a nice addition. Check out F# Seq module. Some basic generators like...
unfold init initInfinite
...would go a long way. Here is an unfold implementation...