lomeo: (лямбда)
[personal profile] lomeo
Клёвая реализация сабжа от [livejournal.com profile] antilamer:
data Tree a = Nil | Branch (Tree a) a (Tree a)

bfs t = [x | Branch _ x _ <- b]
  where
    b = t:[x | Branch l _ r <- b, x <- [l,r]]

Ленивость, все дела.

отсюда.

Date: 2011-12-21 04:36 pm (UTC)
From: [identity profile] lionet.livejournal.com
Ошибка, там t а не b в конце.

Profile

lomeo: (Default)
Dmitry Antonyuk

April 2024

S M T W T F S
 123456
7891011 1213
14151617181920
21222324252627
282930    

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 22nd, 2025 05:13 pm
Powered by Dreamwidth Studios