Last active
August 29, 2015 14:03
Using Levenshtein Distance and Team Analysis to Reveal Inherent Engineering Org Structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (defun int-exp (a b) | |
(trunc (math:pow a b))) | |
int-exp | |
> (set lfe (int-exp 2 0)) | |
1 | |
> (set hy (int-exp 2 5)) | |
32 | |
> (set clojure (int-exp 2 6)) | |
64 | |
> (bxor clojure (bxor lfe hy)) | |
97 | |
> (integer_to_list (bxor clojure (bxor lfe hy)) 2) | |
"1100001" | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (set lookup-abbr | |
'(#(#b10000011000010100111100011011001100111001000101010 "DAPT") | |
#(#b01100000001000110001000100101010010011001100010010 "GRBAT") | |
#(#b00000100000010001000100100100110001111000101010001 "DICT") | |
#(#b00001000010100001010110101000110000100000100110010 "JPUST") | |
#(#b00010000000100010000110101000101000101000000100011 "JPPSST") | |
#(#b00000000010100000010111111110101000110101001110010 "UDAT") | |
#(#b00000001100011000110100011001010000100101100100011 "VRPRST") | |
#(#b00010000000100010000011110010011010010001100001100 "OT") | |
#(#b01000100000010001001111111000011010010001010000100 "QAT") | |
#(#b11010111111111111111101111000011010111011000100100 "CT"))) | |
> (set lookup-name | |
'(#("DAPT" "Digital Anvil Product Team") | |
#("GRBAT" "Giant Rubber Band App Team") | |
#("DICT" "Digital Iron Carrot Team") | |
#("JPUST" "Jet Propelled Unicycle Service Team") | |
#("JPPSST" "Jet Propelled Pogo Stick Service Team") | |
#("UDAT" "Ultimatum Dispatcher API Team") | |
#("VRPRST" "Virtual Rocket Powered Roller Skates Team") | |
#("OT" "Operations Team") | |
#("QAT" "QA Team") | |
#("CT" "Community Team"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (lfe-utils:levenshtein-distance | |
"11010111111111111111101111000011010111011000100100" | |
"00000100000010001000100100100110001111000101010001") | |
25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (defun get-bins (data) | |
(proplists:get_keys data)) | |
> (defun format-bin (bin) | |
(string:right (integer_to_list bin 2) 50 #\0)) | |
> (defun get-str-bins (data) | |
(lists:map | |
#'format-bin/1 | |
(get-bins data))) | |
> (defun swap (data) | |
(lists:map | |
(match-lambda (((tuple a b )) | |
(tuple b a))) | |
data)) | |
> (defun bin->abbr (bin data) | |
(proplists:get_value bin data)) | |
> (defun abbr->bin (team-abbr data) | |
(proplists:get_value team-abbr (swap data))) | |
> (defun abbr->name (team-abbr data) | |
(proplists:get_value team-abbr data)) | |
> (defun name->abbr (name name-data) | |
(proplists:get_value name (swap name-data))) | |
> (defun name->bin (name data name-data) | |
(abbr->bin | |
(name->abbr name name-data) | |
data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (lfe-utils:levenshtein-sort | |
"00000100000010001000100100100110001111000101010001" | |
(get-str-bins lookup-abbr)) | |
#("00000100000010001000100100100110001111000101010001" | |
((0 "00000100000010001000100100100110001111000101010001") | |
(12 "00010000000100010000110101000101000101000000100011") | |
(13 "00001000010100001010110101000110000100000100110010") | |
(14 "00010000000100010000011110010011010010001100001100") | |
(14 "01000100000010001001111111000011010010001010000100") | |
(14 "01100000001000110001000100101010010011001100010010") | |
(15 "10000011000010100111100011011001100111001000101010") | |
(16 "00000000010100000010111111110101000110101001110010") | |
(16 "00000001100011000110100011001010000100101100100011") | |
(25 "11010111111111111111101111000011010111011000100100"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (defun sort-data (name data name-data) | |
(let* ((bin (name->bin name data name-data)) | |
((tuple _ results) (lfe-utils:levenshtein-sort | |
(format-bin bin) | |
(get-str-bins data)))) | |
(lists:map | |
(match-lambda (((list dist bin-str)) | |
(list dist | |
(abbr->name | |
(bin->abbr | |
(list_to_integer bin-str 2) | |
data) | |
name-data)))) | |
results))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (sort-data "Digital Iron Carrot Team" | |
lookup-abbr | |
lookup-name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((0 "Digital Iron Carrot Team") | |
(12 "Jet Propelled Pogo Stick Service Team") | |
(13 "Jet Propelled Unicycle Service Team") | |
(14 "Operations Team") | |
(14 "QA Team") | |
(14 "Giant Rubber Band App Team") | |
(15 "Digital Anvil Product Team") | |
(16 "Ultimatum Dispatcher API Team") | |
(16 "Virtual Rocket Powered Roller Skates Team") | |
(25 "Community Team")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (sort-data "Community Team" | |
lookup-abbr | |
lookup-name) | |
((0 "Community Team") | |
(18 "Digital Anvil Product Team") | |
(19 "QA Team") | |
(22 "Operations Team") | |
(22 "Giant Rubber Band App Team") | |
(23 "Virtual Rocket Powered Roller Skates Team") | |
(24 "Ultimatum Dispatcher API Team") | |
(24 "Jet Propelled Unicycle Service Team") | |
(25 "Digital Iron Carrot Team") | |
(26 "Jet Propelled Pogo Stick Service Team")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (sort-data "Giant Rubber Band App Team" | |
lookup-abbr | |
lookup-name) | |
((0 "Giant Rubber Band App Team") | |
(13 "Virtual Rocket Powered Roller Skates Team") | |
(13 "Operations Team") | |
(13 "Jet Propelled Pogo Stick Service Team") | |
(14 "Digital Iron Carrot Team") | |
(15 "Jet Propelled Unicycle Service Team") | |
(16 "Ultimatum Dispatcher API Team") | |
(16 "QA Team") | |
(16 "Digital Anvil Product Team") | |
(22 "Community Team")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment