more instructions, gonna rework the unit testing framework
This commit is contained in:
parent
53d62f31c7
commit
cef9c92b56
@ -49,6 +49,9 @@ library
|
|||||||
, Instructions.CharInstructions
|
, Instructions.CharInstructions
|
||||||
, Instructions.VectorIntInstructions
|
, Instructions.VectorIntInstructions
|
||||||
, Instructions.VectorFloatInstructions
|
, Instructions.VectorFloatInstructions
|
||||||
|
, Instructions.VectorStringInstructions
|
||||||
|
, Instructions.VectorLogicalInstructions
|
||||||
|
, Instructions.VectorCharInstructions
|
||||||
|
|
||||||
-- Modules included in this library but not exported.
|
-- Modules included in this library but not exported.
|
||||||
-- other-modules:
|
-- other-modules:
|
||||||
|
@ -143,7 +143,6 @@ instructionEq state accessor =
|
|||||||
stackTop = take 2 $ view accessor state
|
stackTop = take 2 $ view accessor state
|
||||||
|
|
||||||
instructionStackDepth :: State -> Lens' State [a] -> State
|
instructionStackDepth :: State -> Lens' State [a] -> State
|
||||||
-- instructionStackDepth state accessor = state & int .~ (length (view accessor state) : view int state)
|
|
||||||
instructionStackDepth state@(State {_int = is}) accessor = state{_int = length (view accessor state) : is}
|
instructionStackDepth state@(State {_int = is}) accessor = state{_int = length (view accessor state) : is}
|
||||||
|
|
||||||
-- Will have a non-generic definition for the int stack
|
-- Will have a non-generic definition for the int stack
|
||||||
@ -152,7 +151,7 @@ instructionYankDup state@(State {_int = i : is}) accessor =
|
|||||||
if notEmptyStack state accessor
|
if notEmptyStack state accessor
|
||||||
then (state & accessor .~ (view accessor state !! max 0 (min i (length (view accessor state) - 1))) : view accessor state) {_int = is}
|
then (state & accessor .~ (view accessor state !! max 0 (min i (length (view accessor state) - 1))) : view accessor state) {_int = is}
|
||||||
else state
|
else state
|
||||||
instructionYankDup state@(State {_int = []}) _ = state
|
instructionYankDup state _ = state
|
||||||
|
|
||||||
-- Is this optimal? Running instrucitonYankDup twice?????
|
-- Is this optimal? Running instrucitonYankDup twice?????
|
||||||
-- int non generic too
|
-- int non generic too
|
||||||
|
67
src/Instructions/VectorCharInstructions.hs
Normal file
67
src/Instructions/VectorCharInstructions.hs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
module Instructions.VectorCharInstructions where
|
||||||
|
|
||||||
|
import State
|
||||||
|
import Instructions.GenericInstructions
|
||||||
|
|
||||||
|
instructionVectorCharConcat :: State -> State
|
||||||
|
instructionVectorCharConcat state = instructionConcat state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharConj :: State -> State
|
||||||
|
instructionVectorCharConj state = instructionConj state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharTakeN :: State -> State
|
||||||
|
instructionVectorCharTakeN state = instructionTakeN state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharSubVector :: State -> State
|
||||||
|
instructionVectorCharSubVector state = instructionSubVector state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharFirst :: State -> State
|
||||||
|
instructionVectorCharFirst state = instructionVectorFirst state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharLast :: State -> State
|
||||||
|
instructionVectorCharLast state = instructionVectorLast state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharNth :: State -> State
|
||||||
|
instructionVectorCharNth state = instructionVectorNth state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharRest :: State -> State
|
||||||
|
instructionVectorCharRest state = instructionRest state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharButLast :: State -> State
|
||||||
|
instructionVectorCharButLast state = instructionButLast state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharLength :: State -> State
|
||||||
|
instructionVectorCharLength state = instructionLength state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharReverse :: State -> State
|
||||||
|
instructionVectorCharReverse state = instructionReverse state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharPushAll :: State -> State
|
||||||
|
instructionVectorCharPushAll state = instructionPushAll state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharMakeEmpty :: State -> State
|
||||||
|
instructionVectorCharMakeEmpty state = instructionVectorMakeEmpty state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharIsEmpty :: State -> State
|
||||||
|
instructionVectorCharIsEmpty state = instructionVectorIsEmpty state vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharIndexOf :: State -> State
|
||||||
|
instructionVectorCharIndexOf state = instructionVectorIndexOf state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharOccurrencesOf :: State -> State
|
||||||
|
instructionVectorCharOccurrencesOf state = instructionVectorOccurrencesOf state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharSetNth :: State -> State
|
||||||
|
instructionVectorCharSetNth state = instructionVectorSetNth state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharReplace :: State -> State
|
||||||
|
instructionVectorCharReplace state = instructionVectorReplace state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharReplaceFirst :: State -> State
|
||||||
|
instructionVectorCharReplaceFirst state = instructionVectorReplaceFirst state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharRemove :: State -> State
|
||||||
|
instructionVectorCharRemove state = instructionVectorRemove state char vectorChar
|
||||||
|
|
||||||
|
instructionVectorCharIterate :: State -> State
|
||||||
|
instructionVectorCharIterate state = instructionVectorIterate state char vectorChar GeneVectorChar instructionVectorCharIterate
|
@ -10,10 +10,10 @@ instructionVectorFloatConj :: State -> State
|
|||||||
instructionVectorFloatConj state = instructionConj state float vectorFloat
|
instructionVectorFloatConj state = instructionConj state float vectorFloat
|
||||||
|
|
||||||
instructionVectorFloatTakeN :: State -> State
|
instructionVectorFloatTakeN :: State -> State
|
||||||
instructionVectorFloatTakeN state = instructionTakeN state vectorInt
|
instructionVectorFloatTakeN state = instructionTakeN state vectorFloat
|
||||||
|
|
||||||
instructionVectorFloatSubVector :: State -> State
|
instructionVectorFloatSubVector :: State -> State
|
||||||
instructionVectorFloatSubVector state = instructionSubVector state vectorInt
|
instructionVectorFloatSubVector state = instructionSubVector state vectorFloat
|
||||||
|
|
||||||
instructionVectorFloatFirst :: State -> State
|
instructionVectorFloatFirst :: State -> State
|
||||||
instructionVectorFloatFirst state = instructionVectorFirst state float vectorFloat
|
instructionVectorFloatFirst state = instructionVectorFirst state float vectorFloat
|
||||||
@ -62,3 +62,6 @@ instructionVectorFloatReplaceFirst state = instructionVectorReplaceFirst state f
|
|||||||
|
|
||||||
instructionVectorFloatRemove :: State -> State
|
instructionVectorFloatRemove :: State -> State
|
||||||
instructionVectorFloatRemove state = instructionVectorRemove state float vectorFloat
|
instructionVectorFloatRemove state = instructionVectorRemove state float vectorFloat
|
||||||
|
|
||||||
|
instructionVectorFloatIterate :: State -> State
|
||||||
|
instructionVectorFloatIterate state = instructionVectorIterate state float vectorFloat GeneVectorFloat instructionVectorFloatIterate
|
||||||
|
67
src/Instructions/VectorLogicalInstructions.hs
Normal file
67
src/Instructions/VectorLogicalInstructions.hs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
module Instructions.VectorLogicalInstructions where
|
||||||
|
|
||||||
|
import State
|
||||||
|
import Instructions.GenericInstructions
|
||||||
|
|
||||||
|
instructionVectorBoolConcat :: State -> State
|
||||||
|
instructionVectorBoolConcat state = instructionConcat state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolConj :: State -> State
|
||||||
|
instructionVectorBoolConj state = instructionConj state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolTakeN :: State -> State
|
||||||
|
instructionVectorBoolTakeN state = instructionTakeN state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolSubVector :: State -> State
|
||||||
|
instructionVectorBoolSubVector state = instructionSubVector state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolFirst :: State -> State
|
||||||
|
instructionVectorBoolFirst state = instructionVectorFirst state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolLast :: State -> State
|
||||||
|
instructionVectorBoolLast state = instructionVectorLast state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolNth :: State -> State
|
||||||
|
instructionVectorBoolNth state = instructionVectorNth state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolRest :: State -> State
|
||||||
|
instructionVectorBoolRest state = instructionRest state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolButLast :: State -> State
|
||||||
|
instructionVectorBoolButLast state = instructionButLast state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolLength :: State -> State
|
||||||
|
instructionVectorBoolLength state = instructionLength state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolReverse :: State -> State
|
||||||
|
instructionVectorBoolReverse state = instructionReverse state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolPushAll :: State -> State
|
||||||
|
instructionVectorBoolPushAll state = instructionPushAll state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolMakeEmpty :: State -> State
|
||||||
|
instructionVectorBoolMakeEmpty state = instructionVectorMakeEmpty state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolIsEmpty :: State -> State
|
||||||
|
instructionVectorBoolIsEmpty state = instructionVectorIsEmpty state vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolIndexOf :: State -> State
|
||||||
|
instructionVectorBoolIndexOf state = instructionVectorIndexOf state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolOccurrencesOf :: State -> State
|
||||||
|
instructionVectorBoolOccurrencesOf state = instructionVectorOccurrencesOf state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolSetNth :: State -> State
|
||||||
|
instructionVectorBoolSetNth state = instructionVectorSetNth state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolReplace :: State -> State
|
||||||
|
instructionVectorBoolReplace state = instructionVectorReplace state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolReplaceFirst :: State -> State
|
||||||
|
instructionVectorBoolReplaceFirst state = instructionVectorReplaceFirst state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolRemove :: State -> State
|
||||||
|
instructionVectorBoolRemove state = instructionVectorRemove state bool vectorBool
|
||||||
|
|
||||||
|
instructionVectorBoolIterate :: State -> State
|
||||||
|
instructionVectorBoolIterate state = instructionVectorIterate state bool vectorBool GeneVectorBool instructionVectorBoolIterate
|
67
src/Instructions/VectorStringInstructions.hs
Normal file
67
src/Instructions/VectorStringInstructions.hs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
module Instructions.VectorStringInstructions where
|
||||||
|
|
||||||
|
import State
|
||||||
|
import Instructions.GenericInstructions
|
||||||
|
|
||||||
|
instructionVectorStringConcat :: State -> State
|
||||||
|
instructionVectorStringConcat state = instructionConcat state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringConj :: State -> State
|
||||||
|
instructionVectorStringConj state = instructionConj state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringTakeN :: State -> State
|
||||||
|
instructionVectorStringTakeN state = instructionTakeN state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringSubVector :: State -> State
|
||||||
|
instructionVectorStringSubVector state = instructionSubVector state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringFirst :: State -> State
|
||||||
|
instructionVectorStringFirst state = instructionVectorFirst state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringLast :: State -> State
|
||||||
|
instructionVectorStringLast state = instructionVectorLast state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringNth :: State -> State
|
||||||
|
instructionVectorStringNth state = instructionVectorNth state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringRest :: State -> State
|
||||||
|
instructionVectorStringRest state = instructionRest state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringButLast :: State -> State
|
||||||
|
instructionVectorStringButLast state = instructionButLast state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringLength :: State -> State
|
||||||
|
instructionVectorStringLength state = instructionLength state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringReverse :: State -> State
|
||||||
|
instructionVectorStringReverse state = instructionReverse state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringPushAll :: State -> State
|
||||||
|
instructionVectorStringPushAll state = instructionPushAll state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringMakeEmpty :: State -> State
|
||||||
|
instructionVectorStringMakeEmpty state = instructionVectorMakeEmpty state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringIsEmpty :: State -> State
|
||||||
|
instructionVectorStringIsEmpty state = instructionVectorIsEmpty state vectorString
|
||||||
|
|
||||||
|
instructionVectorStringIndexOf :: State -> State
|
||||||
|
instructionVectorStringIndexOf state = instructionVectorIndexOf state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringOccurrencesOf :: State -> State
|
||||||
|
instructionVectorStringOccurrencesOf state = instructionVectorOccurrencesOf state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringSetNth :: State -> State
|
||||||
|
instructionVectorStringSetNth state = instructionVectorSetNth state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringReplace :: State -> State
|
||||||
|
instructionVectorStringReplace state = instructionVectorReplace state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringReplaceFirst :: State -> State
|
||||||
|
instructionVectorStringReplaceFirst state = instructionVectorReplaceFirst state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringRemove :: State -> State
|
||||||
|
instructionVectorStringRemove state = instructionVectorRemove state string vectorString
|
||||||
|
|
||||||
|
instructionVectorStringIterate :: State -> State
|
||||||
|
instructionVectorStringIterate state = instructionVectorIterate state string vectorString GeneVectorString instructionVectorStringIterate
|
Loading…
x
Reference in New Issue
Block a user