--
You received this message because you are subscribed to the Google Groups "codeworld-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codeworld-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to codeworld-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codeworld-discuss/de0556a9-d19a-4283-a63d-ae4cb3c6104b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Right, you don't get map or filter in the standard library, without using the full prelude. The replacement (as you suggest) is list comprehensions. So instead of `map circle numbers`, you'd say `[ circle(n) | n <- numbers ]`.I use this because it's similar to set comprehensions in mathematics, and it can be generalized to multiple parameters without writing lambdas (which are just as cryptic as list comprehensions!). The second point is more significant than you might think as a Haskell programmer: without partial application (due to uncurried functions), map becomes a lot harder to use.That all being said, I'd be okay with an optional exposed module in codeworld-base to re-introduce maps, filters, and folds. (The existing "combined" function is a fold, but it's a limited one.) Feel free to send a pull request for that.
On Mon, Feb 27, 2017 at 7:53 AM, Gergely Mészáros <meszaros...@gmail.com> wrote:
Hi code.worder users and creators,
I'm Gergely Mészáros from Hungary and I like to express my gratitude to the author. It seems to be a project just I was looking for.
However, tinkering with code.word I was wondering why I can not map things. To my limited understanding (f)mapping is very basic operation in functional languages and I miss it very much.
I understand that the language tries to be simple. However excluding mapping actually makes the language more difficult to understand (imho).
For example I'd like to show to my kids how to transform a bunch of numbers to bunch of circles:
main = drawingOf (pictures circles)
numbers = [ 1..10 ]
circles = map circle numbers
Ooo.. so map is something what makes a bunch of this from bunch of that! Clean and simple. Or I can say we're applying the transformation of "circle" to my numbers. In line with the other functions I could use the uncurried version like map(circle, numbers).
Without map, I'm lost. Of course I could use list comprehensions or define my map as map f xs = [ f x | x<-xs ] but I see this much-much less trivial. I see [ circle number | number <- numbers ] is quite cryptic for a newcomer (not to mention it's less generic).
What is the official solution to get my maps? Can I import some module?
I'd rather stick with the kid's version without the full prelude (code.world/haskell).
--
You received this message because you are subscribed to the Google Groups "codeworld-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codeworld-disc...@googlegroups.com.
To post to this group, send email to codeworl...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to codeworld-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to codeworld-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codeworld-discuss/d65eb597-5eff-4b3c-acaf-22a94d3d211d%40googlegroups.com.