instruction list, comment cleanup, todos
This commit is contained in:
parent
194c025486
commit
2404e7e5e1
5
TODO.md
5
TODO.md
@ -4,8 +4,11 @@
|
||||
|
||||
- [ ] Make all vector functions applicable to string functions and vice versa
|
||||
- [ ] Implement all functions as seen in propeller
|
||||
- [ ] Implement all functions as seen in the specification
|
||||
- [ ] Implement Linear Algebra functions as specified in the previous papers
|
||||
- [ ] Add a function to sort a vector
|
||||
- [ ] Add a function to sort a vector forward and backwards
|
||||
- [ ] Disambiguate isEmpty and stackIsEmpty
|
||||
- [ ] Rename Logical to Bool
|
||||
- [x] Make int yank, shove, yankdup, and shovedup generic
|
||||
|
||||
## PushGP TODO
|
||||
|
@ -12,6 +12,19 @@ module Instructions
|
||||
module Instructions.VectorStringInstructions,
|
||||
module Instructions.VectorLogicalInstructions,
|
||||
module Instructions.VectorCharInstructions,
|
||||
allIntInstructions,
|
||||
allFloatInstructions,
|
||||
allBoolInstructions,
|
||||
allCharInstructions,
|
||||
allCodeInstructions,
|
||||
allExecInstructions,
|
||||
allStringInstructions,
|
||||
allVectorIntInstructions,
|
||||
allVectorFloatInstructions,
|
||||
allVectorCharInstructions,
|
||||
allVectorStringInstructions,
|
||||
allVectorBoolInstructions,
|
||||
allInstructions
|
||||
)
|
||||
where
|
||||
|
||||
@ -30,32 +43,462 @@ import Instructions.VectorLogicalInstructions
|
||||
import Instructions.VectorStringInstructions
|
||||
import State
|
||||
|
||||
intInstructions :: [Gene]
|
||||
intInstructions = [
|
||||
StateFunc (instructionIntFromFloat, "instructionIntFromFloat"),
|
||||
StateFunc (instructionIntFromBool, "instructionIntFromBool"),
|
||||
StateFunc (instructionIntAdd, "instructionIntAdd"),
|
||||
StateFunc (instructionIntSub, "instructionIntSub"),
|
||||
StateFunc (instructionIntMul, "instructionIntMul"),
|
||||
StateFunc (instructionIntDiv, "instructionIntDiv"),
|
||||
StateFunc (instructionIntMod, "instructionIntMod"),
|
||||
StateFunc (instructionIntMin, "instructionIntMin"),
|
||||
StateFunc (instructionIntMax, "instructionIntMax"),
|
||||
StateFunc (instructionIntInc, "instructionIntInc"),
|
||||
StateFunc (instructionIntDec, "instructionIntDec"),
|
||||
StateFunc (instructionIntLT, "instructionIntLT"),
|
||||
StateFunc (instructionIntGT, "instructionIntGT"),
|
||||
StateFunc (instructionIntLTE, "instructionIntLTE"),
|
||||
StateFunc (instructionIntGTE, "instructionIntGTE"),
|
||||
StateFunc (instructionIntDup, "instructionIntDup"),
|
||||
StateFunc (instructionIntPop, "instructionIntPop"),
|
||||
StateFunc (instructionIntDupN, "instructionIntDupN"),
|
||||
StateFunc (instructionIntSwap, "instructionIntSwap"),
|
||||
StateFunc (instructionIntRot, "instructionIntRot"),
|
||||
StateFunc (instructionIntFlush, "instructionIntFlush"),
|
||||
StateFunc (instructionIntEq, "instructionIntEq"),
|
||||
StateFunc (instructionIntYank, "instructionIntYank"),
|
||||
StateFunc (instructionIntYankDup, "instructionIntYankDup"),
|
||||
StateFunc (instructionIntShove, "instructionIntShove"),
|
||||
StateFunc (instructionIntIsEmpty, "instructionIntIsEmpty")
|
||||
allIntInstructions :: [Gene]
|
||||
allIntInstructions = map StateFunc [
|
||||
(instructionIntFromFloat, "instructionIntFromFloat"),
|
||||
(instructionIntFromBool, "instructionIntFromBool"),
|
||||
(instructionIntAdd, "instructionIntAdd"),
|
||||
(instructionIntSub, "instructionIntSub"),
|
||||
(instructionIntMul, "instructionIntMul"),
|
||||
(instructionIntDiv, "instructionIntDiv"),
|
||||
(instructionIntMod, "instructionIntMod"),
|
||||
(instructionIntMin, "instructionIntMin"),
|
||||
(instructionIntMax, "instructionIntMax"),
|
||||
(instructionIntInc, "instructionIntInc"),
|
||||
(instructionIntDec, "instructionIntDec"),
|
||||
(instructionIntLT, "instructionIntLT"),
|
||||
(instructionIntGT, "instructionIntGT"),
|
||||
(instructionIntLTE, "instructionIntLTE"),
|
||||
(instructionIntGTE, "instructionIntGTE"),
|
||||
(instructionIntDup, "instructionIntDup"),
|
||||
(instructionIntPop, "instructionIntPop"),
|
||||
(instructionIntDupN, "instructionIntDupN"),
|
||||
(instructionIntSwap, "instructionIntSwap"),
|
||||
(instructionIntRot, "instructionIntRot"),
|
||||
(instructionIntFlush, "instructionIntFlush"),
|
||||
(instructionIntEq, "instructionIntEq"),
|
||||
(instructionIntYank, "instructionIntYank"),
|
||||
(instructionIntYankDup, "instructionIntYankDup"),
|
||||
(instructionIntShove, "instructionIntShove"),
|
||||
(instructionIntIsEmpty, "instructionIntIsEmpty")
|
||||
]
|
||||
|
||||
allFloatInstructions :: [Gene]
|
||||
allFloatInstructions = map StateFunc [
|
||||
(instructionFloatFromInt, "instructionFloatFromInt"),
|
||||
(instructionFloatFromBool, "instructionFloatFromBool"),
|
||||
(instructionFloatAdd, "instructionFloatAdd"),
|
||||
(instructionFloatSub, "instructionFloatSub"),
|
||||
(instructionFloatMul, "instructionFloatMul"),
|
||||
(instructionFloatDiv, "instructionFloatDiv"),
|
||||
(instructionFloatMod, "instructionFloatMod"),
|
||||
(instructionFloatMin, "instructionFloatMin"),
|
||||
(instructionFloatMax, "instructionFloatMax"),
|
||||
(instructionFloatInc, "instructionFloatInc"),
|
||||
(instructionFloatDec, "instructionFloatDec"),
|
||||
(instructionFloatLT, "instructionFloatLT"),
|
||||
(instructionFloatGT, "instructionFloatGT"),
|
||||
(instructionFloatLTE, "instructionFloatLTE"),
|
||||
(instructionFloatGTE, "instructionFloatGTE"),
|
||||
(instructionFloatDup, "instructionFloatDup"),
|
||||
(instructionFloatPop, "instructionFloatPop"),
|
||||
(instructionFloatDupN, "instructionFloatDupN"),
|
||||
(instructionFloatSwap, "instructionFloatSwap"),
|
||||
(instructionFloatRot, "instructionFloatRot"),
|
||||
(instructionFloatFlush, "instructionFloatFlush"),
|
||||
(instructionFloatEq, "instructionFloatEq"),
|
||||
(instructionFloatYank, "instructionFloatYank"),
|
||||
(instructionFloatYankDup, "instructionFloatYankDup"),
|
||||
(instructionFloatShove, "instructionFloatShove"),
|
||||
(instructionFloatIsEmpty, "instructionFloatIsEmpty")
|
||||
]
|
||||
|
||||
allBoolInstructions :: [Gene]
|
||||
allBoolInstructions = map StateFunc [
|
||||
(instructionBoolFromInt, "instructionBoolFromInt"),
|
||||
(instructionBoolFromFloat, "instructionBoolFromFloat"),
|
||||
(instructionBoolAnd, "instructionBoolAnd"),
|
||||
(instructionBoolInvertFirstThenAnd, "instructionBoolInvertFirstThenAnd"),
|
||||
(instructionBoolInvertSecondThenAnd, "instructionBoolInvertSecondThenAnd"),
|
||||
(instructionBoolOr, "instructionBoolOr"),
|
||||
(instructionBoolXor, "instructionBoolXor"),
|
||||
(instructionBoolPop, "instructionBoolPop"),
|
||||
(instructionBoolDup, "instructionBoolDup"),
|
||||
(instructionBoolDupN, "instructionBoolDupN"),
|
||||
(instructionBoolSwap, "instructionBoolSwap"),
|
||||
(instructionBoolRot, "instructionBoolRot"),
|
||||
(instructionBoolFlush, "instructionBoolFlush"),
|
||||
(instructionBoolEq, "instructionBoolEq"),
|
||||
(instructionBoolStackDepth, "instructionBoolStackDepth"),
|
||||
(instructionBoolYank, "instructionBoolYank"),
|
||||
(instructionBoolYankDup, "instructionBoolYankDup"),
|
||||
(instructionBoolShove, "instructionBoolShove"),
|
||||
(instructionBoolShoveDup, "instructionBoolShoveDup"),
|
||||
(instructionBoolIsEmpty, "instructionBoolIsEmpty")
|
||||
]
|
||||
|
||||
allCharInstructions :: [Gene]
|
||||
allCharInstructions = map StateFunc [
|
||||
(instructionCharConcat, "instructionCharConcat"),
|
||||
(instructionCharFromFirstChar, "instructionCharFromFirstChar"),
|
||||
(instructionCharFromLastChar, "instructionCharFromLastChar"),
|
||||
(instructionCharFromNthChar, "instructionCharFromNthChar"),
|
||||
(instructionCharIsWhitespace, "instructionCharIsWhitespace"),
|
||||
(instructionCharIsLetter, "instructionCharIsLetter"),
|
||||
(instructionCharIsDigit, "instructionCharIsDigit"),
|
||||
(instructionCharFromBool, "instructionCharFromBool"),
|
||||
(instructionCharFromAsciiInt, "instructionCharFromAsciiInt"),
|
||||
(instructionCharFromAsciiFloat, "instructionCharFromAsciiFloat"),
|
||||
(instructionCharsFromString, "instructionCharsFromString"),
|
||||
(instructionCharPop, "instructionCharPop"),
|
||||
(instructionCharDup, "instructionCharDup"),
|
||||
(instructionCharDupN, "instructionCharDupN"),
|
||||
(instructionCharSwap, "instructionCharSwap"),
|
||||
(instructionCharRot, "instructionCharRot"),
|
||||
(instructionCharFlush, "instructionCharFlush"),
|
||||
(instructionCharEq, "instructionCharEq"),
|
||||
(instructionCharStackDepth, "instructionCharStackDepth"),
|
||||
(instructionCharYank, "instructionCharYank"),
|
||||
(instructionCharYankDup, "instructionCharYankDup"),
|
||||
(instructionCharShove, "instructionCharShove"),
|
||||
(instructionCharShoveDup, "instructionCharShoveDup"),
|
||||
(instructionCharIsEmpty, "instructionCharIsEmpty")
|
||||
]
|
||||
|
||||
allCodeInstructions :: [Gene]
|
||||
allCodeInstructions = map StateFunc [
|
||||
(instructionCodePop, "instructionCodePop"),
|
||||
(instructionCodeIsCodeBlock, "instructionCodeIsCodeBlock"),
|
||||
(instructionCodeIsSingular, "instructionCodeIsSingular"),
|
||||
(instructionCodeLength, "instructionCodeLength"),
|
||||
(instructionCodeFirst, "instructionCodeFirst"),
|
||||
(instructionCodeLast, "instructionCodeLast"),
|
||||
(instructionCodeTail, "instructionCodeTail"),
|
||||
(instructionCodeInit, "instructionCodeInit"),
|
||||
(instructionCodeWrap, "instructionCodeWrap"),
|
||||
(instructionCodeList, "instructionCodeList"),
|
||||
(instructionCodeCombine, "instructionCodeCombine"),
|
||||
(instructionCodeDo, "instructionCodeDo"),
|
||||
(instructionCodeDoDup, "instructionCodeDoDup"),
|
||||
(instructionCodeDoThenPop, "instructionCodeDoThenPop"),
|
||||
(instructionCodeDoRange, "instructionCodeDoRange"),
|
||||
(instructionCodeDoCount, "instructionCodeDoCount"),
|
||||
(instructionCodeDoTimes, "instructionCodeDoTimes"),
|
||||
(instructionCodeIf, "instructionCodeIf"),
|
||||
(instructionCodeWhen, "instructionCodeWhen"),
|
||||
(instructionCodeMember, "instructionCodeMember"),
|
||||
(instructionCodeN, "instructionCodeN"),
|
||||
(instructionMakeEmptyCodeBlock, "instructionMakeEmptyCodeBlock"),
|
||||
(instructionIsEmptyCodeBlock, "instructionIsEmptyCodeBlock"),
|
||||
(instructionCodeSize, "instructionCodeSize"),
|
||||
(instructionCodeExtract, "instructionCodeExtract"),
|
||||
(instructionCodeInsert, "instructionCodeInsert"),
|
||||
(instructionCodeFirstPosition, "instructionCodeFirstPosition"),
|
||||
(instructionCodeReverse, "instructionCodeReverse"),
|
||||
(instructionCodeDup, "instructionCodeDup"),
|
||||
(instructionCodeDupN, "instructionCodeDupN"),
|
||||
(instructionCodeDup, "instructionCodeDup"),
|
||||
(instructionCodeDupN, "instructionCodeDupN"),
|
||||
(instructionCodeSwap, "instructionCodeSwap"),
|
||||
(instructionCodeRot, "instructionCodeRot"),
|
||||
(instructionCodeFlush, "instructionCodeFlush"),
|
||||
(instructionCodeEq, "instructionCodeEq"),
|
||||
(instructionCodeStackDepth, "instructionCodeStackDepth"),
|
||||
(instructionCodeYank, "instructionCodeYank"),
|
||||
(instructionCodeYankDup, "instructionCodeYankDup"),
|
||||
(instructionCodeShove, "instructionCodeShove"),
|
||||
(instructionCodeShoveDup, "instructionCodeShoveDup"),
|
||||
(instructionCodeStackIsEmpty, "instructionCodeStackIsEmpty"),
|
||||
(instructionCodeFromBool, "instructionCodeFromBool"),
|
||||
(instructionCodeFromInt, "instructionCodeFromInt"),
|
||||
(instructionCodeFromChar, "instructionCodeFromChar"),
|
||||
(instructionCodeFromFloat, "instructionCodeFromFloat"),
|
||||
(instructionCodeFromString, "instructionCodeFromString"),
|
||||
(instructionCodeFromVectorInt, "instructionCodeFromVectorInt"),
|
||||
(instructionCodeFromVectorFloat, "instructionCodeFromVectorFloat"),
|
||||
(instructionCodeFromVectorString, "instructionCodeFromVectorString"),
|
||||
(instructionCodeFromVectorBool, "instructionCodeFromVectorBool"),
|
||||
(instructionCodeFromVectorChar, "instructionCodeFromVectorChar"),
|
||||
(instructionCodeFromExec, "instructionCodeFromExec")
|
||||
]
|
||||
|
||||
allExecInstructions :: [Gene]
|
||||
allExecInstructions = map StateFunc [
|
||||
(instructionExecIf, "instructionExecIf"),
|
||||
(instructionExecDup, "instructionExecDup"),
|
||||
(instructionExecDupN, "instructionExecDupN"),
|
||||
(instructionExecPop, "instructionExecPop"),
|
||||
(instructionExecSwap, "instructionExecSwap"),
|
||||
(instructionExecRot, "instructionExecRot"),
|
||||
(instructionExecFlush, "instructionExecFlush"),
|
||||
(instructionExecEq, "instructionExecEq"),
|
||||
(instructionExecStackDepth, "instructionExecStackDepth"),
|
||||
(instructionExecYank, "instructionExecYank"),
|
||||
(instructionExecYankDup, "instructionExecYankDup"),
|
||||
(instructionExecShove, "instructionExecShove"),
|
||||
(instructionExecShoveDup, "instructionExecShoveDup"),
|
||||
(instructionExecIsEmpty, "instructionExecIsEmpty"),
|
||||
(instructionExecDoRange, "instructionExecDoRange"),
|
||||
(instructionExecDoCount, "instructionExecDoCount"),
|
||||
(instructionExecDoTimes, "instructionExecDoTimes"),
|
||||
(instructionExecWhile, "instructionExecWhile"),
|
||||
(instructionExecDoWhile, "instructionExecDoWhile"),
|
||||
(instructionExecWhen, "instructionExecWhen")
|
||||
]
|
||||
|
||||
allStringInstructions :: [Gene]
|
||||
allStringInstructions = map StateFunc [
|
||||
(instructionStringConcat, "instructionStringConcat"),
|
||||
(instructionStringSwap, "instructionStringSwap"),
|
||||
(instructionStringInsertString, "instructionStringInsertString"),
|
||||
(instructionStringFromFirstChar, "instructionStringFromFirstChar"),
|
||||
(instructionStringFromLastChar, "instructionStringFromLastChar"),
|
||||
(instructionStringFromNthChar, "instructionStringFromNthChar"),
|
||||
(instructionStringIndexOfString, "instructionStringIndexOfString"),
|
||||
(instructionStringContainsString, "instructionStringContainsString"),
|
||||
(instructionStringSplitOnString, "instructionStringSplitOnString"),
|
||||
(instructionStringReplaceFirstString, "instructionStringReplaceFirstString"),
|
||||
(instructionStringReplaceNString, "instructionStringReplaceNString"),
|
||||
(instructionStringReplaceAllString, "instructionStringReplaceAllString"),
|
||||
(instructionStringRemoveFirstString, "instructionStringRemoveFirstString"),
|
||||
(instructionStringRemoveNString, "instructionStringRemoveNString"),
|
||||
(instructionStringRemoveAllString, "instructionStringRemoveAllString"),
|
||||
(instructionStringOccurrencesOfString, "instructionStringOccurrencesOfString"),
|
||||
(instructionStringInsertChar, "instructionStringInsertChar"),
|
||||
(instructionStringContainsChar, "instructionStringContainsChar"),
|
||||
(instructionStringIndexOfChar, "instructionStringIndexOfChar"),
|
||||
(instructionStringSplitOnChar, "instructionStringSplitOnChar"),
|
||||
(instructionStringReplaceFirstChar, "instructionStringReplaceFirstChar"),
|
||||
(instructionStringReplaceNChar, "instructionStringReplaceNChar"),
|
||||
(instructionStringReplaceAllChar, "instructionStringReplaceAllChar"),
|
||||
(instructionStringRemoveFirstChar, "instructionStringRemoveFirstChar"),
|
||||
(instructionStringRemoveNChar, "instructionStringRemoveNChar"),
|
||||
(instructionStringRemoveAllChar, "instructionStringRemoveAllChar"),
|
||||
(instructionStringOccurrencesOfChar, "instructionStringOccurrencesOfChar"),
|
||||
(instructionStringReverse, "instructionStringReverse"),
|
||||
(instructionStringHead, "instructionStringHead"),
|
||||
(instructionStringTail, "instructionStringTail"),
|
||||
(instructionStringAppendChar, "instructionStringAppendChar"),
|
||||
(instructionStringRest, "instructionStringRest"),
|
||||
(instructionStringButLast, "instructionStringButLast"),
|
||||
(instructionStringDrop, "instructionStringDrop"),
|
||||
(instructionStringButLastN, "instructionStringButLastN"),
|
||||
(instructionStringLength, "instructionStringLength"),
|
||||
(instructionStringMakeEmpty, "instructionStringMakeEmpty"),
|
||||
(instructionStringIsEmptyString, "instructionStringIsEmptyString"),
|
||||
(instructionStringRemoveNth, "instructionStringRemoveNth"),
|
||||
(instructionStringSetNth, "instructionStringSetNth"),
|
||||
(instructionStringStripWhitespace, "instructionStringStripWhitespace"),
|
||||
(instructionStringFromBool, "instructionStringFromBool"),
|
||||
(instructionStringFromInt, "instructionStringFromInt"),
|
||||
(instructionStringFromFloat, "instructionStringFromFloat"),
|
||||
(instructionStringFromChar, "instructionStringFromChar"),
|
||||
(instructionStringPop, "instructionStringPop"),
|
||||
(instructionStringDup, "instructionStringDup"),
|
||||
(instructionStringDupN, "instructionStringDupN"),
|
||||
(instructionStringSwap, "instructionStringSwap"),
|
||||
(instructionStringRot, "instructionStringRot"),
|
||||
(instructionStringFlush, "instructionStringFlush"),
|
||||
(instructionStringEq, "instructionStringEq"),
|
||||
(instructionStringStackDepth, "instructionStringStackDepth"),
|
||||
(instructionStringYank, "instructionStringYank"),
|
||||
(instructionStringYankDup, "instructionStringYankDup"),
|
||||
(instructionStringShove, "instructionStringShove"),
|
||||
(instructionStringShoveDup, "instructionStringShoveDup"),
|
||||
(instructionStringIsEmpty, "instructionStringIsEmpty")
|
||||
]
|
||||
|
||||
allVectorIntInstructions :: [Gene]
|
||||
allVectorIntInstructions = map StateFunc [
|
||||
(instructionVectorIntConcat, "instructionVectorIntConcat"),
|
||||
(instructionVectorIntConj, "instructionVectorIntConj"),
|
||||
(instructionVectorIntTakeN, "instructionVectorIntTakeN"),
|
||||
(instructionVectorIntSubVector, "instructionVectorIntSubVector"),
|
||||
(instructionVectorIntFirst, "instructionVectorIntFirst"),
|
||||
(instructionVectorIntLast, "instructionVectorIntLast"),
|
||||
(instructionVectorIntNth, "instructionVectorIntNth"),
|
||||
(instructionVectorIntRest, "instructionVectorIntRest"),
|
||||
(instructionVectorIntButLast, "instructionVectorIntButLast"),
|
||||
(instructionVectorIntLength, "instructionVectorIntLength"),
|
||||
(instructionVectorIntReverse, "instructionVectorIntReverse"),
|
||||
(instructionVectorIntPushAll, "instructionVectorIntPushAll"),
|
||||
(instructionVectorIntMakeEmpty, "instructionVectorIntMakeEmpty"),
|
||||
(instructionVectorIntIsEmpty, "instructionVectorIntIsEmpty"),
|
||||
(instructionVectorIntIndexOf, "instructionVectorIntIndexOf"),
|
||||
(instructionVectorIntOccurrencesOf, "instructionVectorIntOccurrencesOf"),
|
||||
(instructionVectorIntSetNth, "instructionVectorIntSetNth"),
|
||||
(instructionVectorIntReplace, "instructionVectorIntReplace"),
|
||||
(instructionVectorIntReplaceFirst, "instructionVectorIntReplaceFirst"),
|
||||
(instructionVectorIntRemove, "instructionVectorIntRemove"),
|
||||
(instructionVectorIntIterate, "instructionVectorIntIterate"),
|
||||
(instructionVectorIntPop, "instructionVectorIntPop"),
|
||||
(instructionVectorIntDup, "instructionVectorIntDup"),
|
||||
(instructionVectorIntDupN, "instructionVectorIntDupN"),
|
||||
(instructionVectorIntSwap, "instructionVectorIntSwap"),
|
||||
(instructionVectorIntRot, "instructionVectorIntRot"),
|
||||
(instructionVectorIntFlush, "instructionVectorIntFlush"),
|
||||
(instructionVectorIntEq, "instructionVectorIntEq"),
|
||||
(instructionVectorIntStackDepth, "instructionVectorIntStackDepth"),
|
||||
(instructionVectorIntYank, "instructionVectorIntYank"),
|
||||
(instructionVectorIntYankDup, "instructionVectorIntYankDup"),
|
||||
(instructionVectorIntShove, "instructionVectorIntShove"),
|
||||
(instructionVectorIntShoveDup, "instructionVectorIntShoveDup"),
|
||||
(instructionVectorIntStackIsEmpty, "instructionVectorIntStackIsEmpty")
|
||||
]
|
||||
|
||||
allVectorFloatInstructions :: [Gene]
|
||||
allVectorFloatInstructions = map StateFunc [
|
||||
(instructionVectorFloatConcat, "instructionVectorFloatConcat"),
|
||||
(instructionVectorFloatConj, "instructionVectorFloatConj"),
|
||||
(instructionVectorFloatTakeN, "instructionVectorFloatTakeN"),
|
||||
(instructionVectorFloatSubVector, "instructionVectorFloatSubVector"),
|
||||
(instructionVectorFloatFirst, "instructionVectorFloatFirst"),
|
||||
(instructionVectorFloatLast, "instructionVectorFloatLast"),
|
||||
(instructionVectorFloatNth, "instructionVectorFloatNth"),
|
||||
(instructionVectorFloatRest, "instructionVectorFloatRest"),
|
||||
(instructionVectorFloatButLast, "instructionVectorFloatButLast"),
|
||||
(instructionVectorFloatLength, "instructionVectorFloatLength"),
|
||||
(instructionVectorFloatReverse, "instructionVectorFloatReverse"),
|
||||
(instructionVectorFloatPushAll, "instructionVectorFloatPushAll"),
|
||||
(instructionVectorFloatMakeEmpty, "instructionVectorFloatMakeEmpty"),
|
||||
(instructionVectorFloatIsEmpty, "instructionVectorFloatIsEmpty"),
|
||||
(instructionVectorFloatIndexOf, "instructionVectorFloatIndexOf"),
|
||||
(instructionVectorFloatOccurrencesOf, "instructionVectorFloatOccurrencesOf"),
|
||||
(instructionVectorFloatSetNth, "instructionVectorFloatSetNth"),
|
||||
(instructionVectorFloatReplace, "instructionVectorFloatReplace"),
|
||||
(instructionVectorFloatReplaceFirst, "instructionVectorFloatReplaceFirst"),
|
||||
(instructionVectorFloatRemove, "instructionVectorFloatRemove"),
|
||||
(instructionVectorFloatIterate, "instructionVectorFloatIterate"),
|
||||
(instructionVectorFloatPop, "instructionVectorFloatPop"),
|
||||
(instructionVectorFloatDup, "instructionVectorFloatDup"),
|
||||
(instructionVectorFloatDupN, "instructionVectorFloatDupN"),
|
||||
(instructionVectorFloatSwap, "instructionVectorFloatSwap"),
|
||||
(instructionVectorFloatRot, "instructionVectorFloatRot"),
|
||||
(instructionVectorFloatFlush, "instructionVectorFloatFlush"),
|
||||
(instructionVectorFloatEq, "instructionVectorFloatEq"),
|
||||
(instructionVectorFloatStackDepth, "instructionVectorFloatStackDepth"),
|
||||
(instructionVectorFloatYank, "instructionVectorFloatYank"),
|
||||
(instructionVectorFloatYankDup, "instructionVectorFloatYankDup"),
|
||||
(instructionVectorFloatShove, "instructionVectorFloatShove"),
|
||||
(instructionVectorFloatShoveDup, "instructionVectorFloatShoveDup"),
|
||||
(instructionVectorFloatStackIsEmpty, "instructionVectorFloatStackIsEmpty")
|
||||
]
|
||||
|
||||
allVectorCharInstructions :: [Gene]
|
||||
allVectorCharInstructions = map StateFunc [
|
||||
(instructionVectorCharConcat, "instructionVectorCharConcat"),
|
||||
(instructionVectorCharConj, "instructionVectorCharConj"),
|
||||
(instructionVectorCharTakeN, "instructionVectorCharTakeN"),
|
||||
(instructionVectorCharSubVector, "instructionVectorCharSubVector"),
|
||||
(instructionVectorCharFirst, "instructionVectorCharFirst"),
|
||||
(instructionVectorCharLast, "instructionVectorCharLast"),
|
||||
(instructionVectorCharNth, "instructionVectorCharNth"),
|
||||
(instructionVectorCharRest, "instructionVectorCharRest"),
|
||||
(instructionVectorCharButLast, "instructionVectorCharButLast"),
|
||||
(instructionVectorCharLength, "instructionVectorCharLength"),
|
||||
(instructionVectorCharReverse, "instructionVectorCharReverse"),
|
||||
(instructionVectorCharPushAll, "instructionVectorCharPushAll"),
|
||||
(instructionVectorCharMakeEmpty, "instructionVectorCharMakeEmpty"),
|
||||
(instructionVectorCharIsEmpty, "instructionVectorCharIsEmpty"),
|
||||
(instructionVectorCharIndexOf, "instructionVectorCharIndexOf"),
|
||||
(instructionVectorCharOccurrencesOf, "instructionVectorCharOccurrencesOf"),
|
||||
(instructionVectorCharSetNth, "instructionVectorCharSetNth"),
|
||||
(instructionVectorCharReplace, "instructionVectorCharReplace"),
|
||||
(instructionVectorCharReplaceFirst, "instructionVectorCharReplaceFirst"),
|
||||
(instructionVectorCharRemove, "instructionVectorCharRemove"),
|
||||
(instructionVectorCharIterate, "instructionVectorCharIterate"),
|
||||
(instructionVectorCharPop, "instructionVectorCharPop"),
|
||||
(instructionVectorCharDup, "instructionVectorCharDup"),
|
||||
(instructionVectorCharDupN, "instructionVectorCharDupN"),
|
||||
(instructionVectorCharSwap, "instructionVectorCharSwap"),
|
||||
(instructionVectorCharRot, "instructionVectorCharRot"),
|
||||
(instructionVectorCharFlush, "instructionVectorCharFlush"),
|
||||
(instructionVectorCharEq, "instructionVectorCharEq"),
|
||||
(instructionVectorCharStackDepth, "instructionVectorCharStackDepth"),
|
||||
(instructionVectorCharYank, "instructionVectorCharYank"),
|
||||
(instructionVectorCharYankDup, "instructionVectorCharYankDup"),
|
||||
(instructionVectorCharShove, "instructionVectorCharShove"),
|
||||
(instructionVectorCharShoveDup, "instructionVectorCharShoveDup"),
|
||||
(instructionVectorCharStackIsEmpty, "instructionVectorCharStackIsEmpty")
|
||||
]
|
||||
|
||||
allVectorStringInstructions :: [Gene]
|
||||
allVectorStringInstructions = map StateFunc [
|
||||
(instructionVectorStringConcat, "instructionVectorStringConcat"),
|
||||
(instructionVectorStringConj, "instructionVectorStringConj"),
|
||||
(instructionVectorStringTakeN, "instructionVectorStringTakeN"),
|
||||
(instructionVectorStringSubVector, "instructionVectorStringSubVector"),
|
||||
(instructionVectorStringFirst, "instructionVectorStringFirst"),
|
||||
(instructionVectorStringLast, "instructionVectorStringLast"),
|
||||
(instructionVectorStringNth, "instructionVectorStringNth"),
|
||||
(instructionVectorStringRest, "instructionVectorStringRest"),
|
||||
(instructionVectorStringButLast, "instructionVectorStringButLast"),
|
||||
(instructionVectorStringLength, "instructionVectorStringLength"),
|
||||
(instructionVectorStringReverse, "instructionVectorStringReverse"),
|
||||
(instructionVectorStringPushAll, "instructionVectorStringPushAll"),
|
||||
(instructionVectorStringMakeEmpty, "instructionVectorStringMakeEmpty"),
|
||||
(instructionVectorStringIsEmpty, "instructionVectorStringIsEmpty"),
|
||||
(instructionVectorStringIndexOf, "instructionVectorStringIndexOf"),
|
||||
(instructionVectorStringOccurrencesOf, "instructionVectorStringOccurrencesOf"),
|
||||
(instructionVectorStringSetNth, "instructionVectorStringSetNth"),
|
||||
(instructionVectorStringReplace, "instructionVectorStringReplace"),
|
||||
(instructionVectorStringReplaceFirst, "instructionVectorStringReplaceFirst"),
|
||||
(instructionVectorStringRemove, "instructionVectorStringRemove"),
|
||||
(instructionVectorStringIterate, "instructionVectorStringIterate"),
|
||||
(instructionVectorStringPop, "instructionVectorStringPop"),
|
||||
(instructionVectorStringDup, "instructionVectorStringDup"),
|
||||
(instructionVectorStringDupN, "instructionVectorStringDupN"),
|
||||
(instructionVectorStringSwap, "instructionVectorStringSwap"),
|
||||
(instructionVectorStringRot, "instructionVectorStringRot"),
|
||||
(instructionVectorStringFlush, "instructionVectorStringFlush"),
|
||||
(instructionVectorStringEq, "instructionVectorStringEq"),
|
||||
(instructionVectorStringStackDepth, "instructionVectorStringStackDepth"),
|
||||
(instructionVectorStringYank, "instructionVectorStringYank"),
|
||||
(instructionVectorStringYankDup, "instructionVectorStringYankDup"),
|
||||
(instructionVectorStringShove, "instructionVectorStringShove"),
|
||||
(instructionVectorStringShoveDup, "instructionVectorStringShoveDup"),
|
||||
(instructionVectorStringStackIsEmpty, "instructionVectorStringStackIsEmpty")
|
||||
]
|
||||
|
||||
allVectorBoolInstructions :: [Gene]
|
||||
allVectorBoolInstructions = map StateFunc [
|
||||
(instructionVectorBoolConcat, "instructionVectorBoolConcat"),
|
||||
(instructionVectorBoolConj, "instructionVectorBoolConj"),
|
||||
(instructionVectorBoolTakeN, "instructionVectorBoolTakeN"),
|
||||
(instructionVectorBoolSubVector, "instructionVectorBoolSubVector"),
|
||||
(instructionVectorBoolFirst, "instructionVectorBoolFirst"),
|
||||
(instructionVectorBoolLast, "instructionVectorBoolLast"),
|
||||
(instructionVectorBoolNth, "instructionVectorBoolNth"),
|
||||
(instructionVectorBoolRest, "instructionVectorBoolRest"),
|
||||
(instructionVectorBoolButLast, "instructionVectorBoolButLast"),
|
||||
(instructionVectorBoolLength, "instructionVectorBoolLength"),
|
||||
(instructionVectorBoolReverse, "instructionVectorBoolReverse"),
|
||||
(instructionVectorBoolPushAll, "instructionVectorBoolPushAll"),
|
||||
(instructionVectorBoolMakeEmpty, "instructionVectorBoolMakeEmpty"),
|
||||
(instructionVectorBoolIsEmpty, "instructionVectorBoolIsEmpty"),
|
||||
(instructionVectorBoolIndexOf, "instructionVectorBoolIndexOf"),
|
||||
(instructionVectorBoolOccurrencesOf, "instructionVectorBoolOccurrencesOf"),
|
||||
(instructionVectorBoolSetNth, "instructionVectorBoolSetNth"),
|
||||
(instructionVectorBoolReplace, "instructionVectorBoolReplace"),
|
||||
(instructionVectorBoolReplaceFirst, "instructionVectorBoolReplaceFirst"),
|
||||
(instructionVectorBoolRemove, "instructionVectorBoolRemove"),
|
||||
(instructionVectorBoolIterate, "instructionVectorBoolIterate"),
|
||||
(instructionVectorBoolPop, "instructionVectorBoolPop"),
|
||||
(instructionVectorBoolDup, "instructionVectorBoolDup"),
|
||||
(instructionVectorBoolDupN, "instructionVectorBoolDupN"),
|
||||
(instructionVectorBoolSwap, "instructionVectorBoolSwap"),
|
||||
(instructionVectorBoolRot, "instructionVectorBoolRot"),
|
||||
(instructionVectorBoolFlush, "instructionVectorBoolFlush"),
|
||||
(instructionVectorBoolEq, "instructionVectorBoolEq"),
|
||||
(instructionVectorBoolStackDepth, "instructionVectorBoolStackDepth"),
|
||||
(instructionVectorBoolYank, "instructionVectorBoolYank"),
|
||||
(instructionVectorBoolYankDup, "instructionVectorBoolYankDup"),
|
||||
(instructionVectorBoolShove, "instructionVectorBoolShove"),
|
||||
(instructionVectorBoolShoveDup, "instructionVectorBoolShoveDup"),
|
||||
(instructionVectorBoolStackIsEmpty, "instructionVectorBoolStackIsEmpty")
|
||||
]
|
||||
|
||||
allInstructions :: [Gene]
|
||||
allInstructions =
|
||||
allIntInstructions <>
|
||||
allFloatInstructions <>
|
||||
allBoolInstructions <>
|
||||
allCharInstructions <>
|
||||
allCodeInstructions <>
|
||||
allExecInstructions <>
|
||||
allStringInstructions <>
|
||||
allVectorIntInstructions <>
|
||||
allVectorFloatInstructions <>
|
||||
allVectorCharInstructions <>
|
||||
allVectorStringInstructions <>
|
||||
allVectorBoolInstructions
|
||||
|
@ -66,7 +66,6 @@ codeMember (Block _) (Block _) = False -- Can't compare two lists with `elem`
|
||||
codeMember (Block xs) ygene = ygene `elem` xs
|
||||
codeMember _ _ = False
|
||||
|
||||
-- I love list comprehensions
|
||||
codeRecursiveSize :: Gene -> Int
|
||||
codeRecursiveSize (Block xs) = sum [codeRecursiveSize x + if isBlock x then 1 else 0 | x <- xs]
|
||||
codeRecursiveSize _ = 1
|
||||
@ -224,11 +223,6 @@ instructionCodeInsert state@(State {_code = c1 : c2 : cs, _int = i1 : is}) =
|
||||
state{_code = Block (codeInsertAtPoint [c1] c2 index) : cs, _int = is}
|
||||
instructionCodeInsert state = state
|
||||
|
||||
-- How do I test if two functions are the same??????????
|
||||
-- This will impact the final case. This implementation can't determine
|
||||
-- if two functions are the same, so it assumes that they are.
|
||||
-- Maybe can test for equality by seeing if these two functions affect the current state
|
||||
-- in the same way.
|
||||
instructionCodeFirstPosition :: State -> State
|
||||
instructionCodeFirstPosition state@(State {_code = (Block []) : c2 : cs, _int = is}) = state {_code = cs, _int = (if c2 == Block [] then 0 else -1) : is}
|
||||
instructionCodeFirstPosition state@(State {_code = (Block c1) : c2 : cs, _int = is}) = state {_code = cs, _int = positionElem c1 c2 : is}
|
||||
|
@ -175,7 +175,6 @@ instructionStringStripWhitespace :: State -> State
|
||||
instructionStringStripWhitespace state@(State {_string = s1 : ss}) = state{_string = strip s1 : ss}
|
||||
instructionStringStripWhitespace state = state
|
||||
|
||||
-- Need to do uncons to all of the warnings in this mug
|
||||
instructionStringFromLens :: Show a => State -> Lens' State [a] -> State
|
||||
instructionStringFromLens state@(State {_string = ss}) accessor =
|
||||
case uncons (view accessor state) of
|
||||
|
Loading…
x
Reference in New Issue
Block a user