ЗП
Size: a a a
ЗП
ЗП
depths :: forall f a. Functor f => Foldable f => Cofree f a -> Cofree (EnvT a f) Int
depths = synthCata depthAlg
ЗП
cotree :: Cofree Array Int
cotree =
1 :<
[ 2 :<
[ 4 :<
[ 5 :<
[ 6 :< [ 7 :< [] ] ]
]
]
, 3 :<
[ 40 :< []
, 50 :< []
]
]
ЗП
> depth cotree
6
ЗП
ЗП
> log $ unlines $ draw $ depths cotree
6
|
+- 5
| |
| `- 4
| |
| `- 3
| |
| `- 2
| |
| `- 1
|
`- 2
|
+- 1
|
`- 1
ЗП
> log $ unlines $ draw $ depthsWithData cotree
(Tuple 1 6)
|
+- (Tuple 2 5)
| |
| `- (Tuple 4 4)
| |
| `- (Tuple 5 3)
| |
| `- (Tuple 6 2)
| |
| `- (Tuple 7 1)
|
`- (Tuple 3 2)
|
+- (Tuple 40 1)
|
`- (Tuple 50 1)
ЗП
ЗП
ЗП
ЗП
GP
gen n m= traverse (\_ -> randomInt 1 m) [1 .. n]
GP
VY
-unfoldable и в -listsGP
KV
-listsGP
import Data.List.Lazy(replicateM, List)заипортил лист лейзи, правильно понимаю что на выходе будет структура аля генераторы в js?
VY
GP