You have a graph where the nodes are in groups. You want to create edges between all nodes that are in different groups.
For example, given the following groups:
[[1, 2], [3], [4, 5]]
view : Model -> Html Msg | |
view model = | |
div [] | |
[ div [ class "icon" ] [ span [class "icon-profile" ] [] ] | |
, div [ class "icon" ] [ span [ class "icon-clock" ] [] ] | |
] | |
-- REFACTOR TO | |
view : Model -> Html Msg |
class NonEmptyArray | |
include Enumerable | |
def initialize(first, rest) | |
@first = first | |
@rest = rest | |
end | |
def first | |
@first |
class Hamming | |
def self.zip_count(s1, s2) | |
s1.chars. | |
zip(s2.chars). | |
count { |c1, c2| c1 != c2 } | |
end | |
def self.for_loop(s1, s2) | |
distance = 0 |
class Hamming | |
def self.eager(s1, s2) | |
s1.chars. | |
zip(s2.chars). | |
count { |c1, c2| c1 != c2 } | |
end | |
def self.half_lazy(s1, s2) | |
s1.each_char. | |
zip(s2.each_char). |
class Hamming | |
def self.eager(s1, s2) | |
s1.chars.take(10). | |
zip(s2.chars.take(10)). | |
count { |c1, c2| c1 != c2 } | |
end | |
def self.half_lazy_args(s1, s2) | |
s1.each_char.take(10). | |
zip(s2.each_char.take(10)). |
-- Maybe | |
map2 f v1 v2 = Just f |> andMap v1 |> andMap v2 | |
map f v1 = Just f |> andMap v1 | |
map0 f = Just f | |
-- List | |
map2 f v1 v2 = singleton f |> andMap v1 |> andMap v2 | |
map f v1 = singleton f |> andMap v1 |
-- GIVEN | |
type MyList a | |
= Cons a (MyList a) | |
| Empty | |
add : Int -> Int -> Int | |
add a b = | |
a + b |
It seemed to have stepped right out of the pages of a horror novel. The mutant shape-shifter struck without warning, defying a mere mortal's attempts to detect it. It seemed to distort the fabric of reality itself. And it was going to ruin my job interview.
We've all encountered this monster at some point. Like many classic monsters, it is our own creation. Every year it devastate projects worldwide. The fearsome mutation bug is an expert at hiding and altering your programs in subtle and