hogen=[(x,y)|x<-[-n..n],y<-[-n..n]]]
How can I write this function without using list inclusion?
haskell
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
© 2024 OneMinuteCode. All rights reserved.