disambiguate isEmpty and isStackEmpty
This commit is contained in:
parent
ad4b7a2341
commit
0b280af591
2
TODO.md
2
TODO.md
@ -7,7 +7,7 @@
|
||||
- [X] Implement all functions as seen in the specification
|
||||
- [ ] Implement Linear Algebra functions as specified in the previous papers
|
||||
- [X] Add a function to sort a vector forward and backwards
|
||||
- [ ] Disambiguate isEmpty and stackIsEmpty
|
||||
- [X] Disambiguate isEmpty and stackIsEmpty
|
||||
- [X] Rename Logical to Bool
|
||||
- [X] Make int yank, shove, yankdup, and shovedup generic
|
||||
- [ ] Write hackage documentation for each function
|
||||
|
@ -70,7 +70,7 @@ allIntInstructions = map StateFunc [
|
||||
(instructionIntYank, "instructionIntYank"),
|
||||
(instructionIntYankDup, "instructionIntYankDup"),
|
||||
(instructionIntShove, "instructionIntShove"),
|
||||
(instructionIntIsEmpty, "instructionIntIsEmpty"),
|
||||
(instructionIntIsStackEmpty, "instructionIntIsStackEmpty"),
|
||||
(instructionIntFromChar, "instructionIntFromChar"),
|
||||
(instructionIntFromString, "instructionIntFromString"),
|
||||
(instructionIntDupItems, "instructionIntDupItems")
|
||||
@ -103,7 +103,7 @@ allFloatInstructions = map StateFunc [
|
||||
(instructionFloatYank, "instructionFloatYank"),
|
||||
(instructionFloatYankDup, "instructionFloatYankDup"),
|
||||
(instructionFloatShove, "instructionFloatShove"),
|
||||
(instructionFloatIsEmpty, "instructionFloatIsEmpty"),
|
||||
(instructionFloatIsStackEmpty, "instructionFloatIsStackEmpty"),
|
||||
(instructionFloatFromChar, "instructionFloatFromChar"),
|
||||
(instructionFloatFromString, "instructionFloatFromString"),
|
||||
(instructionFloatDupItems, "instructionFloatDupItems")
|
||||
@ -130,7 +130,7 @@ allBoolInstructions = map StateFunc [
|
||||
(instructionBoolYankDup, "instructionBoolYankDup"),
|
||||
(instructionBoolShove, "instructionBoolShove"),
|
||||
(instructionBoolShoveDup, "instructionBoolShoveDup"),
|
||||
(instructionBoolIsEmpty, "instructionBoolIsEmpty"),
|
||||
(instructionBoolIsStackEmpty, "instructionBoolIsStackEmpty"),
|
||||
(instructionBoolDupItems, "instructionBoolDupItems")
|
||||
]
|
||||
|
||||
@ -159,7 +159,7 @@ allCharInstructions = map StateFunc [
|
||||
(instructionCharYankDup, "instructionCharYankDup"),
|
||||
(instructionCharShove, "instructionCharShove"),
|
||||
(instructionCharShoveDup, "instructionCharShoveDup"),
|
||||
(instructionCharIsEmpty, "instructionCharIsEmpty"),
|
||||
(instructionCharIsStackEmpty, "instructionCharIsStackEmpty"),
|
||||
(instructionCharDupItems, "instructionCharDupItems")
|
||||
]
|
||||
|
||||
@ -206,7 +206,7 @@ allCodeInstructions = map StateFunc [
|
||||
(instructionCodeYankDup, "instructionCodeYankDup"),
|
||||
(instructionCodeShove, "instructionCodeShove"),
|
||||
(instructionCodeShoveDup, "instructionCodeShoveDup"),
|
||||
(instructionCodeStackIsEmpty, "instructionCodeStackIsEmpty"),
|
||||
(instructionCodeIsStackEmpty, "instructionCodeIsStackEmpty"),
|
||||
(instructionCodeFromBool, "instructionCodeFromBool"),
|
||||
(instructionCodeFromInt, "instructionCodeFromInt"),
|
||||
(instructionCodeFromChar, "instructionCodeFromChar"),
|
||||
@ -240,7 +240,7 @@ allExecInstructions = map StateFunc [
|
||||
(instructionExecYankDup, "instructionExecYankDup"),
|
||||
(instructionExecShove, "instructionExecShove"),
|
||||
(instructionExecShoveDup, "instructionExecShoveDup"),
|
||||
(instructionExecIsEmpty, "instructionExecIsEmpty"),
|
||||
(instructionExecIsStackEmpty, "instructionExecIsStackEmpty"),
|
||||
(instructionExecDoRange, "instructionExecDoRange"),
|
||||
(instructionExecDoCount, "instructionExecDoCount"),
|
||||
(instructionExecDoTimes, "instructionExecDoTimes"),
|
||||
@ -312,7 +312,7 @@ allStringInstructions = map StateFunc [
|
||||
(instructionStringYankDup, "instructionStringYankDup"),
|
||||
(instructionStringShove, "instructionStringShove"),
|
||||
(instructionStringShoveDup, "instructionStringShoveDup"),
|
||||
(instructionStringIsEmpty, "instructionStringIsEmpty"),
|
||||
(instructionStringIsStackEmpty, "instructionStringIsStackEmpty"),
|
||||
(instructionStringSort, "instructionStringSort"),
|
||||
(instructionStringSortReverse, "instructionStringSortReverse"),
|
||||
(instructionStringDupItems, "instructionStringDupItems"),
|
||||
@ -354,7 +354,7 @@ allVectorIntInstructions = map StateFunc [
|
||||
(instructionVectorIntYankDup, "instructionVectorIntYankDup"),
|
||||
(instructionVectorIntShove, "instructionVectorIntShove"),
|
||||
(instructionVectorIntShoveDup, "instructionVectorIntShoveDup"),
|
||||
(instructionVectorIntStackIsEmpty, "instructionVectorIntStackIsEmpty"),
|
||||
(instructionVectorIntIsStackEmpty, "instructionVectorIntIsStackEmpty"),
|
||||
(instructionVectorIntSort, "instructionVectorIntSort"),
|
||||
(instructionVectorIntSortReverse, "instructionVectorIntSortReverse"),
|
||||
(instructionVectorIntDupItems, "instructionVectorIntDupItems")
|
||||
@ -395,7 +395,7 @@ allVectorFloatInstructions = map StateFunc [
|
||||
(instructionVectorFloatYankDup, "instructionVectorFloatYankDup"),
|
||||
(instructionVectorFloatShove, "instructionVectorFloatShove"),
|
||||
(instructionVectorFloatShoveDup, "instructionVectorFloatShoveDup"),
|
||||
(instructionVectorFloatStackIsEmpty, "instructionVectorFloatStackIsEmpty"),
|
||||
(instructionVectorFloatIsStackEmpty, "instructionVectorFloatIsStackEmpty"),
|
||||
(instructionVectorFloatSort, "instructionVectorFloatSort"),
|
||||
(instructionVectorFloatSortReverse, "instructionVectorFloatSortReverse"),
|
||||
(instructionVectorFloatDupItems, "instructionVectorFloatDupItems")
|
||||
@ -436,7 +436,7 @@ allVectorCharInstructions = map StateFunc [
|
||||
(instructionVectorCharYankDup, "instructionVectorCharYankDup"),
|
||||
(instructionVectorCharShove, "instructionVectorCharShove"),
|
||||
(instructionVectorCharShoveDup, "instructionVectorCharShoveDup"),
|
||||
(instructionVectorCharStackIsEmpty, "instructionVectorCharStackIsEmpty"),
|
||||
(instructionVectorCharIsStackEmpty, "instructionVectorCharIsStackEmpty"),
|
||||
(instructionVectorCharSort, "instructionVectorCharSort"),
|
||||
(instructionVectorCharSortReverse, "instructionVectorCharSortReverse"),
|
||||
(instructionVectorCharDupItems, "instructionVectorCharDupItems")
|
||||
@ -477,7 +477,7 @@ allVectorStringInstructions = map StateFunc [
|
||||
(instructionVectorStringYankDup, "instructionVectorStringYankDup"),
|
||||
(instructionVectorStringShove, "instructionVectorStringShove"),
|
||||
(instructionVectorStringShoveDup, "instructionVectorStringShoveDup"),
|
||||
(instructionVectorStringStackIsEmpty, "instructionVectorStringStackIsEmpty"),
|
||||
(instructionVectorStringIsStackEmpty, "instructionVectorStringIsStackEmpty"),
|
||||
(instructionVectorStringSort, "instructionVectorStringSort"),
|
||||
(instructionVectorStringSortReverse, "instructionVectorStringSortReverse"),
|
||||
(instructionVectorStringDupItems, "instructionVectorStringDupItems")
|
||||
@ -518,7 +518,7 @@ allVectorBoolInstructions = map StateFunc [
|
||||
(instructionVectorBoolYankDup, "instructionVectorBoolYankDup"),
|
||||
(instructionVectorBoolShove, "instructionVectorBoolShove"),
|
||||
(instructionVectorBoolShoveDup, "instructionVectorBoolShoveDup"),
|
||||
(instructionVectorBoolStackIsEmpty, "instructionVectorBoolStackIsEmpty"),
|
||||
(instructionVectorBoolIsStackEmpty, "instructionVectorBoolIsStackEmpty"),
|
||||
(instructionVectorBoolSort, "instructionVectorBoolSort"),
|
||||
(instructionVectorBoolSortReverse, "instructionVectorBoolSortReverse"),
|
||||
(instructionVectorBoolDupItems, "instructionVectorBoolDupItems")
|
||||
|
@ -75,8 +75,8 @@ instructionBoolShove state = instructionShove state bool
|
||||
instructionBoolShoveDup :: State -> State
|
||||
instructionBoolShoveDup state = instructionShoveDup state bool
|
||||
|
||||
instructionBoolIsEmpty :: State -> State
|
||||
instructionBoolIsEmpty state = instructionIsEmpty state bool
|
||||
instructionBoolIsStackEmpty :: State -> State
|
||||
instructionBoolIsStackEmpty state = instructionIsStackEmpty state bool
|
||||
|
||||
instructionBoolDupItems :: State -> State
|
||||
instructionBoolDupItems = instructionDupItems bool
|
||||
|
@ -79,8 +79,8 @@ instructionCharYank state = instructionYank state char
|
||||
instructionCharYankDup :: State -> State
|
||||
instructionCharYankDup state = instructionYankDup state char
|
||||
|
||||
instructionCharIsEmpty :: State -> State
|
||||
instructionCharIsEmpty state = instructionIsEmpty state char
|
||||
instructionCharIsStackEmpty :: State -> State
|
||||
instructionCharIsStackEmpty state = instructionIsStackEmpty state char
|
||||
|
||||
instructionCharShove :: State -> State
|
||||
instructionCharShove state = instructionShove state char
|
||||
|
@ -294,8 +294,8 @@ instructionCodeYank state = instructionYank state code
|
||||
instructionCodeYankDup :: State -> State
|
||||
instructionCodeYankDup state = instructionYankDup state code
|
||||
|
||||
instructionCodeStackIsEmpty :: State -> State
|
||||
instructionCodeStackIsEmpty state = instructionIsEmpty state code
|
||||
instructionCodeIsStackEmpty :: State -> State
|
||||
instructionCodeIsStackEmpty state = instructionIsStackEmpty state code
|
||||
|
||||
instructionCodeShove :: State -> State
|
||||
instructionCodeShove state = instructionShove state code
|
||||
|
@ -47,8 +47,8 @@ instructionExecShove state = instructionShove state exec
|
||||
instructionExecShoveDup :: State -> State
|
||||
instructionExecShoveDup state = instructionShoveDup state exec
|
||||
|
||||
instructionExecIsEmpty :: State -> State
|
||||
instructionExecIsEmpty state = instructionIsEmpty state exec
|
||||
instructionExecIsStackEmpty :: State -> State
|
||||
instructionExecIsStackEmpty state = instructionIsStackEmpty state exec
|
||||
|
||||
execDoRange :: Gene
|
||||
execDoRange = StateFunc (instructionExecDoRange, "instructionExecDoRange")
|
||||
|
@ -112,8 +112,8 @@ instructionFloatShoveDup state = instructionShoveDup state float
|
||||
instructionFloatShove :: State -> State
|
||||
instructionFloatShove state = instructionShove state float
|
||||
|
||||
instructionFloatIsEmpty :: State -> State
|
||||
instructionFloatIsEmpty state = instructionIsEmpty state float
|
||||
instructionFloatIsStackEmpty :: State -> State
|
||||
instructionFloatIsStackEmpty state = instructionIsStackEmpty state float
|
||||
|
||||
instructionFloatSin :: State -> State
|
||||
instructionFloatSin state@(State {_float = f1 : fs}) = state {_float = sin f1 : fs}
|
||||
|
@ -96,8 +96,8 @@ instructionDup state accessor =
|
||||
instructionPop :: State -> Lens' State [a] -> State
|
||||
instructionPop state accessor = state & accessor .~ drop 1 (view accessor state)
|
||||
|
||||
instructionIsEmpty :: State -> Lens' State [a] -> State
|
||||
instructionIsEmpty state@(State {_bool = bs}) accessor = state{_bool = null (view accessor state) : bs}
|
||||
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
|
||||
|
@ -112,8 +112,8 @@ instructionIntShove state = instructionShove state int
|
||||
instructionIntShoveDup :: State -> State
|
||||
instructionIntShoveDup state = instructionShoveDup state int
|
||||
|
||||
instructionIntIsEmpty :: State -> State
|
||||
instructionIntIsEmpty state = instructionIsEmpty state int
|
||||
instructionIntIsStackEmpty :: State -> State
|
||||
instructionIntIsStackEmpty state = instructionIsStackEmpty state int
|
||||
|
||||
instructionIntDupItems :: State -> State
|
||||
instructionIntDupItems = instructionDupItems int
|
||||
|
@ -224,8 +224,8 @@ instructionStringYank state = instructionYank state string
|
||||
instructionStringYankDup :: State -> State
|
||||
instructionStringYankDup state = instructionYankDup state string
|
||||
|
||||
instructionStringIsEmpty :: State -> State
|
||||
instructionStringIsEmpty state = instructionIsEmpty state string
|
||||
instructionStringIsStackEmpty :: State -> State
|
||||
instructionStringIsStackEmpty state = instructionIsStackEmpty state string
|
||||
|
||||
instructionStringShove :: State -> State
|
||||
instructionStringShove state = instructionShove state string
|
||||
|
@ -96,8 +96,8 @@ instructionVectorBoolYank state = instructionYank state vectorBool
|
||||
instructionVectorBoolYankDup :: State -> State
|
||||
instructionVectorBoolYankDup state = instructionYankDup state vectorBool
|
||||
|
||||
instructionVectorBoolStackIsEmpty :: State -> State
|
||||
instructionVectorBoolStackIsEmpty state = instructionIsEmpty state vectorBool
|
||||
instructionVectorBoolIsStackEmpty :: State -> State
|
||||
instructionVectorBoolIsStackEmpty state = instructionIsStackEmpty state vectorBool
|
||||
|
||||
instructionVectorBoolShove :: State -> State
|
||||
instructionVectorBoolShove state = instructionShove state vectorBool
|
||||
|
@ -96,8 +96,8 @@ instructionVectorCharYank state = instructionYank state vectorChar
|
||||
instructionVectorCharYankDup :: State -> State
|
||||
instructionVectorCharYankDup state = instructionYankDup state vectorChar
|
||||
|
||||
instructionVectorCharStackIsEmpty :: State -> State
|
||||
instructionVectorCharStackIsEmpty state = instructionIsEmpty state vectorChar
|
||||
instructionVectorCharIsStackEmpty :: State -> State
|
||||
instructionVectorCharIsStackEmpty state = instructionIsStackEmpty state vectorChar
|
||||
|
||||
instructionVectorCharShove :: State -> State
|
||||
instructionVectorCharShove state = instructionShove state vectorChar
|
||||
|
@ -96,8 +96,8 @@ instructionVectorFloatYank state = instructionYank state vectorFloat
|
||||
instructionVectorFloatYankDup :: State -> State
|
||||
instructionVectorFloatYankDup state = instructionYankDup state vectorFloat
|
||||
|
||||
instructionVectorFloatStackIsEmpty :: State -> State
|
||||
instructionVectorFloatStackIsEmpty state = instructionIsEmpty state vectorFloat
|
||||
instructionVectorFloatIsStackEmpty :: State -> State
|
||||
instructionVectorFloatIsStackEmpty state = instructionIsStackEmpty state vectorFloat
|
||||
|
||||
instructionVectorFloatShove :: State -> State
|
||||
instructionVectorFloatShove state = instructionShove state vectorFloat
|
||||
|
@ -96,8 +96,8 @@ instructionVectorIntYank state = instructionYank state vectorChar
|
||||
instructionVectorIntYankDup :: State -> State
|
||||
instructionVectorIntYankDup state = instructionYankDup state vectorChar
|
||||
|
||||
instructionVectorIntStackIsEmpty :: State -> State
|
||||
instructionVectorIntStackIsEmpty state = instructionIsEmpty state vectorChar
|
||||
instructionVectorIntIsStackEmpty :: State -> State
|
||||
instructionVectorIntIsStackEmpty state = instructionIsStackEmpty state vectorChar
|
||||
|
||||
instructionVectorIntShove :: State -> State
|
||||
instructionVectorIntShove state = instructionShove state vectorChar
|
||||
|
@ -96,8 +96,8 @@ instructionVectorStringYank state = instructionYank state vectorString
|
||||
instructionVectorStringYankDup :: State -> State
|
||||
instructionVectorStringYankDup state = instructionYankDup state vectorString
|
||||
|
||||
instructionVectorStringStackIsEmpty :: State -> State
|
||||
instructionVectorStringStackIsEmpty state = instructionIsEmpty state vectorString
|
||||
instructionVectorStringIsStackEmpty :: State -> State
|
||||
instructionVectorStringIsStackEmpty state = instructionIsStackEmpty state vectorString
|
||||
|
||||
instructionVectorStringShove :: State -> State
|
||||
instructionVectorStringShove state = instructionShove state vectorString
|
||||
|
Loading…
x
Reference in New Issue
Block a user