• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamepythonphpguiwindowsc翻訳omegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

Repository of various works in text file format


Commit MetaInfo

Revision492a4c65773c9d9ff4e7d58e66b70215e26b928c (tree)
Zeit2019-05-27 04:00:52
Autorpierfrancesco A <pier4r4reich@yaho...>
Commiterpierfrancesco A

Log Message

rpl. more flashcards words to compare for duplicates and better comparison procedure

Ändern Zusammenfassung

Diff

--- a/rpl_hp48-50/programs/general/flashcards.urpl
+++ b/rpl_hp48-50/programs/general/flashcards.urpl
@@ -1012,7 +1012,7 @@ the last element
10121012 ""
10131013 }
10141014
1015- gpFindDupInListWords
1015+ gpFindDupInListWordsV1
10161016 @ find duplicates in the list of collected words
10171017 @returning the positions, as they are on paper.
10181018 @ at first effective, can be optimized later.
@@ -1058,6 +1058,90 @@ the last element
10581058 \>>
10591059 \>>
10601060
1061+ gpFindDupInListWordsV2
1062+ @ find duplicates in the list of collected words
1063+ @returning the positions, as they are on paper.
1064+ @ at first effective, can be optimized later.
1065+ @ uses listExt
1066+ @ works 2019-05-26
1067+ \<<
1068+ 0 "lvLsize" DROP
1069+ {} "lvLsortedWords" DROP
1070+ {} "lvLpositions" DROP
1071+
1072+ 0 "lvPos" DROP
1073+ 0 "lvDuplicates" DROP
1074+
1075+ "first_word_should_not_match" "lvLastWord" DROP
1076+ "" "lvCurWord" DROP
1077+ 0 "lvWordRepet" DROP
1078+ \->
1079+ @input
1080+ @var
1081+ lvLsize
1082+ lvLsortedWords
1083+ lvLpositions
1084+
1085+ lvPos
1086+ lvDuplicates
1087+
1088+ lvLastWord
1089+ lvCurWord
1090+ lvWordRepet @repetitions of current word
1091+ \<<
1092+ gvLBaseWordsColPaper SIZE 'lvLsize' STO
1093+ lvLsize LSEQ 'lvLpositions' STO @store the positions 1 to n, since we are going to use ksort
1094+
1095+ @sort the words and accordingly the positions
1096+ lvLpositions
1097+ gvLBaseWordsColPaper
1098+ KSORT
1099+ 'lvLsortedWords' STO
1100+ 'lvLpositions' STO
1101+
1102+
1103+
1104+ 1 lvLsize
1105+ FOR lvPos
1106+ lvLsortedWords lvPos GET 'lvCurWord' STO
1107+
1108+ IF
1109+ lvCurWord lvLastWord ==
1110+ THEN
1111+ @to collect the positions
1112+ lvPos @on the stack to collect it later.
1113+ 'lvWordRepet' 1 STO+ @one more repetition
1114+ ELSE
1115+ @no repetition
1116+ IF
1117+ @if there were repetitions save the result and reset the counter
1118+ lvWordRepet 0 >
1119+ THEN
1120+ @we need to add the position of the first time the entry repeated,
1121+ @as in that case we never put the position on the stack
1122+
1123+ lvWordRepet PICK @we pick the first position we left on the stack
1124+ 1 - @it is a position before that
1125+ 'lvWordRepet' 1 STO+ @now there is an additional position
1126+ lvWordRepet ROLLD @move the position down in the stack
1127+
1128+ lvWordRepet \->LIST @saving the result of the positions on the stack
1129+ lvLpositions SWAP LPICK @pick the corrisponding original positions given the positions of sorted words
1130+ @and leaves it on the stack
1131+
1132+ 0 'lvWordRepet' STO @reset counter
1133+ 'lvDuplicates' 1 STO+
1134+ END @if repetition
1135+ lvCurWord 'lvLastWord' STO @updating the last word now that it changed
1136+ END @if not same words
1137+ NEXT
1138+
1139+ @we have the valid results on the stack. we merge them in a list.
1140+ lvDuplicates
1141+ \->LIST SORT @to make it easier
1142+ \>>
1143+ \>>
1144+
10611145 gpPickRandomEntry
10621146 @ to verify the order on paper that can be gone awry
10631147 \<<