If you don't use a list,

Asked 2 years ago, Updated 2 years ago, 67 views

hogen=[(x,y)|x<-[-n..n],y<-[-n..n]]]

How can I write this function without using list inclusion?

haskell

2022-09-30 21:24

1 Answers

If you want to use the list as an application,

hogen=(\xy->(x,y))<$>[-n..n]<*>[-n..n]

If you want to use it as a monad

hogen=dox<-[-n..n]
            y<-[-n..n]
            return(x,y)

can be written as


2022-09-30 21:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.