diff --git a/src/Push.hs b/src/Push.hs index 326347e..8e1a1fa 100644 --- a/src/Push.hs +++ b/src/Push.hs @@ -78,5 +78,7 @@ intAdd state = -- applyFuncState :: AtomicFuncTypes -> State -> State -- this would change Gene to something like GeneModular above. +-- Wow, a one-liner for interpreting a paretheses-free genome... +-- Need to update this when adding parethetical blocks too. interpretGenome :: State -> [(State -> State)] -> State interpretGenome state = foldl (\acc f -> f acc) state diff --git a/src/main.hs b/src/main.hs index 129c5ce..a6c4f4d 100644 --- a/src/main.hs +++ b/src/main.hs @@ -14,7 +14,7 @@ main = do string = [StringGene "Hello", StringGene "Push"], input = [Input $ IntGene 1, Input $ StringGene "Hi", Input $ BoolGene True, Input $ FloatGene 1.3] } - -- This is an example of applynig one function (head exampleGenome) to the exampleState: + -- This is an example of applying one function (head exampleGenome produces intAdd) to the exampleState: assert ([3, 3] == map unpackIntGene (int (head exampleGenome exampleState))) pure () - -- This one-liner applies an entire genome to the starting state, and produces the final state: + -- This function applies an entire genome to the starting state, and produces the final state: assert ([6] == (map unpackIntGene (int (interpretGenome exampleState exampleGenome)))) pure ()