move the state parameter to final position in all functions
This commit is contained in:
parent
0b280af591
commit
ff31a8fa35
2
TODO.md
2
TODO.md
@ -11,7 +11,7 @@
|
||||
- [X] Rename Logical to Bool
|
||||
- [X] Make int yank, shove, yankdup, and shovedup generic
|
||||
- [ ] Write hackage documentation for each function
|
||||
- [ ] Refactor all functions to take state as the final parameter
|
||||
- [X] Refactor all functions to take state as the final parameter
|
||||
- [ ] Standardize the pattern matching parameter names, such as c1 : cs
|
||||
- [ ] Write unit/quickcheck tests for all of the instructions
|
||||
|
||||
|
@ -40,43 +40,43 @@ instructionBoolXor :: State -> State
|
||||
instructionBoolXor = boolTemplate xor
|
||||
|
||||
instructionBoolPop :: State -> State
|
||||
instructionBoolPop state = instructionPop state bool
|
||||
instructionBoolPop = instructionPop bool
|
||||
|
||||
instructionBoolDup :: State -> State
|
||||
instructionBoolDup state = instructionDup state bool
|
||||
instructionBoolDup = instructionDup bool
|
||||
|
||||
instructionBoolDupN :: State -> State
|
||||
instructionBoolDupN state = instructionDupN state bool
|
||||
instructionBoolDupN = instructionDupN bool
|
||||
|
||||
instructionBoolSwap :: State -> State
|
||||
instructionBoolSwap state = instructionSwap state bool
|
||||
instructionBoolSwap = instructionSwap bool
|
||||
|
||||
instructionBoolRot :: State -> State
|
||||
instructionBoolRot state = instructionRot state bool
|
||||
instructionBoolRot = instructionRot bool
|
||||
|
||||
instructionBoolFlush :: State -> State
|
||||
instructionBoolFlush state = instructionFlush state bool
|
||||
instructionBoolFlush = instructionFlush bool
|
||||
|
||||
instructionBoolEq :: State -> State
|
||||
instructionBoolEq state = instructionEq state bool
|
||||
instructionBoolEq = instructionEq bool
|
||||
|
||||
instructionBoolStackDepth :: State -> State
|
||||
instructionBoolStackDepth state = instructionStackDepth state bool
|
||||
instructionBoolStackDepth = instructionStackDepth bool
|
||||
|
||||
instructionBoolYank :: State -> State
|
||||
instructionBoolYank state = instructionYank state bool
|
||||
instructionBoolYank = instructionYank bool
|
||||
|
||||
instructionBoolYankDup :: State -> State
|
||||
instructionBoolYankDup state = instructionYankDup state bool
|
||||
instructionBoolYankDup = instructionYankDup bool
|
||||
|
||||
instructionBoolShove :: State -> State
|
||||
instructionBoolShove state = instructionShove state bool
|
||||
instructionBoolShove = instructionShove bool
|
||||
|
||||
instructionBoolShoveDup :: State -> State
|
||||
instructionBoolShoveDup state = instructionShoveDup state bool
|
||||
instructionBoolShoveDup = instructionShoveDup bool
|
||||
|
||||
instructionBoolIsStackEmpty :: State -> State
|
||||
instructionBoolIsStackEmpty state = instructionIsStackEmpty state bool
|
||||
instructionBoolIsStackEmpty = instructionIsStackEmpty bool
|
||||
|
||||
instructionBoolDupItems :: State -> State
|
||||
instructionBoolDupItems = instructionDupItems bool
|
||||
|
@ -13,13 +13,13 @@ instructionCharConcat state@(State {_char = c1 : c2 : cs, _string = ss}) = state
|
||||
instructionCharConcat state = state
|
||||
|
||||
instructionCharFromFirstChar :: State -> State
|
||||
instructionCharFromFirstChar state = instructionVectorFirst state char string
|
||||
instructionCharFromFirstChar = instructionVectorFirst char string
|
||||
|
||||
instructionCharFromLastChar :: State -> State
|
||||
instructionCharFromLastChar state = instructionVectorLast state char string
|
||||
instructionCharFromLastChar = instructionVectorLast char string
|
||||
|
||||
instructionCharFromNthChar :: State -> State
|
||||
instructionCharFromNthChar state = instructionVectorNth state char string
|
||||
instructionCharFromNthChar = instructionVectorNth char string
|
||||
|
||||
instructionCharIsWhitespace :: State -> State
|
||||
instructionCharIsWhitespace state@(State {_char = c1 : cs, _bool = bs}) = state{_char = cs, _bool = (c1 `elem` wschars) : bs}
|
||||
@ -50,43 +50,43 @@ instructionCharsFromString state@(State {_char = cs, _string = s1 : ss}) = state
|
||||
instructionCharsFromString state = state
|
||||
|
||||
instructionCharPop :: State -> State
|
||||
instructionCharPop state = instructionPop state char
|
||||
instructionCharPop = instructionPop char
|
||||
|
||||
instructionCharDup :: State -> State
|
||||
instructionCharDup state = instructionDup state char
|
||||
instructionCharDup = instructionDup char
|
||||
|
||||
instructionCharDupN :: State -> State
|
||||
instructionCharDupN state = instructionDupN state char
|
||||
instructionCharDupN = instructionDupN char
|
||||
|
||||
instructionCharSwap :: State -> State
|
||||
instructionCharSwap state = instructionSwap state char
|
||||
instructionCharSwap = instructionSwap char
|
||||
|
||||
instructionCharRot :: State -> State
|
||||
instructionCharRot state = instructionRot state char
|
||||
instructionCharRot = instructionRot char
|
||||
|
||||
instructionCharFlush :: State -> State
|
||||
instructionCharFlush state = instructionFlush state char
|
||||
instructionCharFlush = instructionFlush char
|
||||
|
||||
instructionCharEq :: State -> State
|
||||
instructionCharEq state = instructionEq state char
|
||||
instructionCharEq = instructionEq char
|
||||
|
||||
instructionCharStackDepth :: State -> State
|
||||
instructionCharStackDepth state = instructionStackDepth state char
|
||||
instructionCharStackDepth = instructionStackDepth char
|
||||
|
||||
instructionCharYank :: State -> State
|
||||
instructionCharYank state = instructionYank state char
|
||||
instructionCharYank = instructionYank char
|
||||
|
||||
instructionCharYankDup :: State -> State
|
||||
instructionCharYankDup state = instructionYankDup state char
|
||||
instructionCharYankDup = instructionYankDup char
|
||||
|
||||
instructionCharIsStackEmpty :: State -> State
|
||||
instructionCharIsStackEmpty state = instructionIsStackEmpty state char
|
||||
instructionCharIsStackEmpty = instructionIsStackEmpty char
|
||||
|
||||
instructionCharShove :: State -> State
|
||||
instructionCharShove state = instructionShove state char
|
||||
instructionCharShove = instructionShove char
|
||||
|
||||
instructionCharShoveDup :: State -> State
|
||||
instructionCharShoveDup state = instructionShoveDup state char
|
||||
instructionCharShoveDup = instructionShoveDup char
|
||||
|
||||
instructionCharDupItems :: State -> State
|
||||
instructionCharDupItems = instructionDupItems char
|
||||
|
@ -83,7 +83,7 @@ codeRecursiveSize (Block xs) = sum [codeRecursiveSize x + if isBlock x then 1 el
|
||||
codeRecursiveSize _ = 1
|
||||
|
||||
instructionCodePop :: State -> State
|
||||
instructionCodePop state = instructionPop state code
|
||||
instructionCodePop = instructionPop code
|
||||
|
||||
instructionCodeIsCodeBlock :: State -> State
|
||||
instructionCodeIsCodeBlock state@(State {_code = (c : cs), _bool = bs}) = state {_code = cs, _bool = isBlock c : bs}
|
||||
@ -221,9 +221,6 @@ instructionCodeSize :: State -> State
|
||||
instructionCodeSize state@(State {_code = c1 : cs, _int = is}) = state{_code = cs, _int = codeRecursiveSize c1 : is}
|
||||
instructionCodeSize state = state
|
||||
|
||||
-- instructionCodeContainer :: State -> State
|
||||
-- instructionCodeContainer
|
||||
|
||||
-- There's a bug for this instruction in pysh where the last item in the
|
||||
-- top level Block isn't counted, and if passed 0, then the entire codeblock is returned.
|
||||
-- I designed this function differently so 0 returns the 0th element, and the last item
|
||||
@ -268,73 +265,73 @@ instructionCodeReverse state@(State {_code = (Block c1) : cs}) = state {_code =
|
||||
instructionCodeReverse state = state
|
||||
|
||||
instructionCodeDup :: State -> State
|
||||
instructionCodeDup state = instructionDup state code
|
||||
instructionCodeDup = instructionDup code
|
||||
|
||||
instructionCodeDupN :: State -> State
|
||||
instructionCodeDupN state = instructionDupN state code
|
||||
instructionCodeDupN = instructionDupN code
|
||||
|
||||
instructionCodeSwap :: State -> State
|
||||
instructionCodeSwap state = instructionSwap state code
|
||||
instructionCodeSwap = instructionSwap code
|
||||
|
||||
instructionCodeRot :: State -> State
|
||||
instructionCodeRot state = instructionRot state code
|
||||
instructionCodeRot = instructionRot code
|
||||
|
||||
instructionCodeFlush :: State -> State
|
||||
instructionCodeFlush state = instructionFlush state code
|
||||
instructionCodeFlush = instructionFlush code
|
||||
|
||||
instructionCodeEq :: State -> State
|
||||
instructionCodeEq state = instructionEq state code
|
||||
instructionCodeEq = instructionEq code
|
||||
|
||||
instructionCodeStackDepth :: State -> State
|
||||
instructionCodeStackDepth state = instructionStackDepth state code
|
||||
instructionCodeStackDepth = instructionStackDepth code
|
||||
|
||||
instructionCodeYank :: State -> State
|
||||
instructionCodeYank state = instructionYank state code
|
||||
instructionCodeYank = instructionYank code
|
||||
|
||||
instructionCodeYankDup :: State -> State
|
||||
instructionCodeYankDup state = instructionYankDup state code
|
||||
instructionCodeYankDup = instructionYankDup code
|
||||
|
||||
instructionCodeIsStackEmpty :: State -> State
|
||||
instructionCodeIsStackEmpty state = instructionIsStackEmpty state code
|
||||
instructionCodeIsStackEmpty = instructionIsStackEmpty code
|
||||
|
||||
instructionCodeShove :: State -> State
|
||||
instructionCodeShove state = instructionShove state code
|
||||
instructionCodeShove = instructionShove code
|
||||
|
||||
instructionCodeShoveDup :: State -> State
|
||||
instructionCodeShoveDup state = instructionShoveDup state code
|
||||
instructionCodeShoveDup = instructionShoveDup code
|
||||
|
||||
instructionCodeFromBool :: State -> State
|
||||
instructionCodeFromBool state = instructionCodeFrom state bool GeneBool
|
||||
instructionCodeFromBool = instructionCodeFrom bool GeneBool
|
||||
|
||||
instructionCodeFromInt :: State -> State
|
||||
instructionCodeFromInt state = instructionCodeFrom state int GeneInt
|
||||
instructionCodeFromInt = instructionCodeFrom int GeneInt
|
||||
|
||||
instructionCodeFromChar :: State -> State
|
||||
instructionCodeFromChar state = instructionCodeFrom state char GeneChar
|
||||
instructionCodeFromChar = instructionCodeFrom char GeneChar
|
||||
|
||||
instructionCodeFromFloat :: State -> State
|
||||
instructionCodeFromFloat state = instructionCodeFrom state float GeneFloat
|
||||
instructionCodeFromFloat = instructionCodeFrom float GeneFloat
|
||||
|
||||
instructionCodeFromString :: State -> State
|
||||
instructionCodeFromString state = instructionCodeFrom state string GeneString
|
||||
instructionCodeFromString = instructionCodeFrom string GeneString
|
||||
|
||||
instructionCodeFromVectorInt :: State -> State
|
||||
instructionCodeFromVectorInt state = instructionCodeFrom state vectorInt GeneVectorInt
|
||||
instructionCodeFromVectorInt = instructionCodeFrom vectorInt GeneVectorInt
|
||||
|
||||
instructionCodeFromVectorFloat :: State -> State
|
||||
instructionCodeFromVectorFloat state = instructionCodeFrom state vectorFloat GeneVectorFloat
|
||||
instructionCodeFromVectorFloat = instructionCodeFrom vectorFloat GeneVectorFloat
|
||||
|
||||
instructionCodeFromVectorString :: State -> State
|
||||
instructionCodeFromVectorString state = instructionCodeFrom state vectorString GeneVectorString
|
||||
instructionCodeFromVectorString = instructionCodeFrom vectorString GeneVectorString
|
||||
|
||||
instructionCodeFromVectorBool :: State -> State
|
||||
instructionCodeFromVectorBool state = instructionCodeFrom state vectorBool GeneVectorBool
|
||||
instructionCodeFromVectorBool = instructionCodeFrom vectorBool GeneVectorBool
|
||||
|
||||
instructionCodeFromVectorChar :: State -> State
|
||||
instructionCodeFromVectorChar state = instructionCodeFrom state vectorChar GeneVectorChar
|
||||
instructionCodeFromVectorChar = instructionCodeFrom vectorChar GeneVectorChar
|
||||
|
||||
instructionCodeFromExec :: State -> State
|
||||
instructionCodeFromExec state = instructionCodeFrom state exec id
|
||||
instructionCodeFromExec = instructionCodeFrom exec id
|
||||
|
||||
instructionCodeContainer :: State -> State
|
||||
instructionCodeContainer state@(State {_code = c1 : c2 : cs}) = state {_code = findContainer c1 c2 : cs}
|
||||
|
@ -12,43 +12,43 @@ instructionExecIf state@(State {_exec = (e1 : e2 : es), _bool = (b : bs)}) =
|
||||
instructionExecIf state = state
|
||||
|
||||
instructionExecDup :: State -> State
|
||||
instructionExecDup state = instructionDup state exec
|
||||
instructionExecDup = instructionDup exec
|
||||
|
||||
instructionExecDupN :: State -> State
|
||||
instructionExecDupN state = instructionDupN state exec
|
||||
instructionExecDupN = instructionDupN exec
|
||||
|
||||
instructionExecPop :: State -> State
|
||||
instructionExecPop state = instructionPop state exec
|
||||
instructionExecPop = instructionPop exec
|
||||
|
||||
instructionExecSwap :: State -> State
|
||||
instructionExecSwap state = instructionSwap state exec
|
||||
instructionExecSwap = instructionSwap exec
|
||||
|
||||
instructionExecRot :: State -> State
|
||||
instructionExecRot state = instructionRot state exec
|
||||
instructionExecRot = instructionRot exec
|
||||
|
||||
instructionExecFlush :: State -> State
|
||||
instructionExecFlush state = instructionFlush state exec
|
||||
instructionExecFlush = instructionFlush exec
|
||||
|
||||
instructionExecEq :: State -> State
|
||||
instructionExecEq state = instructionEq state exec
|
||||
instructionExecEq = instructionEq exec
|
||||
|
||||
instructionExecStackDepth :: State -> State
|
||||
instructionExecStackDepth state = instructionStackDepth state exec
|
||||
instructionExecStackDepth = instructionStackDepth exec
|
||||
|
||||
instructionExecYank :: State -> State
|
||||
instructionExecYank state = instructionYank state exec
|
||||
instructionExecYank = instructionYank exec
|
||||
|
||||
instructionExecYankDup :: State -> State
|
||||
instructionExecYankDup state = instructionYankDup state exec
|
||||
instructionExecYankDup = instructionYankDup exec
|
||||
|
||||
instructionExecShove :: State -> State
|
||||
instructionExecShove state = instructionShove state exec
|
||||
instructionExecShove = instructionShove exec
|
||||
|
||||
instructionExecShoveDup :: State -> State
|
||||
instructionExecShoveDup state = instructionShoveDup state exec
|
||||
instructionExecShoveDup = instructionShoveDup exec
|
||||
|
||||
instructionExecIsStackEmpty :: State -> State
|
||||
instructionExecIsStackEmpty state = instructionIsStackEmpty state exec
|
||||
instructionExecIsStackEmpty = instructionIsStackEmpty exec
|
||||
|
||||
execDoRange :: Gene
|
||||
execDoRange = StateFunc (instructionExecDoRange, "instructionExecDoRange")
|
||||
|
@ -77,43 +77,43 @@ instructionFloatGTE state@(State {_float = f1 : f2 : fs, _bool = bs}) = state {_
|
||||
instructionFloatGTE state = state
|
||||
|
||||
instructionFloatPop :: State -> State
|
||||
instructionFloatPop state = instructionPop state float
|
||||
instructionFloatPop = instructionPop float
|
||||
|
||||
instructionFloatDup :: State -> State
|
||||
instructionFloatDup state = instructionDup state float
|
||||
instructionFloatDup = instructionDup float
|
||||
|
||||
instructionFloatDupN :: State -> State
|
||||
instructionFloatDupN state = instructionDupN state float
|
||||
instructionFloatDupN = instructionDupN float
|
||||
|
||||
instructionFloatSwap :: State -> State
|
||||
instructionFloatSwap state = instructionSwap state float
|
||||
instructionFloatSwap = instructionSwap float
|
||||
|
||||
instructionFloatRot :: State -> State
|
||||
instructionFloatRot state = instructionRot state float
|
||||
instructionFloatRot = instructionRot float
|
||||
|
||||
instructionFloatFlush :: State -> State
|
||||
instructionFloatFlush state = instructionFlush state float
|
||||
instructionFloatFlush = instructionFlush float
|
||||
|
||||
instructionFloatEq :: State -> State
|
||||
instructionFloatEq state = instructionEq state float
|
||||
instructionFloatEq = instructionEq float
|
||||
|
||||
instructionFloatStackDepth :: State -> State
|
||||
instructionFloatStackDepth state = instructionStackDepth state float
|
||||
instructionFloatStackDepth = instructionStackDepth float
|
||||
|
||||
instructionFloatYankDup :: State -> State
|
||||
instructionFloatYankDup state = instructionYankDup state float
|
||||
instructionFloatYankDup = instructionYankDup float
|
||||
|
||||
instructionFloatYank :: State -> State
|
||||
instructionFloatYank state = instructionYank state float
|
||||
instructionFloatYank = instructionYank float
|
||||
|
||||
instructionFloatShoveDup :: State -> State
|
||||
instructionFloatShoveDup state = instructionShoveDup state float
|
||||
instructionFloatShoveDup = instructionShoveDup float
|
||||
|
||||
instructionFloatShove :: State -> State
|
||||
instructionFloatShove state = instructionShove state float
|
||||
instructionFloatShove = instructionShove float
|
||||
|
||||
instructionFloatIsStackEmpty :: State -> State
|
||||
instructionFloatIsStackEmpty state = instructionIsStackEmpty state float
|
||||
instructionFloatIsStackEmpty = instructionIsStackEmpty float
|
||||
|
||||
instructionFloatSin :: State -> State
|
||||
instructionFloatSin state@(State {_float = f1 : fs}) = state {_float = sin f1 : fs}
|
||||
|
@ -84,28 +84,25 @@ safeInit xs = init xs
|
||||
absNum :: Integral a => a -> [b] -> Int
|
||||
absNum rawNum lst = abs (fromIntegral rawNum) `mod` length lst
|
||||
|
||||
notEmptyStack :: State -> Lens' State [a] -> Bool
|
||||
notEmptyStack state accessor = not . null $ view accessor state
|
||||
notEmptyStack :: Lens' State [a] -> State -> Bool
|
||||
notEmptyStack accessor state = not . null $ view accessor state
|
||||
|
||||
instructionDup :: State -> Lens' State [a] -> State
|
||||
instructionDup state accessor =
|
||||
instructionDup :: Lens' State [a] -> State -> State
|
||||
instructionDup accessor state =
|
||||
case uncons (view accessor state) of
|
||||
Nothing -> state
|
||||
Just (x,_) -> state & accessor .~ x : view accessor state
|
||||
|
||||
instructionPop :: State -> Lens' State [a] -> State
|
||||
instructionPop state accessor = state & accessor .~ drop 1 (view accessor state)
|
||||
instructionPop :: Lens' State [a] -> State -> State
|
||||
instructionPop accessor state = state & accessor .~ drop 1 (view accessor state)
|
||||
|
||||
instructionIsStackEmpty :: State -> Lens' State [a] -> State
|
||||
instructionIsStackEmpty state@(State {_bool = bs}) accessor = state{_bool = null (view accessor state) : bs}
|
||||
|
||||
-- instructionPop :: State -> Lens' State [a] -> State
|
||||
-- instructionPop state accessor = if notEmptyStack state accessor then instructionPop state accessor else state
|
||||
instructionIsStackEmpty :: Lens' State [a] -> State -> State
|
||||
instructionIsStackEmpty accessor state@(State {_bool = bs}) = state{_bool = null (view accessor state) : bs}
|
||||
|
||||
-- I might be able to move some of the int stack error checking
|
||||
-- to the integer call. For now this may be a tad inefficient.
|
||||
instructionDupN :: forall a. State -> Lens' State [a] -> State
|
||||
instructionDupN state accessor =
|
||||
instructionDupN :: forall a. Lens' State [a] -> State -> State
|
||||
instructionDupN accessor state =
|
||||
case uncons (view int state) of
|
||||
Just (i1,is) ->
|
||||
case uncons (view accessor state{_int = is}) of
|
||||
@ -129,8 +126,8 @@ instructionDupItems accessor state@(State {_int = i1 : is}) =
|
||||
else state{_int = is} & accessor .~ (take i1 (view accessor state{_int = is}) <> view accessor state{_int = is})
|
||||
instructionDupItems _ state = state
|
||||
|
||||
instructionSwap :: State -> Lens' State [a] -> State
|
||||
instructionSwap state accessor =
|
||||
instructionSwap :: Lens' State [a] -> State -> State
|
||||
instructionSwap accessor state =
|
||||
state & accessor .~ swapper (view accessor state)
|
||||
where
|
||||
swapper :: [a] -> [a]
|
||||
@ -140,19 +137,19 @@ instructionSwap state accessor =
|
||||
-- Rotates top 3 integers
|
||||
-- We could use template haskell to rotate any number of these as
|
||||
-- an instruction later. Template haskell seems very complicated tho.
|
||||
instructionRot :: State -> Lens' State [a] -> State
|
||||
instructionRot state accessor =
|
||||
instructionRot :: Lens' State [a] -> State -> State
|
||||
instructionRot accessor state =
|
||||
state & accessor .~ rotator (view accessor state)
|
||||
where
|
||||
rotator :: [a] -> [a]
|
||||
rotator (x1 : x2 : x3 : xs) = x3 : x1 : x2 : xs
|
||||
rotator xs = xs
|
||||
|
||||
instructionFlush :: State -> Lens' State [a] -> State
|
||||
instructionFlush state accessor = state & accessor .~ []
|
||||
instructionFlush :: Lens' State [a] -> State -> State
|
||||
instructionFlush accessor state = state & accessor .~ []
|
||||
|
||||
instructionEq :: forall a. Eq a => State -> Lens' State [a] -> State
|
||||
instructionEq state accessor =
|
||||
instructionEq :: forall a. Eq a => Lens' State [a] -> State -> State
|
||||
instructionEq accessor state =
|
||||
case uncons $ view accessor state of
|
||||
Nothing -> state
|
||||
Just (x1, x2 : _) -> droppedState & bool .~ (x1 == x2) : view bool droppedState
|
||||
@ -161,18 +158,18 @@ instructionEq state accessor =
|
||||
droppedState :: State
|
||||
droppedState = state & accessor .~ drop 2 (view accessor state)
|
||||
|
||||
instructionStackDepth :: State -> Lens' State [a] -> State
|
||||
instructionStackDepth state@(State {_int = is}) accessor = state{_int = length (view accessor state) : is}
|
||||
instructionStackDepth :: Lens' State [a] -> State -> State
|
||||
instructionStackDepth accessor state@(State {_int = is}) = state{_int = length (view accessor state) : is}
|
||||
|
||||
instructionYankDup :: State -> Lens' State [a] -> State
|
||||
instructionYankDup state@(State {_int = i : is}) accessor =
|
||||
if notEmptyStack state accessor
|
||||
instructionYankDup :: Lens' State [a] -> State -> State
|
||||
instructionYankDup accessor state@(State {_int = i : is}) =
|
||||
if notEmptyStack accessor state
|
||||
then state{_int = is} & accessor .~ (view accessor state{_int = is} !! max 0 (min i (length (view accessor state{_int = is}) - 1))) : view accessor state{_int = is}
|
||||
else state
|
||||
instructionYankDup state _ = state
|
||||
instructionYankDup _ state = state
|
||||
|
||||
instructionYank :: forall a. State -> Lens' State [a] -> State
|
||||
instructionYank state@(State {_int = i : is}) accessor =
|
||||
instructionYank :: forall a. Lens' State [a] -> State -> State
|
||||
instructionYank accessor state@(State {_int = i : is}) =
|
||||
let
|
||||
myIndex :: Int
|
||||
myIndex = max 0 (min i (length (view accessor state{_int = is}) - 1))
|
||||
@ -181,25 +178,25 @@ instructionYank state@(State {_int = i : is}) accessor =
|
||||
deletedState :: State
|
||||
deletedState = state{_int = is} & accessor .~ deleteAt myIndex (view accessor state{_int = is})
|
||||
in
|
||||
if notEmptyStack state{_int = is} accessor then deletedState & accessor .~ item : view accessor deletedState else state
|
||||
instructionYank state _ = state
|
||||
if notEmptyStack accessor state{_int = is} then deletedState & accessor .~ item : view accessor deletedState else state
|
||||
instructionYank _ state = state
|
||||
|
||||
-- In pysh, instructionShoveDup and instructionShove behave differently when indexing in such a way that
|
||||
-- the duplicated index matters whether or not it's present in the stack at the moment of calculation.
|
||||
-- I'm not going to keep this behavior. Check out interpysh examples for how pysh handles it.
|
||||
instructionShoveDup :: State -> Lens' State [a] -> State
|
||||
instructionShoveDup state@(State {_int = i : is}) accessor =
|
||||
instructionShoveDup :: Lens' State [a] -> State -> State
|
||||
instructionShoveDup accessor state@(State {_int = i : is}) =
|
||||
case uncons (view accessor state{_int = is}) of
|
||||
Just (x,_) -> state{_int = is} & accessor .~ combineTuple x (splitAt (max 0 (min i (length (view accessor state{_int = is}) - 1))) (view accessor state{_int = is}))
|
||||
_ -> state
|
||||
instructionShoveDup state _ = state
|
||||
instructionShoveDup _ state = state
|
||||
|
||||
instructionShove :: State -> Lens' State [a] -> State
|
||||
instructionShove state accessor = instructionShoveDup state accessor & accessor .~ drop 1 (view accessor (instructionShoveDup state accessor))
|
||||
instructionShove :: Lens' State [a] -> State -> State
|
||||
instructionShove accessor state = instructionShoveDup accessor state & accessor .~ drop 1 (view accessor (instructionShoveDup accessor state ))
|
||||
|
||||
-- not char generic
|
||||
instructionConcat :: Semigroup a => State -> Lens' State [a] -> State
|
||||
instructionConcat state accessor =
|
||||
instructionConcat :: Semigroup a => Lens' State [a] -> State -> State
|
||||
instructionConcat accessor state =
|
||||
case uncons (view accessor state) of
|
||||
Just (x1, x2:_) -> droppedState & accessor .~ (x1 <> x2) : view accessor droppedState
|
||||
_ -> state
|
||||
@ -207,12 +204,8 @@ instructionConcat state accessor =
|
||||
droppedState :: State
|
||||
droppedState = state & accessor .~ drop 2 (view accessor state)
|
||||
|
||||
-- evolve fodder???????????
|
||||
instructionNoOp :: State -> State
|
||||
instructionNoOp state = state
|
||||
|
||||
instructionConj :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionConj state primAccessor vectorAccessor =
|
||||
instructionConj :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionConj primAccessor vectorAccessor state =
|
||||
case (uncons (view primAccessor state), uncons (view vectorAccessor state)) of
|
||||
(Just (p1,ps), Just (v1,vs)) -> state & primAccessor .~ ps & vectorAccessor .~ ((p1 : v1) : vs)
|
||||
_ -> state
|
||||
@ -225,22 +218,22 @@ instructionConjEnd primAccessor vectorAccessor state =
|
||||
|
||||
-- v for vector, vs for vectorstack (also applicable to strings)
|
||||
-- Could abstract this unconsing even further in all functions below
|
||||
instructionTakeN :: State -> Lens' State [[a]] -> State
|
||||
instructionTakeN state@(State {_int = i1 : is}) accessor =
|
||||
instructionTakeN :: Lens' State [[a]] -> State -> State
|
||||
instructionTakeN accessor state@(State {_int = i1 : is}) =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state{_int = is} & accessor .~ (take (absNum i1 v1) v1 : vs)
|
||||
_ -> state
|
||||
instructionTakeN state _ = state
|
||||
instructionTakeN _ state = state
|
||||
|
||||
instructionSubVector :: State -> Lens' State [[a]] -> State
|
||||
instructionSubVector state@(State {_int = i1 : i2 : is}) accessor =
|
||||
instructionSubVector :: Lens' State [[a]] -> State -> State
|
||||
instructionSubVector accessor state@(State {_int = i1 : i2 : is}) =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state{_int = is} & accessor .~ (subList i1 i2 v1 : vs)
|
||||
_ -> state
|
||||
instructionSubVector state _ = state
|
||||
instructionSubVector _ state = state
|
||||
|
||||
instructionVectorFirst :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorFirst state primAccessor vectorAccessor =
|
||||
instructionVectorFirst :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorFirst primAccessor vectorAccessor state =
|
||||
case uncons (view vectorAccessor state) of
|
||||
Just (v1, vs) ->
|
||||
case uncons v1 of
|
||||
@ -248,8 +241,8 @@ instructionVectorFirst state primAccessor vectorAccessor =
|
||||
_ -> state
|
||||
_ -> state
|
||||
|
||||
instructionVectorLast :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorLast state primAccessor vectorAccessor =
|
||||
instructionVectorLast :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorLast primAccessor vectorAccessor state =
|
||||
case uncons (view vectorAccessor state) of
|
||||
Just (v1, vs) ->
|
||||
case uncons (drop (length v1 - 1) v1) of -- gonna keep this implementation over using last as this can't error
|
||||
@ -257,67 +250,67 @@ instructionVectorLast state primAccessor vectorAccessor =
|
||||
_ -> state
|
||||
_ -> state
|
||||
|
||||
instructionVectorNth :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorNth state@(State {_int = i1 : is}) primAccessor vectorAccessor =
|
||||
instructionVectorNth :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorNth primAccessor vectorAccessor state@(State {_int = i1 : is}) =
|
||||
case uncons (view vectorAccessor state) of
|
||||
Just (v1, vs) -> state{_int = is} & primAccessor .~ (v1 !! absNum i1 v1 : view primAccessor state{_int = is}) & vectorAccessor .~ vs
|
||||
_ -> state
|
||||
instructionVectorNth state _ _ = state
|
||||
instructionVectorNth _ _ state= state
|
||||
|
||||
instructionRest :: State -> Lens' State [[a]] -> State
|
||||
instructionRest state accessor =
|
||||
instructionRest :: Lens' State [[a]] -> State -> State
|
||||
instructionRest accessor state =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state & accessor .~ (drop 1 v1 : vs)
|
||||
_ -> state
|
||||
|
||||
instructionButLast :: State -> Lens' State [[a]] -> State
|
||||
instructionButLast state accessor =
|
||||
instructionButLast :: Lens' State [[a]] -> State -> State
|
||||
instructionButLast accessor state =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state & accessor .~ (safeInit v1 : vs)
|
||||
_ -> state
|
||||
|
||||
instructionLength :: State -> Lens' State [[a]] -> State
|
||||
instructionLength state@(State {_int = is}) accessor =
|
||||
instructionLength :: Lens' State [[a]] -> State -> State
|
||||
instructionLength accessor state@(State {_int = is}) =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state{_int = length v1 : is} & accessor .~ vs
|
||||
_ -> state
|
||||
|
||||
instructionReverse :: State -> Lens' State [[a]] -> State
|
||||
instructionReverse state accessor =
|
||||
instructionReverse :: Lens' State [[a]] -> State -> State
|
||||
instructionReverse accessor state =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state & accessor .~ (reverse v1 : vs)
|
||||
_ -> state
|
||||
|
||||
instructionPushAll :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionPushAll state primAccessor vectorAccessor =
|
||||
instructionPushAll :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionPushAll primAccessor vectorAccessor state =
|
||||
case uncons (view vectorAccessor state) of
|
||||
Just (v1, vs) -> state & vectorAccessor .~ vs & primAccessor .~ (v1 <> view primAccessor state)
|
||||
_ -> state
|
||||
|
||||
instructionVectorMakeEmpty :: State -> Lens' State [[a]] -> State
|
||||
instructionVectorMakeEmpty state accessor = state & accessor .~ ([] : view accessor state)
|
||||
instructionVectorMakeEmpty :: Lens' State [[a]] -> State -> State
|
||||
instructionVectorMakeEmpty accessor state = state & accessor .~ ([] : view accessor state)
|
||||
|
||||
instructionVectorIsEmpty :: State -> Lens' State [[a]] -> State
|
||||
instructionVectorIsEmpty state@(State {_bool = bs}) accessor =
|
||||
instructionVectorIsEmpty :: Lens' State [[a]] -> State -> State
|
||||
instructionVectorIsEmpty accessor state@(State {_bool = bs}) =
|
||||
case uncons (view accessor state) of
|
||||
Just (v1, vs) -> state{_bool = null v1 : bs} & accessor .~ vs
|
||||
_ -> state
|
||||
|
||||
instructionVectorContains :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorContains state@(State {_bool = bs}) primAccessor vectorAccessor =
|
||||
instructionVectorContains :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorContains primAccessor vectorAccessor state@(State {_bool = bs}) =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, ps)) -> state{_bool = (findSubA v1 [p1] /= -1) : bs} & vectorAccessor .~ vs & primAccessor .~ ps
|
||||
_ -> state
|
||||
|
||||
-- I couldn't think of a better way of doing this
|
||||
instructionVectorIndexOf :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorIndexOf state primAccessor vectorAccessor =
|
||||
instructionVectorIndexOf :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorIndexOf primAccessor vectorAccessor state =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, ps)) -> (state & vectorAccessor .~ vs & primAccessor .~ ps) & int .~ (findSubA v1 [p1] : view int (state & vectorAccessor .~ vs & primAccessor .~ ps))
|
||||
_ -> state
|
||||
|
||||
instructionVectorOccurrencesOf :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorOccurrencesOf state primAccessor vectorAccessor =
|
||||
instructionVectorOccurrencesOf :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorOccurrencesOf primAccessor vectorAccessor state =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, ps)) -> (state & vectorAccessor .~ vs & primAccessor .~ ps) & int .~ (amtOccurences v1 [p1] : view int (state & vectorAccessor .~ vs & primAccessor .~ ps))
|
||||
_ -> state
|
||||
@ -330,33 +323,33 @@ instructionVectorParseToPrim accessor state =
|
||||
Just (x1, xs) -> state & accessor .~ (chunksOf 1 x1 <> xs)
|
||||
_ -> state
|
||||
|
||||
instructionVectorSetNth :: State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorSetNth state@(State {_int = i1 : is}) primAccessor vectorAccessor =
|
||||
instructionVectorSetNth :: Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorSetNth primAccessor vectorAccessor state@(State {_int = i1 : is}) =
|
||||
case (uncons (view vectorAccessor state{_int = is}), uncons (view primAccessor state{_int = is})) of
|
||||
(Just (v1, vs), Just (p1, ps)) -> state{_int = is} & vectorAccessor .~ (replaceAt (absNum i1 v1) p1 v1 : vs) & primAccessor .~ ps
|
||||
_ -> state
|
||||
instructionVectorSetNth state _ _ = state
|
||||
instructionVectorSetNth _ _ state = state
|
||||
|
||||
instructionVectorReplace :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorReplace state primAccessor vectorAccessor =
|
||||
instructionVectorReplace :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorReplace primAccessor vectorAccessor state =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, p2 : ps)) -> state & vectorAccessor .~ (replace v1 [p1] [p2] Nothing : vs) & primAccessor .~ ps
|
||||
_ -> state
|
||||
|
||||
instructionVectorReplaceFirst :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorReplaceFirst state primAccessor vectorAccessor =
|
||||
instructionVectorReplaceFirst :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorReplaceFirst primAccessor vectorAccessor state =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, p2 : ps)) -> state & vectorAccessor .~ (replace v1 [p1] [p2] (Just 1) : vs) & primAccessor .~ ps
|
||||
_ -> state
|
||||
|
||||
instructionVectorRemove :: Eq a => State -> Lens' State [a] -> Lens' State [[a]] -> State
|
||||
instructionVectorRemove state primAccessor vectorAccessor =
|
||||
instructionVectorRemove :: Eq a => Lens' State [a] -> Lens' State [[a]] -> State -> State
|
||||
instructionVectorRemove primAccessor vectorAccessor state =
|
||||
case (uncons (view vectorAccessor state), uncons (view primAccessor state)) of
|
||||
(Just (v1, vs), Just (p1, ps)) -> state & vectorAccessor .~ (replace v1 [p1] [] Nothing : vs) & primAccessor .~ ps
|
||||
_ -> state
|
||||
|
||||
instructionVectorIterate :: State -> Lens' State [a] -> Lens' State [[a]] -> ([a] -> Gene) -> (State -> State) -> String -> State
|
||||
instructionVectorIterate state@(State {_exec = e1 : es}) primAccessor vectorAccessor vectorType typeIterateFunction typeIterateFunctionName =
|
||||
instructionVectorIterate :: Lens' State [a] -> Lens' State [[a]] -> ([a] -> Gene) -> (State -> State) -> String -> State -> State
|
||||
instructionVectorIterate primAccessor vectorAccessor vectorType typeIterateFunction typeIterateFunctionName state@(State {_exec = e1 : es}) =
|
||||
case uncons (view vectorAccessor state) of
|
||||
Just ([], vs) -> state{_exec = es} & vectorAccessor .~ vs
|
||||
Just ([x], vs) -> state & primAccessor .~ (x : view primAccessor state) & vectorAccessor .~ vs
|
||||
@ -365,10 +358,10 @@ instructionVectorIterate state@(State {_exec = e1 : es}) primAccessor vectorAcce
|
||||
Just (nv1, nvs) -> state{_exec = e1 : vectorType nvs : StateFunc (typeIterateFunction, typeIterateFunctionName) : e1 : es} & primAccessor .~ (nv1 : view primAccessor state) & vectorAccessor .~ vs
|
||||
_ -> state) -- This should never happen
|
||||
_ -> state
|
||||
instructionVectorIterate state _ _ _ _ _ = state
|
||||
instructionVectorIterate _ _ _ _ _ state = state
|
||||
|
||||
instructionCodeFrom :: State -> Lens' State [a] -> (a -> Gene) -> State
|
||||
instructionCodeFrom state@(State {_code = cs}) accessor geneType =
|
||||
instructionCodeFrom :: Lens' State [a] -> (a -> Gene) -> State -> State
|
||||
instructionCodeFrom accessor geneType state@(State {_code = cs}) =
|
||||
case uncons (view accessor state) of
|
||||
Just (x, xs) -> state{_code = geneType x : cs} & accessor .~ xs
|
||||
_ -> state
|
||||
|
@ -77,43 +77,43 @@ instructionIntGTE state@(State {_int = i1 : i2 : is, _bool = bs}) = state {_int
|
||||
instructionIntGTE state = state
|
||||
|
||||
instructionIntDup :: State -> State
|
||||
instructionIntDup state = instructionDup state int
|
||||
instructionIntDup = instructionDup int
|
||||
|
||||
instructionIntPop :: State -> State
|
||||
instructionIntPop state = instructionPop state int
|
||||
instructionIntPop = instructionPop int
|
||||
|
||||
instructionIntDupN :: State -> State
|
||||
instructionIntDupN state = instructionDupN state int
|
||||
instructionIntDupN = instructionDupN int
|
||||
|
||||
instructionIntSwap :: State -> State
|
||||
instructionIntSwap state = instructionSwap state int
|
||||
instructionIntSwap = instructionSwap int
|
||||
|
||||
instructionIntRot :: State -> State
|
||||
instructionIntRot state = instructionRot state int
|
||||
instructionIntRot = instructionRot int
|
||||
|
||||
instructionIntFlush :: State -> State
|
||||
instructionIntFlush state = instructionFlush state int
|
||||
instructionIntFlush = instructionFlush int
|
||||
|
||||
instructionIntEq :: State -> State
|
||||
instructionIntEq state = instructionEq state int
|
||||
instructionIntEq = instructionEq int
|
||||
|
||||
instructionIntStackDepth :: State -> State
|
||||
instructionIntStackDepth state = instructionStackDepth state int
|
||||
instructionIntStackDepth = instructionStackDepth int
|
||||
|
||||
instructionIntYank :: State -> State
|
||||
instructionIntYank state = instructionYank state int
|
||||
instructionIntYank = instructionYank int
|
||||
|
||||
instructionIntYankDup :: State -> State
|
||||
instructionIntYankDup state = instructionYankDup state int
|
||||
instructionIntYankDup = instructionYankDup int
|
||||
|
||||
instructionIntShove :: State -> State
|
||||
instructionIntShove state = instructionShove state int
|
||||
instructionIntShove = instructionShove int
|
||||
|
||||
instructionIntShoveDup :: State -> State
|
||||
instructionIntShoveDup state = instructionShoveDup state int
|
||||
instructionIntShoveDup = instructionShoveDup int
|
||||
|
||||
instructionIntIsStackEmpty :: State -> State
|
||||
instructionIntIsStackEmpty state = instructionIsStackEmpty state int
|
||||
instructionIntIsStackEmpty = instructionIsStackEmpty int
|
||||
|
||||
instructionIntDupItems :: State -> State
|
||||
instructionIntDupItems = instructionDupItems int
|
||||
|
@ -24,10 +24,10 @@ rstrip :: String -> String
|
||||
rstrip = reverse . lstrip . reverse
|
||||
|
||||
instructionStringConcat :: State -> State
|
||||
instructionStringConcat state = instructionConcat state string
|
||||
instructionStringConcat = instructionConcat string
|
||||
|
||||
instructionStringSwap :: State -> State
|
||||
instructionStringSwap state = instructionSwap state string
|
||||
instructionStringSwap = instructionSwap string
|
||||
|
||||
instructionStringInsertString :: State -> State
|
||||
instructionStringInsertString state@(State{_string = s1 : s2 : ss, _int = i1 : is}) = state {_string = combineTupleList s2 (splitAt i1 s1) : ss, _int = is}
|
||||
@ -94,24 +94,24 @@ instructionStringInsertChar state@(State {_string = s1 : ss, _char = c1 : cs, _i
|
||||
instructionStringInsertChar state = state
|
||||
|
||||
instructionStringContainsChar :: State -> State
|
||||
instructionStringContainsChar state = instructionVectorContains state char string
|
||||
instructionStringContainsChar = instructionVectorContains char string
|
||||
|
||||
instructionStringIndexOfChar :: State -> State
|
||||
instructionStringIndexOfChar state = instructionVectorIndexOf state char string
|
||||
instructionStringIndexOfChar = instructionVectorIndexOf char string
|
||||
|
||||
instructionStringSplitOnChar :: State -> State
|
||||
instructionStringSplitOnChar state@(State {_string = s1 : ss, _char = c1 : cs}) = state {_string = reverse $ splitOn [c1] s1 <> ss, _char = cs}
|
||||
instructionStringSplitOnChar state = state
|
||||
|
||||
instructionStringReplaceFirstChar :: State -> State
|
||||
instructionStringReplaceFirstChar state = instructionVectorReplaceFirst state char string
|
||||
instructionStringReplaceFirstChar = instructionVectorReplaceFirst char string
|
||||
|
||||
instructionStringReplaceNChar :: State -> State
|
||||
instructionStringReplaceNChar state@(State {_string = s1 : ss, _char = c1 : c2 : cs, _int = i1 : is}) = state{_string = replace s1 [c1] [c2] (Just i1) : ss, _char = cs, _int = is}
|
||||
instructionStringReplaceNChar state = state
|
||||
|
||||
instructionStringReplaceAllChar :: State -> State
|
||||
instructionStringReplaceAllChar state = instructionVectorReplace state char string
|
||||
instructionStringReplaceAllChar = instructionVectorReplace char string
|
||||
|
||||
instructionStringRemoveFirstChar :: State -> State
|
||||
instructionStringRemoveFirstChar state@(State {_string = s1 : ss, _char = c1 : cs}) = state {_string = replace s1 [c1] "" (Just 1) : ss, _char = cs}
|
||||
@ -122,32 +122,32 @@ instructionStringRemoveNChar state@(State {_string = s1 : ss, _char = c1 : cs, _
|
||||
instructionStringRemoveNChar state = state
|
||||
|
||||
instructionStringRemoveAllChar :: State -> State
|
||||
instructionStringRemoveAllChar state = instructionVectorRemove state char string
|
||||
instructionStringRemoveAllChar = instructionVectorRemove char string
|
||||
|
||||
instructionStringOccurrencesOfChar :: State -> State
|
||||
instructionStringOccurrencesOfChar state = instructionVectorOccurrencesOf state char string
|
||||
instructionStringOccurrencesOfChar = instructionVectorOccurrencesOf char string
|
||||
|
||||
instructionStringReverse :: State -> State
|
||||
instructionStringReverse state = instructionReverse state string
|
||||
instructionStringReverse = instructionReverse string
|
||||
|
||||
instructionStringHead :: State -> State
|
||||
instructionStringHead state = instructionTakeN state string
|
||||
instructionStringHead = instructionTakeN string
|
||||
|
||||
instructionStringTail :: State -> State
|
||||
instructionStringTail state@(State {_string = s1 : ss, _int = i1 : is}) = state{_string = takeR (absNum i1 s1) s1 : ss, _int = is}
|
||||
instructionStringTail state = state
|
||||
|
||||
instructionStringAppendChar :: State -> State
|
||||
instructionStringAppendChar state = instructionConj state char string
|
||||
instructionStringAppendChar = instructionConj char string
|
||||
|
||||
instructionStringConjEndChar :: State -> State
|
||||
instructionStringConjEndChar = instructionConjEnd char string
|
||||
|
||||
instructionStringRest :: State -> State
|
||||
instructionStringRest state = instructionRest state string
|
||||
instructionStringRest = instructionRest string
|
||||
|
||||
instructionStringButLast :: State -> State
|
||||
instructionStringButLast state = instructionButLast state string
|
||||
instructionStringButLast = instructionButLast string
|
||||
|
||||
instructionStringDrop :: State -> State
|
||||
instructionStringDrop state@(State {_string = s1 : ss, _int = i1 : is}) = state{_string = drop (absNum i1 s1) s1 : ss, _int = is}
|
||||
@ -158,10 +158,10 @@ instructionStringButLastN state@(State {_string = s1 : ss, _int = i1 : is}) = st
|
||||
instructionStringButLastN state = state
|
||||
|
||||
instructionStringLength :: State -> State
|
||||
instructionStringLength state = instructionLength state string
|
||||
instructionStringLength = instructionLength string
|
||||
|
||||
instructionStringMakeEmpty :: State -> State
|
||||
instructionStringMakeEmpty state = instructionVectorMakeEmpty state string
|
||||
instructionStringMakeEmpty = instructionVectorMakeEmpty string
|
||||
|
||||
instructionStringIsEmptyString :: State -> State
|
||||
instructionStringIsEmptyString state@(State {_string = s1 : ss, _bool = bs}) = state{_string = ss, _bool = null s1 : bs}
|
||||
@ -172,7 +172,7 @@ instructionStringRemoveNth state@(State {_string = s1 : ss, _int = i1 : is}) = s
|
||||
instructionStringRemoveNth state = state
|
||||
|
||||
instructionStringSetNth :: State -> State
|
||||
instructionStringSetNth state = instructionVectorSetNth state char string
|
||||
instructionStringSetNth = instructionVectorSetNth char string
|
||||
|
||||
instructionStringStripWhitespace :: State -> State
|
||||
instructionStringStripWhitespace state@(State {_string = s1 : ss}) = state{_string = strip s1 : ss}
|
||||
@ -198,40 +198,40 @@ instructionStringFromChar state@(State {_string = ss, _char = c1 : cs}) = state{
|
||||
instructionStringFromChar state = state
|
||||
|
||||
instructionStringPop :: State -> State
|
||||
instructionStringPop state = instructionPop state string
|
||||
instructionStringPop = instructionPop string
|
||||
|
||||
instructionStringDup :: State -> State
|
||||
instructionStringDup state = instructionDup state string
|
||||
instructionStringDup = instructionDup string
|
||||
|
||||
instructionStringDupN :: State -> State
|
||||
instructionStringDupN state = instructionDupN state string
|
||||
instructionStringDupN = instructionDupN string
|
||||
|
||||
instructionStringRot :: State -> State
|
||||
instructionStringRot state = instructionRot state string
|
||||
instructionStringRot = instructionRot string
|
||||
|
||||
instructionStringFlush :: State -> State
|
||||
instructionStringFlush state = instructionFlush state string
|
||||
instructionStringFlush = instructionFlush string
|
||||
|
||||
instructionStringEq :: State -> State
|
||||
instructionStringEq state = instructionEq state string
|
||||
instructionStringEq = instructionEq string
|
||||
|
||||
instructionStringStackDepth :: State -> State
|
||||
instructionStringStackDepth state = instructionStackDepth state string
|
||||
instructionStringStackDepth = instructionStackDepth string
|
||||
|
||||
instructionStringYank :: State -> State
|
||||
instructionStringYank state = instructionYank state string
|
||||
instructionStringYank = instructionYank string
|
||||
|
||||
instructionStringYankDup :: State -> State
|
||||
instructionStringYankDup state = instructionYankDup state string
|
||||
instructionStringYankDup = instructionYankDup string
|
||||
|
||||
instructionStringIsStackEmpty :: State -> State
|
||||
instructionStringIsStackEmpty state = instructionIsStackEmpty state string
|
||||
instructionStringIsStackEmpty = instructionIsStackEmpty string
|
||||
|
||||
instructionStringShove :: State -> State
|
||||
instructionStringShove state = instructionShove state string
|
||||
instructionStringShove = instructionShove string
|
||||
|
||||
instructionStringShoveDup :: State -> State
|
||||
instructionStringShoveDup state = instructionShoveDup state string
|
||||
instructionStringShoveDup = instructionShoveDup string
|
||||
|
||||
instructionStringSort :: State -> State
|
||||
instructionStringSort = instructionVectorSort string
|
||||
|
@ -4,106 +4,106 @@ import HushGP.State
|
||||
import HushGP.Instructions.GenericInstructions
|
||||
|
||||
instructionVectorBoolConcat :: State -> State
|
||||
instructionVectorBoolConcat state = instructionConcat state vectorBool
|
||||
instructionVectorBoolConcat = instructionConcat vectorBool
|
||||
|
||||
instructionVectorBoolConj :: State -> State
|
||||
instructionVectorBoolConj state = instructionConj state bool vectorBool
|
||||
instructionVectorBoolConj = instructionConj bool vectorBool
|
||||
|
||||
instructionVectorBoolTakeN :: State -> State
|
||||
instructionVectorBoolTakeN state = instructionTakeN state vectorBool
|
||||
instructionVectorBoolTakeN = instructionTakeN vectorBool
|
||||
|
||||
instructionVectorBoolSubVector :: State -> State
|
||||
instructionVectorBoolSubVector state = instructionSubVector state vectorBool
|
||||
instructionVectorBoolSubVector = instructionSubVector vectorBool
|
||||
|
||||
instructionVectorBoolFirst :: State -> State
|
||||
instructionVectorBoolFirst state = instructionVectorFirst state bool vectorBool
|
||||
instructionVectorBoolFirst = instructionVectorFirst bool vectorBool
|
||||
|
||||
instructionVectorBoolLast :: State -> State
|
||||
instructionVectorBoolLast state = instructionVectorLast state bool vectorBool
|
||||
instructionVectorBoolLast = instructionVectorLast bool vectorBool
|
||||
|
||||
instructionVectorBoolNth :: State -> State
|
||||
instructionVectorBoolNth state = instructionVectorNth state bool vectorBool
|
||||
instructionVectorBoolNth = instructionVectorNth bool vectorBool
|
||||
|
||||
instructionVectorBoolRest :: State -> State
|
||||
instructionVectorBoolRest state = instructionRest state vectorBool
|
||||
instructionVectorBoolRest = instructionRest vectorBool
|
||||
|
||||
instructionVectorBoolButLast :: State -> State
|
||||
instructionVectorBoolButLast state = instructionButLast state vectorBool
|
||||
instructionVectorBoolButLast = instructionButLast vectorBool
|
||||
|
||||
instructionVectorBoolLength :: State -> State
|
||||
instructionVectorBoolLength state = instructionLength state vectorBool
|
||||
instructionVectorBoolLength = instructionLength vectorBool
|
||||
|
||||
instructionVectorBoolReverse :: State -> State
|
||||
instructionVectorBoolReverse state = instructionReverse state vectorBool
|
||||
instructionVectorBoolReverse = instructionReverse vectorBool
|
||||
|
||||
instructionVectorBoolPushAll :: State -> State
|
||||
instructionVectorBoolPushAll state = instructionPushAll state bool vectorBool
|
||||
instructionVectorBoolPushAll = instructionPushAll bool vectorBool
|
||||
|
||||
instructionVectorBoolMakeEmpty :: State -> State
|
||||
instructionVectorBoolMakeEmpty state = instructionVectorMakeEmpty state vectorBool
|
||||
instructionVectorBoolMakeEmpty = instructionVectorMakeEmpty vectorBool
|
||||
|
||||
instructionVectorBoolIsEmpty :: State -> State
|
||||
instructionVectorBoolIsEmpty state = instructionVectorIsEmpty state vectorBool
|
||||
instructionVectorBoolIsEmpty = instructionVectorIsEmpty vectorBool
|
||||
|
||||
instructionVectorBoolIndexOf :: State -> State
|
||||
instructionVectorBoolIndexOf state = instructionVectorIndexOf state bool vectorBool
|
||||
instructionVectorBoolIndexOf = instructionVectorIndexOf bool vectorBool
|
||||
|
||||
instructionVectorBoolOccurrencesOf :: State -> State
|
||||
instructionVectorBoolOccurrencesOf state = instructionVectorOccurrencesOf state bool vectorBool
|
||||
instructionVectorBoolOccurrencesOf = instructionVectorOccurrencesOf bool vectorBool
|
||||
|
||||
instructionVectorBoolSetNth :: State -> State
|
||||
instructionVectorBoolSetNth state = instructionVectorSetNth state bool vectorBool
|
||||
instructionVectorBoolSetNth = instructionVectorSetNth bool vectorBool
|
||||
|
||||
instructionVectorBoolReplace :: State -> State
|
||||
instructionVectorBoolReplace state = instructionVectorReplace state bool vectorBool
|
||||
instructionVectorBoolReplace = instructionVectorReplace bool vectorBool
|
||||
|
||||
instructionVectorBoolReplaceFirst :: State -> State
|
||||
instructionVectorBoolReplaceFirst state = instructionVectorReplaceFirst state bool vectorBool
|
||||
instructionVectorBoolReplaceFirst = instructionVectorReplaceFirst bool vectorBool
|
||||
|
||||
instructionVectorBoolRemove :: State -> State
|
||||
instructionVectorBoolRemove state = instructionVectorRemove state bool vectorBool
|
||||
instructionVectorBoolRemove = instructionVectorRemove bool vectorBool
|
||||
|
||||
instructionVectorBoolIterate :: State -> State
|
||||
instructionVectorBoolIterate state = instructionVectorIterate state bool vectorBool GeneVectorBool instructionVectorBoolIterate "instructionVectorBoolIterate"
|
||||
instructionVectorBoolIterate = instructionVectorIterate bool vectorBool GeneVectorBool instructionVectorBoolIterate "instructionVectorBoolIterate"
|
||||
|
||||
instructionVectorBoolPop :: State -> State
|
||||
instructionVectorBoolPop state = instructionPop state vectorBool
|
||||
instructionVectorBoolPop = instructionPop vectorBool
|
||||
|
||||
instructionVectorBoolDup :: State -> State
|
||||
instructionVectorBoolDup state = instructionDup state vectorBool
|
||||
instructionVectorBoolDup = instructionDup vectorBool
|
||||
|
||||
instructionVectorBoolDupN :: State -> State
|
||||
instructionVectorBoolDupN state = instructionDupN state vectorBool
|
||||
instructionVectorBoolDupN = instructionDupN vectorBool
|
||||
|
||||
instructionVectorBoolSwap :: State -> State
|
||||
instructionVectorBoolSwap state = instructionSwap state vectorBool
|
||||
instructionVectorBoolSwap = instructionSwap vectorBool
|
||||
|
||||
instructionVectorBoolRot :: State -> State
|
||||
instructionVectorBoolRot state = instructionRot state vectorBool
|
||||
instructionVectorBoolRot = instructionRot vectorBool
|
||||
|
||||
instructionVectorBoolFlush :: State -> State
|
||||
instructionVectorBoolFlush state = instructionFlush state vectorBool
|
||||
instructionVectorBoolFlush = instructionFlush vectorBool
|
||||
|
||||
instructionVectorBoolEq :: State -> State
|
||||
instructionVectorBoolEq state = instructionEq state vectorBool
|
||||
instructionVectorBoolEq = instructionEq vectorBool
|
||||
|
||||
instructionVectorBoolStackDepth :: State -> State
|
||||
instructionVectorBoolStackDepth state = instructionStackDepth state vectorBool
|
||||
instructionVectorBoolStackDepth = instructionStackDepth vectorBool
|
||||
|
||||
instructionVectorBoolYank :: State -> State
|
||||
instructionVectorBoolYank state = instructionYank state vectorBool
|
||||
instructionVectorBoolYank = instructionYank vectorBool
|
||||
|
||||
instructionVectorBoolYankDup :: State -> State
|
||||
instructionVectorBoolYankDup state = instructionYankDup state vectorBool
|
||||
instructionVectorBoolYankDup = instructionYankDup vectorBool
|
||||
|
||||
instructionVectorBoolIsStackEmpty :: State -> State
|
||||
instructionVectorBoolIsStackEmpty state = instructionIsStackEmpty state vectorBool
|
||||
instructionVectorBoolIsStackEmpty = instructionIsStackEmpty vectorBool
|
||||
|
||||
instructionVectorBoolShove :: State -> State
|
||||
instructionVectorBoolShove state = instructionShove state vectorBool
|
||||
instructionVectorBoolShove = instructionShove vectorBool
|
||||
|
||||
instructionVectorBoolShoveDup :: State -> State
|
||||
instructionVectorBoolShoveDup state = instructionShoveDup state vectorBool
|
||||
instructionVectorBoolShoveDup = instructionShoveDup vectorBool
|
||||
|
||||
instructionVectorBoolSort :: State -> State
|
||||
instructionVectorBoolSort = instructionVectorSort vectorBool
|
||||
|
@ -4,106 +4,106 @@ import HushGP.State
|
||||
import HushGP.Instructions.GenericInstructions
|
||||
|
||||
instructionVectorCharConcat :: State -> State
|
||||
instructionVectorCharConcat state = instructionConcat state vectorChar
|
||||
instructionVectorCharConcat = instructionConcat vectorChar
|
||||
|
||||
instructionVectorCharConj :: State -> State
|
||||
instructionVectorCharConj state = instructionConj state char vectorChar
|
||||
instructionVectorCharConj = instructionConj char vectorChar
|
||||
|
||||
instructionVectorCharTakeN :: State -> State
|
||||
instructionVectorCharTakeN state = instructionTakeN state vectorChar
|
||||
instructionVectorCharTakeN = instructionTakeN vectorChar
|
||||
|
||||
instructionVectorCharSubVector :: State -> State
|
||||
instructionVectorCharSubVector state = instructionSubVector state vectorChar
|
||||
instructionVectorCharSubVector = instructionSubVector vectorChar
|
||||
|
||||
instructionVectorCharFirst :: State -> State
|
||||
instructionVectorCharFirst state = instructionVectorFirst state char vectorChar
|
||||
instructionVectorCharFirst = instructionVectorFirst char vectorChar
|
||||
|
||||
instructionVectorCharLast :: State -> State
|
||||
instructionVectorCharLast state = instructionVectorLast state char vectorChar
|
||||
instructionVectorCharLast = instructionVectorLast char vectorChar
|
||||
|
||||
instructionVectorCharNth :: State -> State
|
||||
instructionVectorCharNth state = instructionVectorNth state char vectorChar
|
||||
instructionVectorCharNth = instructionVectorNth char vectorChar
|
||||
|
||||
instructionVectorCharRest :: State -> State
|
||||
instructionVectorCharRest state = instructionRest state vectorChar
|
||||
instructionVectorCharRest = instructionRest vectorChar
|
||||
|
||||
instructionVectorCharButLast :: State -> State
|
||||
instructionVectorCharButLast state = instructionButLast state vectorChar
|
||||
instructionVectorCharButLast = instructionButLast vectorChar
|
||||
|
||||
instructionVectorCharLength :: State -> State
|
||||
instructionVectorCharLength state = instructionLength state vectorChar
|
||||
instructionVectorCharLength = instructionLength vectorChar
|
||||
|
||||
instructionVectorCharReverse :: State -> State
|
||||
instructionVectorCharReverse state = instructionReverse state vectorChar
|
||||
instructionVectorCharReverse = instructionReverse vectorChar
|
||||
|
||||
instructionVectorCharPushAll :: State -> State
|
||||
instructionVectorCharPushAll state = instructionPushAll state char vectorChar
|
||||
instructionVectorCharPushAll = instructionPushAll char vectorChar
|
||||
|
||||
instructionVectorCharMakeEmpty :: State -> State
|
||||
instructionVectorCharMakeEmpty state = instructionVectorMakeEmpty state vectorChar
|
||||
instructionVectorCharMakeEmpty = instructionVectorMakeEmpty vectorChar
|
||||
|
||||
instructionVectorCharIsEmpty :: State -> State
|
||||
instructionVectorCharIsEmpty state = instructionVectorIsEmpty state vectorChar
|
||||
instructionVectorCharIsEmpty = instructionVectorIsEmpty vectorChar
|
||||
|
||||
instructionVectorCharIndexOf :: State -> State
|
||||
instructionVectorCharIndexOf state = instructionVectorIndexOf state char vectorChar
|
||||
instructionVectorCharIndexOf = instructionVectorIndexOf char vectorChar
|
||||
|
||||
instructionVectorCharOccurrencesOf :: State -> State
|
||||
instructionVectorCharOccurrencesOf state = instructionVectorOccurrencesOf state char vectorChar
|
||||
instructionVectorCharOccurrencesOf = instructionVectorOccurrencesOf char vectorChar
|
||||
|
||||
instructionVectorCharSetNth :: State -> State
|
||||
instructionVectorCharSetNth state = instructionVectorSetNth state char vectorChar
|
||||
instructionVectorCharSetNth = instructionVectorSetNth char vectorChar
|
||||
|
||||
instructionVectorCharReplace :: State -> State
|
||||
instructionVectorCharReplace state = instructionVectorReplace state char vectorChar
|
||||
instructionVectorCharReplace = instructionVectorReplace char vectorChar
|
||||
|
||||
instructionVectorCharReplaceFirst :: State -> State
|
||||
instructionVectorCharReplaceFirst state = instructionVectorReplaceFirst state char vectorChar
|
||||
instructionVectorCharReplaceFirst = instructionVectorReplaceFirst char vectorChar
|
||||
|
||||
instructionVectorCharRemove :: State -> State
|
||||
instructionVectorCharRemove state = instructionVectorRemove state char vectorChar
|
||||
instructionVectorCharRemove = instructionVectorRemove char vectorChar
|
||||
|
||||
instructionVectorCharIterate :: State -> State
|
||||
instructionVectorCharIterate state = instructionVectorIterate state char vectorChar GeneVectorChar instructionVectorCharIterate "instructionVectorCharIterate"
|
||||
instructionVectorCharIterate = instructionVectorIterate char vectorChar GeneVectorChar instructionVectorCharIterate "instructionVectorCharIterate"
|
||||
|
||||
instructionVectorCharPop :: State -> State
|
||||
instructionVectorCharPop state = instructionPop state vectorChar
|
||||
instructionVectorCharPop = instructionPop vectorChar
|
||||
|
||||
instructionVectorCharDup :: State -> State
|
||||
instructionVectorCharDup state = instructionDup state vectorChar
|
||||
instructionVectorCharDup = instructionDup vectorChar
|
||||
|
||||
instructionVectorCharDupN :: State -> State
|
||||
instructionVectorCharDupN state = instructionDupN state vectorChar
|
||||
instructionVectorCharDupN = instructionDupN vectorChar
|
||||
|
||||
instructionVectorCharSwap :: State -> State
|
||||
instructionVectorCharSwap state = instructionSwap state vectorChar
|
||||
instructionVectorCharSwap = instructionSwap vectorChar
|
||||
|
||||
instructionVectorCharRot :: State -> State
|
||||
instructionVectorCharRot state = instructionRot state vectorChar
|
||||
instructionVectorCharRot = instructionRot vectorChar
|
||||
|
||||
instructionVectorCharFlush :: State -> State
|
||||
instructionVectorCharFlush state = instructionFlush state vectorChar
|
||||
instructionVectorCharFlush = instructionFlush vectorChar
|
||||
|
||||
instructionVectorCharEq :: State -> State
|
||||
instructionVectorCharEq state = instructionEq state vectorChar
|
||||
instructionVectorCharEq = instructionEq vectorChar
|
||||
|
||||
instructionVectorCharStackDepth :: State -> State
|
||||
instructionVectorCharStackDepth state = instructionStackDepth state vectorChar
|
||||
instructionVectorCharStackDepth = instructionStackDepth vectorChar
|
||||
|
||||
instructionVectorCharYank :: State -> State
|
||||
instructionVectorCharYank state = instructionYank state vectorChar
|
||||
instructionVectorCharYank = instructionYank vectorChar
|
||||
|
||||
instructionVectorCharYankDup :: State -> State
|
||||
instructionVectorCharYankDup state = instructionYankDup state vectorChar
|
||||
instructionVectorCharYankDup = instructionYankDup vectorChar
|
||||
|
||||
instructionVectorCharIsStackEmpty :: State -> State
|
||||
instructionVectorCharIsStackEmpty state = instructionIsStackEmpty state vectorChar
|
||||
instructionVectorCharIsStackEmpty = instructionIsStackEmpty vectorChar
|
||||
|
||||
instructionVectorCharShove :: State -> State
|
||||
instructionVectorCharShove state = instructionShove state vectorChar
|
||||
instructionVectorCharShove = instructionShove vectorChar
|
||||
|
||||
instructionVectorCharShoveDup :: State -> State
|
||||
instructionVectorCharShoveDup state = instructionShoveDup state vectorChar
|
||||
instructionVectorCharShoveDup = instructionShoveDup vectorChar
|
||||
|
||||
instructionVectorCharSort :: State -> State
|
||||
instructionVectorCharSort = instructionVectorSort vectorChar
|
||||
|
@ -4,106 +4,106 @@ import HushGP.State
|
||||
import HushGP.Instructions.GenericInstructions
|
||||
|
||||
instructionVectorFloatConcat :: State -> State
|
||||
instructionVectorFloatConcat state = instructionConcat state vectorFloat
|
||||
instructionVectorFloatConcat = instructionConcat vectorFloat
|
||||
|
||||
instructionVectorFloatConj :: State -> State
|
||||
instructionVectorFloatConj state = instructionConj state float vectorFloat
|
||||
instructionVectorFloatConj = instructionConj float vectorFloat
|
||||
|
||||
instructionVectorFloatTakeN :: State -> State
|
||||
instructionVectorFloatTakeN state = instructionTakeN state vectorFloat
|
||||
instructionVectorFloatTakeN = instructionTakeN vectorFloat
|
||||
|
||||
instructionVectorFloatSubVector :: State -> State
|
||||
instructionVectorFloatSubVector state = instructionSubVector state vectorFloat
|
||||
instructionVectorFloatSubVector = instructionSubVector vectorFloat
|
||||
|
||||
instructionVectorFloatFirst :: State -> State
|
||||
instructionVectorFloatFirst state = instructionVectorFirst state float vectorFloat
|
||||
instructionVectorFloatFirst = instructionVectorFirst float vectorFloat
|
||||
|
||||
instructionVectorFloatLast :: State -> State
|
||||
instructionVectorFloatLast state = instructionVectorLast state float vectorFloat
|
||||
instructionVectorFloatLast = instructionVectorLast float vectorFloat
|
||||
|
||||
instructionVectorFloatNth :: State -> State
|
||||
instructionVectorFloatNth state = instructionVectorNth state float vectorFloat
|
||||
instructionVectorFloatNth = instructionVectorNth float vectorFloat
|
||||
|
||||
instructionVectorFloatRest :: State -> State
|
||||
instructionVectorFloatRest state = instructionRest state vectorFloat
|
||||
instructionVectorFloatRest = instructionRest vectorFloat
|
||||
|
||||
instructionVectorFloatButLast :: State -> State
|
||||
instructionVectorFloatButLast state = instructionButLast state vectorFloat
|
||||
instructionVectorFloatButLast = instructionButLast vectorFloat
|
||||
|
||||
instructionVectorFloatLength :: State -> State
|
||||
instructionVectorFloatLength state = instructionLength state vectorFloat
|
||||
instructionVectorFloatLength = instructionLength vectorFloat
|
||||
|
||||
instructionVectorFloatReverse :: State -> State
|
||||
instructionVectorFloatReverse state = instructionReverse state vectorFloat
|
||||
instructionVectorFloatReverse = instructionReverse vectorFloat
|
||||
|
||||
instructionVectorFloatPushAll :: State -> State
|
||||
instructionVectorFloatPushAll state = instructionPushAll state float vectorFloat
|
||||
instructionVectorFloatPushAll = instructionPushAll float vectorFloat
|
||||
|
||||
instructionVectorFloatMakeEmpty :: State -> State
|
||||
instructionVectorFloatMakeEmpty state = instructionVectorMakeEmpty state vectorFloat
|
||||
instructionVectorFloatMakeEmpty = instructionVectorMakeEmpty vectorFloat
|
||||
|
||||
instructionVectorFloatIsEmpty :: State -> State
|
||||
instructionVectorFloatIsEmpty state = instructionVectorIsEmpty state vectorFloat
|
||||
instructionVectorFloatIsEmpty = instructionVectorIsEmpty vectorFloat
|
||||
|
||||
instructionVectorFloatIndexOf :: State -> State
|
||||
instructionVectorFloatIndexOf state = instructionVectorIndexOf state float vectorFloat
|
||||
instructionVectorFloatIndexOf = instructionVectorIndexOf float vectorFloat
|
||||
|
||||
instructionVectorFloatOccurrencesOf :: State -> State
|
||||
instructionVectorFloatOccurrencesOf state = instructionVectorOccurrencesOf state float vectorFloat
|
||||
instructionVectorFloatOccurrencesOf = instructionVectorOccurrencesOf float vectorFloat
|
||||
|
||||
instructionVectorFloatSetNth :: State -> State
|
||||
instructionVectorFloatSetNth state = instructionVectorSetNth state float vectorFloat
|
||||
instructionVectorFloatSetNth = instructionVectorSetNth float vectorFloat
|
||||
|
||||
instructionVectorFloatReplace :: State -> State
|
||||
instructionVectorFloatReplace state = instructionVectorReplace state float vectorFloat
|
||||
instructionVectorFloatReplace = instructionVectorReplace float vectorFloat
|
||||
|
||||
instructionVectorFloatReplaceFirst :: State -> State
|
||||
instructionVectorFloatReplaceFirst state = instructionVectorReplaceFirst state float vectorFloat
|
||||
instructionVectorFloatReplaceFirst = instructionVectorReplaceFirst float vectorFloat
|
||||
|
||||
instructionVectorFloatRemove :: State -> State
|
||||
instructionVectorFloatRemove state = instructionVectorRemove state float vectorFloat
|
||||
instructionVectorFloatRemove = instructionVectorRemove float vectorFloat
|
||||
|
||||
instructionVectorFloatIterate :: State -> State
|
||||
instructionVectorFloatIterate state = instructionVectorIterate state float vectorFloat GeneVectorFloat instructionVectorFloatIterate "instructionVectorFloatIterate"
|
||||
instructionVectorFloatIterate = instructionVectorIterate float vectorFloat GeneVectorFloat instructionVectorFloatIterate "instructionVectorFloatIterate"
|
||||
|
||||
instructionVectorFloatPop :: State -> State
|
||||
instructionVectorFloatPop state = instructionPop state vectorFloat
|
||||
instructionVectorFloatPop = instructionPop vectorFloat
|
||||
|
||||
instructionVectorFloatDup :: State -> State
|
||||
instructionVectorFloatDup state = instructionDup state vectorFloat
|
||||
instructionVectorFloatDup = instructionDup vectorFloat
|
||||
|
||||
instructionVectorFloatDupN :: State -> State
|
||||
instructionVectorFloatDupN state = instructionDupN state vectorFloat
|
||||
instructionVectorFloatDupN = instructionDupN vectorFloat
|
||||
|
||||
instructionVectorFloatSwap :: State -> State
|
||||
instructionVectorFloatSwap state = instructionSwap state vectorFloat
|
||||
instructionVectorFloatSwap = instructionSwap vectorFloat
|
||||
|
||||
instructionVectorFloatRot :: State -> State
|
||||
instructionVectorFloatRot state = instructionRot state vectorFloat
|
||||
instructionVectorFloatRot = instructionRot vectorFloat
|
||||
|
||||
instructionVectorFloatFlush :: State -> State
|
||||
instructionVectorFloatFlush state = instructionFlush state vectorFloat
|
||||
instructionVectorFloatFlush = instructionFlush vectorFloat
|
||||
|
||||
instructionVectorFloatEq :: State -> State
|
||||
instructionVectorFloatEq state = instructionEq state vectorFloat
|
||||
instructionVectorFloatEq = instructionEq vectorFloat
|
||||
|
||||
instructionVectorFloatStackDepth :: State -> State
|
||||
instructionVectorFloatStackDepth state = instructionStackDepth state vectorFloat
|
||||
instructionVectorFloatStackDepth = instructionStackDepth vectorFloat
|
||||
|
||||
instructionVectorFloatYank :: State -> State
|
||||
instructionVectorFloatYank state = instructionYank state vectorFloat
|
||||
instructionVectorFloatYank = instructionYank vectorFloat
|
||||
|
||||
instructionVectorFloatYankDup :: State -> State
|
||||
instructionVectorFloatYankDup state = instructionYankDup state vectorFloat
|
||||
instructionVectorFloatYankDup = instructionYankDup vectorFloat
|
||||
|
||||
instructionVectorFloatIsStackEmpty :: State -> State
|
||||
instructionVectorFloatIsStackEmpty state = instructionIsStackEmpty state vectorFloat
|
||||
instructionVectorFloatIsStackEmpty = instructionIsStackEmpty vectorFloat
|
||||
|
||||
instructionVectorFloatShove :: State -> State
|
||||
instructionVectorFloatShove state = instructionShove state vectorFloat
|
||||
instructionVectorFloatShove = instructionShove vectorFloat
|
||||
|
||||
instructionVectorFloatShoveDup :: State -> State
|
||||
instructionVectorFloatShoveDup state = instructionShoveDup state vectorFloat
|
||||
instructionVectorFloatShoveDup = instructionShoveDup vectorFloat
|
||||
|
||||
instructionVectorFloatSort :: State -> State
|
||||
instructionVectorFloatSort = instructionVectorSort vectorFloat
|
||||
|
@ -4,106 +4,106 @@ import HushGP.Instructions.GenericInstructions
|
||||
import HushGP.State
|
||||
|
||||
instructionVectorIntConcat :: State -> State
|
||||
instructionVectorIntConcat state = instructionConcat state vectorInt
|
||||
instructionVectorIntConcat = instructionConcat vectorInt
|
||||
|
||||
instructionVectorIntConj :: State -> State
|
||||
instructionVectorIntConj state = instructionConj state int vectorInt
|
||||
instructionVectorIntConj = instructionConj int vectorInt
|
||||
|
||||
instructionVectorIntTakeN :: State -> State
|
||||
instructionVectorIntTakeN state = instructionTakeN state vectorInt
|
||||
instructionVectorIntTakeN = instructionTakeN vectorInt
|
||||
|
||||
instructionVectorIntSubVector :: State -> State
|
||||
instructionVectorIntSubVector state = instructionSubVector state vectorInt
|
||||
instructionVectorIntSubVector = instructionSubVector vectorInt
|
||||
|
||||
instructionVectorIntFirst :: State -> State
|
||||
instructionVectorIntFirst state = instructionVectorFirst state int vectorInt
|
||||
instructionVectorIntFirst = instructionVectorFirst int vectorInt
|
||||
|
||||
instructionVectorIntLast :: State -> State
|
||||
instructionVectorIntLast state = instructionVectorLast state int vectorInt
|
||||
instructionVectorIntLast = instructionVectorLast int vectorInt
|
||||
|
||||
instructionVectorIntNth :: State -> State
|
||||
instructionVectorIntNth state = instructionVectorNth state int vectorInt
|
||||
instructionVectorIntNth = instructionVectorNth int vectorInt
|
||||
|
||||
instructionVectorIntRest :: State -> State
|
||||
instructionVectorIntRest state = instructionRest state vectorInt
|
||||
instructionVectorIntRest = instructionRest vectorInt
|
||||
|
||||
instructionVectorIntButLast :: State -> State
|
||||
instructionVectorIntButLast state = instructionButLast state vectorInt
|
||||
instructionVectorIntButLast = instructionButLast vectorInt
|
||||
|
||||
instructionVectorIntLength :: State -> State
|
||||
instructionVectorIntLength state = instructionLength state vectorInt
|
||||
instructionVectorIntLength = instructionLength vectorInt
|
||||
|
||||
instructionVectorIntReverse :: State -> State
|
||||
instructionVectorIntReverse state = instructionReverse state vectorInt
|
||||
instructionVectorIntReverse = instructionReverse vectorInt
|
||||
|
||||
instructionVectorIntPushAll :: State -> State
|
||||
instructionVectorIntPushAll state = instructionPushAll state int vectorInt
|
||||
instructionVectorIntPushAll = instructionPushAll int vectorInt
|
||||
|
||||
instructionVectorIntMakeEmpty :: State -> State
|
||||
instructionVectorIntMakeEmpty state = instructionVectorMakeEmpty state vectorInt
|
||||
instructionVectorIntMakeEmpty = instructionVectorMakeEmpty vectorInt
|
||||
|
||||
instructionVectorIntIsEmpty :: State -> State
|
||||
instructionVectorIntIsEmpty state = instructionVectorIsEmpty state vectorInt
|
||||
instructionVectorIntIsEmpty = instructionVectorIsEmpty vectorInt
|
||||
|
||||
instructionVectorIntIndexOf :: State -> State
|
||||
instructionVectorIntIndexOf state = instructionVectorIndexOf state int vectorInt
|
||||
instructionVectorIntIndexOf = instructionVectorIndexOf int vectorInt
|
||||
|
||||
instructionVectorIntOccurrencesOf :: State -> State
|
||||
instructionVectorIntOccurrencesOf state = instructionVectorOccurrencesOf state int vectorInt
|
||||
instructionVectorIntOccurrencesOf = instructionVectorOccurrencesOf int vectorInt
|
||||
|
||||
instructionVectorIntSetNth :: State -> State
|
||||
instructionVectorIntSetNth state = instructionVectorSetNth state int vectorInt
|
||||
instructionVectorIntSetNth = instructionVectorSetNth int vectorInt
|
||||
|
||||
instructionVectorIntReplace :: State -> State
|
||||
instructionVectorIntReplace state = instructionVectorReplace state int vectorInt
|
||||
instructionVectorIntReplace = instructionVectorReplace int vectorInt
|
||||
|
||||
instructionVectorIntReplaceFirst :: State -> State
|
||||
instructionVectorIntReplaceFirst state = instructionVectorReplaceFirst state int vectorInt
|
||||
instructionVectorIntReplaceFirst = instructionVectorReplaceFirst int vectorInt
|
||||
|
||||
instructionVectorIntRemove :: State -> State
|
||||
instructionVectorIntRemove state = instructionVectorRemove state int vectorInt
|
||||
instructionVectorIntRemove = instructionVectorRemove int vectorInt
|
||||
|
||||
instructionVectorIntIterate :: State -> State
|
||||
instructionVectorIntIterate state = instructionVectorIterate state int vectorInt GeneVectorInt instructionVectorIntIterate "instructionVectorIntIterate"
|
||||
instructionVectorIntIterate = instructionVectorIterate int vectorInt GeneVectorInt instructionVectorIntIterate "instructionVectorIntIterate"
|
||||
|
||||
instructionVectorIntPop :: State -> State
|
||||
instructionVectorIntPop state = instructionPop state vectorChar
|
||||
instructionVectorIntPop = instructionPop vectorChar
|
||||
|
||||
instructionVectorIntDup :: State -> State
|
||||
instructionVectorIntDup state = instructionDup state vectorChar
|
||||
instructionVectorIntDup = instructionDup vectorChar
|
||||
|
||||
instructionVectorIntDupN :: State -> State
|
||||
instructionVectorIntDupN state = instructionDupN state vectorChar
|
||||
instructionVectorIntDupN = instructionDupN vectorChar
|
||||
|
||||
instructionVectorIntSwap :: State -> State
|
||||
instructionVectorIntSwap state = instructionSwap state vectorChar
|
||||
instructionVectorIntSwap = instructionSwap vectorChar
|
||||
|
||||
instructionVectorIntRot :: State -> State
|
||||
instructionVectorIntRot state = instructionRot state vectorChar
|
||||
instructionVectorIntRot = instructionRot vectorChar
|
||||
|
||||
instructionVectorIntFlush :: State -> State
|
||||
instructionVectorIntFlush state = instructionFlush state vectorChar
|
||||
instructionVectorIntFlush = instructionFlush vectorChar
|
||||
|
||||
instructionVectorIntEq :: State -> State
|
||||
instructionVectorIntEq state = instructionEq state vectorChar
|
||||
instructionVectorIntEq = instructionEq vectorChar
|
||||
|
||||
instructionVectorIntStackDepth :: State -> State
|
||||
instructionVectorIntStackDepth state = instructionStackDepth state vectorChar
|
||||
instructionVectorIntStackDepth = instructionStackDepth vectorChar
|
||||
|
||||
instructionVectorIntYank :: State -> State
|
||||
instructionVectorIntYank state = instructionYank state vectorChar
|
||||
instructionVectorIntYank = instructionYank vectorChar
|
||||
|
||||
instructionVectorIntYankDup :: State -> State
|
||||
instructionVectorIntYankDup state = instructionYankDup state vectorChar
|
||||
instructionVectorIntYankDup = instructionYankDup vectorChar
|
||||
|
||||
instructionVectorIntIsStackEmpty :: State -> State
|
||||
instructionVectorIntIsStackEmpty state = instructionIsStackEmpty state vectorChar
|
||||
instructionVectorIntIsStackEmpty = instructionIsStackEmpty vectorChar
|
||||
|
||||
instructionVectorIntShove :: State -> State
|
||||
instructionVectorIntShove state = instructionShove state vectorChar
|
||||
instructionVectorIntShove = instructionShove vectorChar
|
||||
|
||||
instructionVectorIntShoveDup :: State -> State
|
||||
instructionVectorIntShoveDup state = instructionShoveDup state vectorChar
|
||||
instructionVectorIntShoveDup = instructionShoveDup vectorChar
|
||||
|
||||
instructionVectorIntSort :: State -> State
|
||||
instructionVectorIntSort = instructionVectorSort vectorInt
|
||||
|
@ -4,106 +4,106 @@ import HushGP.State
|
||||
import HushGP.Instructions.GenericInstructions
|
||||
|
||||
instructionVectorStringConcat :: State -> State
|
||||
instructionVectorStringConcat state = instructionConcat state vectorString
|
||||
instructionVectorStringConcat = instructionConcat vectorString
|
||||
|
||||
instructionVectorStringConj :: State -> State
|
||||
instructionVectorStringConj state = instructionConj state string vectorString
|
||||
instructionVectorStringConj = instructionConj string vectorString
|
||||
|
||||
instructionVectorStringTakeN :: State -> State
|
||||
instructionVectorStringTakeN state = instructionTakeN state vectorString
|
||||
instructionVectorStringTakeN = instructionTakeN vectorString
|
||||
|
||||
instructionVectorStringSubVector :: State -> State
|
||||
instructionVectorStringSubVector state = instructionSubVector state vectorString
|
||||
instructionVectorStringSubVector = instructionSubVector vectorString
|
||||
|
||||
instructionVectorStringFirst :: State -> State
|
||||
instructionVectorStringFirst state = instructionVectorFirst state string vectorString
|
||||
instructionVectorStringFirst = instructionVectorFirst string vectorString
|
||||
|
||||
instructionVectorStringLast :: State -> State
|
||||
instructionVectorStringLast state = instructionVectorLast state string vectorString
|
||||
instructionVectorStringLast = instructionVectorLast string vectorString
|
||||
|
||||
instructionVectorStringNth :: State -> State
|
||||
instructionVectorStringNth state = instructionVectorNth state string vectorString
|
||||
instructionVectorStringNth = instructionVectorNth string vectorString
|
||||
|
||||
instructionVectorStringRest :: State -> State
|
||||
instructionVectorStringRest state = instructionRest state vectorString
|
||||
instructionVectorStringRest = instructionRest vectorString
|
||||
|
||||
instructionVectorStringButLast :: State -> State
|
||||
instructionVectorStringButLast state = instructionButLast state vectorString
|
||||
instructionVectorStringButLast = instructionButLast vectorString
|
||||
|
||||
instructionVectorStringLength :: State -> State
|
||||
instructionVectorStringLength state = instructionLength state vectorString
|
||||
instructionVectorStringLength = instructionLength vectorString
|
||||
|
||||
instructionVectorStringReverse :: State -> State
|
||||
instructionVectorStringReverse state = instructionReverse state vectorString
|
||||
instructionVectorStringReverse = instructionReverse vectorString
|
||||
|
||||
instructionVectorStringPushAll :: State -> State
|
||||
instructionVectorStringPushAll state = instructionPushAll state string vectorString
|
||||
instructionVectorStringPushAll = instructionPushAll string vectorString
|
||||
|
||||
instructionVectorStringMakeEmpty :: State -> State
|
||||
instructionVectorStringMakeEmpty state = instructionVectorMakeEmpty state vectorString
|
||||
instructionVectorStringMakeEmpty = instructionVectorMakeEmpty vectorString
|
||||
|
||||
instructionVectorStringIsEmpty :: State -> State
|
||||
instructionVectorStringIsEmpty state = instructionVectorIsEmpty state vectorString
|
||||
instructionVectorStringIsEmpty = instructionVectorIsEmpty vectorString
|
||||
|
||||
instructionVectorStringIndexOf :: State -> State
|
||||
instructionVectorStringIndexOf state = instructionVectorIndexOf state string vectorString
|
||||
instructionVectorStringIndexOf = instructionVectorIndexOf string vectorString
|
||||
|
||||
instructionVectorStringOccurrencesOf :: State -> State
|
||||
instructionVectorStringOccurrencesOf state = instructionVectorOccurrencesOf state string vectorString
|
||||
instructionVectorStringOccurrencesOf = instructionVectorOccurrencesOf string vectorString
|
||||
|
||||
instructionVectorStringSetNth :: State -> State
|
||||
instructionVectorStringSetNth state = instructionVectorSetNth state string vectorString
|
||||
instructionVectorStringSetNth = instructionVectorSetNth string vectorString
|
||||
|
||||
instructionVectorStringReplace :: State -> State
|
||||
instructionVectorStringReplace state = instructionVectorReplace state string vectorString
|
||||
instructionVectorStringReplace = instructionVectorReplace string vectorString
|
||||
|
||||
instructionVectorStringReplaceFirst :: State -> State
|
||||
instructionVectorStringReplaceFirst state = instructionVectorReplaceFirst state string vectorString
|
||||
instructionVectorStringReplaceFirst = instructionVectorReplaceFirst string vectorString
|
||||
|
||||
instructionVectorStringRemove :: State -> State
|
||||
instructionVectorStringRemove state = instructionVectorRemove state string vectorString
|
||||
instructionVectorStringRemove = instructionVectorRemove string vectorString
|
||||
|
||||
instructionVectorStringIterate :: State -> State
|
||||
instructionVectorStringIterate state = instructionVectorIterate state string vectorString GeneVectorString instructionVectorStringIterate "instructionVectorStringIterate"
|
||||
instructionVectorStringIterate = instructionVectorIterate string vectorString GeneVectorString instructionVectorStringIterate "instructionVectorStringIterate"
|
||||
|
||||
instructionVectorStringPop :: State -> State
|
||||
instructionVectorStringPop state = instructionPop state vectorString
|
||||
instructionVectorStringPop = instructionPop vectorString
|
||||
|
||||
instructionVectorStringDup :: State -> State
|
||||
instructionVectorStringDup state = instructionDup state vectorString
|
||||
instructionVectorStringDup = instructionDup vectorString
|
||||
|
||||
instructionVectorStringDupN :: State -> State
|
||||
instructionVectorStringDupN state = instructionDupN state vectorString
|
||||
instructionVectorStringDupN = instructionDupN vectorString
|
||||
|
||||
instructionVectorStringSwap :: State -> State
|
||||
instructionVectorStringSwap state = instructionSwap state vectorString
|
||||
instructionVectorStringSwap = instructionSwap vectorString
|
||||
|
||||
instructionVectorStringRot :: State -> State
|
||||
instructionVectorStringRot state = instructionRot state vectorString
|
||||
instructionVectorStringRot = instructionRot vectorString
|
||||
|
||||
instructionVectorStringFlush :: State -> State
|
||||
instructionVectorStringFlush state = instructionFlush state vectorString
|
||||
instructionVectorStringFlush = instructionFlush vectorString
|
||||
|
||||
instructionVectorStringEq :: State -> State
|
||||
instructionVectorStringEq state = instructionEq state vectorString
|
||||
instructionVectorStringEq = instructionEq vectorString
|
||||
|
||||
instructionVectorStringStackDepth :: State -> State
|
||||
instructionVectorStringStackDepth state = instructionStackDepth state vectorString
|
||||
instructionVectorStringStackDepth = instructionStackDepth vectorString
|
||||
|
||||
instructionVectorStringYank :: State -> State
|
||||
instructionVectorStringYank state = instructionYank state vectorString
|
||||
instructionVectorStringYank = instructionYank vectorString
|
||||
|
||||
instructionVectorStringYankDup :: State -> State
|
||||
instructionVectorStringYankDup state = instructionYankDup state vectorString
|
||||
instructionVectorStringYankDup = instructionYankDup vectorString
|
||||
|
||||
instructionVectorStringIsStackEmpty :: State -> State
|
||||
instructionVectorStringIsStackEmpty state = instructionIsStackEmpty state vectorString
|
||||
instructionVectorStringIsStackEmpty = instructionIsStackEmpty vectorString
|
||||
|
||||
instructionVectorStringShove :: State -> State
|
||||
instructionVectorStringShove state = instructionShove state vectorString
|
||||
instructionVectorStringShove = instructionShove vectorString
|
||||
|
||||
instructionVectorStringShoveDup :: State -> State
|
||||
instructionVectorStringShoveDup state = instructionShoveDup state vectorString
|
||||
instructionVectorStringShoveDup = instructionShoveDup vectorString
|
||||
|
||||
instructionVectorStringSort :: State -> State
|
||||
instructionVectorStringSort = instructionVectorSort vectorString
|
||||
|
Loading…
x
Reference in New Issue
Block a user