Hi Jurgen
I'm in over my head and hope you can help. I wrote the attached
workspace assert to do unit testing. The baisc idea is the function
assert-delta-toScreen where the right argument is a command to execute
and the left is what you expect the command to return. The hard work is
done by assert-delta01 wherein I define what equals means. Generally its
working.
I've also send workspace lex1 and script lex1_test.apl. This testing
fails on the command
(1↑⍴leads) assert∆toScreen '+/lex1∆distribution t1'
while both arguments evaluate 94, assert-dela-01 says not equal, viz.:
≡⍴leads
1
≡+/lex1∆distribution t1
0
I'm lost I can't see why I get two different results, nor figure how, if
at all, to modify assert-delta-01.
Thanks is advance
w
#!/usr/local/bin/apl --script
⍝ assert, a workspace to assert the results of tests.
⍝ Copyright (C) 2016, 2017, 2018 Bill Daly
⍝ This program is free software: you can redistribute it and/or modify
⍝ it under the terms of the GNU General Public License as published by
⍝ the Free Software Foundation, either version 3 of the License, or
⍝ (at your option) any later version.
⍝ This program is distributed in the hope that it will be useful,
⍝ but WITHOUT ANY WARRANTY; without even the implied warranty of
⍝ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
⍝ GNU General Public License for more details.
⍝ You should have received a copy of the GNU General Public License
⍝ along with this program. If not, see <http://www.gnu.org/licenses/>.
∇assert∆setup pgm;rc;et;r
⍝ Function to setup for unit tests
⍞←' ',pgm,⎕tc[3]
(rc et r)←⎕ec pgm
→(0≠rc)/0
⍞←r
∇
∇assert∆message msg
⍝ Simple (minded) function to display a message
⍞←msg,⎕tc[3]
∇
∇result assert∆toScreen test
⍝ Function performs test and prints result to screen.
⍞←' ',test,⎕tc[3]
→(result assert∆01 ⍎test)/yes
no:
⍞←'test failed.',⎕tc[3]
→0
yes:
⍞←'test succeeded.'⎕tc[3]
→0
∇
∇b←result assert∆return test
⍝ Function performs tests and returns its comparison to result.
⍞←' ',test,⎕tc[3]
b←result assert∆01 test
∇
∇err assert∆error test
⍝ Function to test that an error is raised
∇
∇b← result assert∆01 test
⍝ Helper function to recursively evaluate nested test results
→((≡test)≠≡result)/no
→((⍴⍴test)≠⍴⍴result)/no
→((⍴test)≠⍴result)/no
→(1<≡test)/test_many
→(0≠⍴⍴test)/t2
t1:
b←test=result
→0
t2:
→(b←∧/(,test)=,result)/0
→no
test_many:
→(b←∧/test assert∆01 ¨ result)/0
no:
b←0
→0
∇
∇eval_fns assert∆nil∆toScreen test;b
⍝ Function to perform a niladic test (ie there are side
⍝ effects). eval_fns is a function that returns true or false and
⍝ confirms the side effects.
⍞←' ',test,⎕tc[3]
⍎test
⍎'b←',eval_fns
→b/yes
no:
⍞←'test failed.',⎕tc[3]
→0
yes:
⍞←'test succeeded.'⎕tc[3]
→0
∇
∇b←eval_fns assert∆nil∆return test
⍝ Function to perform a niladic test (ie there are side
⍝ effects). eval_fns is a function that returns true or false and
⍝ confirms the side effects.
⍞←' ',test,⎕tc[3]
⍎test
⍎'b←',eval_fns
∇
∇assert∆cleanUp cmds;lb;ix
⍝ Function to cleanup after testing.
ix←1
lb←((1↑⍴cmds)⍴st),ed
st:
⍞←ix⊃cmds
⍎ix⊃cmds
→lb[ix←ix+1]
ed:
∇
∇Z←util⍙metadata
Z←0 2⍴⍬
Z←Z⍪'Author' 'Bill Daly'
Z←Z⍪'BugEmail' 'b...@dalywebandedit.com'
Z←Z⍪'Documentation' 'assert.txt'
Z←Z⍪'Download'
'https://sourceforge.net/p/apl-library/code/ci/master/tree/assert.apl'
Z←Z⍪'License' 'GPL v3.0'
Z←Z⍪'Portability' 'L1'
Z←Z⍪'Provides' ''
Z←Z⍪'Requires' ''
Z←Z⍪'Version' '0 1 0'
∇
True←1
False←0
#! /usr/local/bin/apl --script
⍝ ********************************************************************
⍝ $Id: $
⍝ $desc: $ Work space to implement a lexicon using a simple modulus
⍝ prime number hashing algorithm.
⍝ ********************************************************************
⍝ Copyright (C) 2016 Bill Daly
⍝ This program is free software: you can redistribute it and/or modify
⍝ it under the terms of the GNU General Public License as published by
⍝ the Free Software Foundation, either version 3 of the License, or
⍝ (at your option) any later version.
⍝ This program is distributed in the hope that it will be useful,
⍝ but WITHOUT ANY WARRANTY; without even the implied warranty of
⍝ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
⍝ GNU General Public License for more details.
⍝ You should have received a copy of the GNU General Public License
⍝ along with this program. If not, see <http://www.gnu.org/licenses/>.
)copy 1 util
∇h←p lex1∆hashPrime key
⍝ Hasing function using modulus of a prime
h←''⍴⎕io+p|+/⎕ucs key
∇
∇h1←hash lex1∆assign item;ix;bucket
⍝ Function to add or replace a name--value pair in a hash based on primes.
k←(1↑⍴hash) lex1∆hashPrime ⊃item[1]
h1←hash
→(0=≡hash[k;1])/new
→(0≠⍴ix←(⊃h1[k;1]) util∆stringSearch ⊃item[1])/replace
append: ⍝ A collision
h1[k;1]←⊂(⊃h1[k;1]),item[1]
h1[k;2]←⊂(⊃h1[k;2]),item[2]
→0
replace: ⍝ Replace an existing value
(⊃h1[k;2])[''⍴ix]←item[2]
→0
new: ⍝ an empty bucket
h1[k;1]←⊂,item[1]
h1[k;2]←⊂,item[2]
→0
∇
∇dist← lex1∆distribution hash
⍝ Function returns the distribution of keys accross a lex1 hash table.
dist←∊ lex1∆itemCount¨hash[;1]
∇
∇count←lex1∆itemCount bucket
⍝ Functions returns distribution of keys in a hash bucket.
count←¯1↑0,⍴bucket
∇
∇bv←hash lex1∆hasKey key;keys;rl;rk
⍝ Function returns true if hash has this key.
rl←⍴keys←lex1∆keys hash
rl[2]←rk←rl[2]⌈⍴key
bv←∨/(rl↑keys)∧.=rk↑key
∇
∇h←lex1∆init p
⍝ Function to initialize a prime based hash array
h←(p,2)⍴⊃,''
∇
∇b←lex1∆is hash;k
⍝ Predicate for a prime based hash table
→(~b←''⍴∧/(2=⍴⍴hash),(2=¯1↑⍴hash))/0
→(b←''⍴0=1↑⍴k←lex1∆keys hash)/0
b←''⍴0≠⍴⍴hash lex1∆lookup util∆trim k[?1↑⍴k;]
∇
∇keys←lex1∆keys hash
⍝ Function returns a list of the keys in hash
keys←⊃,⊃,hash[;1]
keys←(~∧/keys=' ')⌿keys
∇
∇value←hash lex1∆lookup key;k
⍝ Function to return a key's value from a prime based hash
k←(1↑⍴hash) lex1∆hashPrime key
→(0=≡hash[k;1])/none
value←⊃(⊃hash[k;2])[''⍴(⊃hash[k;1]) util∆stringSearch key]
→0
none:
value←''
→0
∇
∇values←lex1∆values hash
⍝ Function returns a list of values from hash
values←(⊂hash) lex1∆lookup ¨util∆trim ¨ ⊂[2]lex1∆keys hash
∇
∇Z←lex1⍙metadata
Z←0 2⍴⍬
Z←Z⍪'Author' 'Bill Daly'
Z←Z⍪'BugEmail' 'b...@dalywebandedit.com'
Z←Z⍪'Documentation' 'lex1.txt'
Z←Z⍪'Download'
'https://sourceforge.net/p/apl-library/code/ci/master/tree/lex1.apl'
Z←Z⍪'License' 'GPL v3.0'
Z←Z⍪'Portability' 'L1'
Z←Z⍪'Provides' ''
Z←Z⍪'Requires' 'util'
Z←Z⍪'Version' '0 1 0'
∇
#! /usr/local/bin/apl --script
⍝ ********************************************************************
⍝ $Id: $
⍝ $desc: Script to unit test library lex1 $
⍝ ********************************************************************
⍝ Copyright (C) 2016 Bill Daly
⍝ This program is free software: you can redistribute it and/or modify
⍝ it under the terms of the GNU General Public License as published by
⍝ the Free Software Foundation, either version 3 of the License, or
⍝ (at your option) any later version.
⍝ This program is distributed in the hope that it will be useful,
⍝ but WITHOUT ANY WARRANTY; without even the implied warranty of
⍝ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
⍝ GNU General Public License for more details.
⍝ You should have received a copy of the GNU General Public License
⍝ along with this program. If not, see <http://www.gnu.org/licenses/>.
)copy 1 lex1
)copy 1 assert
leads←94 5⍴0 ⍝ prolog ≡1
(,leads)[⍳21]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[21+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[41+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[61+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[81+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[101+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[121+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[141+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[161+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[181+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[201+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[221+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[241+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[261+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[281+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[301+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[321+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[341+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[361+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[381+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[401+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[421+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[441+⍳20]←00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(,leads)[461+⍳9]←00 00 00 00 00 00 00 00 00
((⎕IO+(⊂0 0))⊃leads)←'Otero-Cruz'
((⎕IO+(⊂0 1))⊃leads)←'Patricia Wilson'
((⎕IO+(⊂0 2))⊃leads)←'One South State Street'
((⎕IO+(⊂0 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂0 4))⊃leads)←'PA'
((⎕IO+(⊂1 0))⊃leads)←'Doyle'
((⎕IO+(⊂1 1))⊃leads)←'Larry'
((⎕IO+(⊂1 2))⊃leads)←'1217 Spring Garden Street'
((⎕IO+(⊂1 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂1 4))⊃leads)←'PA'
((⎕IO+(⊂2 0))⊃leads)←'Ballezzi'
((⎕IO+(⊂2 1))⊃leads)←'Reginal T.'
((⎕IO+(⊂2 2))⊃leads)←'9360 Ashton Road'
((⎕IO+(⊂2 3))⊃leads)←'Bensalem'
((⎕IO+(⊂2 4))⊃leads)←'PA'
((⎕IO+(⊂3 0))⊃leads)←'Rokowsky'
((⎕IO+(⊂3 1))⊃leads)←'Bethann'
((⎕IO+(⊂3 2))⊃leads)←'453 Hamilton Blvd.'
((⎕IO+(⊂3 3))⊃leads)←'Langhorne'
((⎕IO+(⊂3 4))⊃leads)←'PA'
((⎕IO+(⊂4 0))⊃leads)←'Aden'
((⎕IO+(⊂4 1))⊃leads)←'Audrey J'
((⎕IO+(⊂4 2))⊃leads)←'2142 Trenton Road'
((⎕IO+(⊂4 3))⊃leads)←'Trevose'
((⎕IO+(⊂4 4))⊃leads)←'PA'
((⎕IO+(⊂5 0))⊃leads)←'Shuford'
((⎕IO+(⊂5 1))⊃leads)←'James'
((⎕IO+(⊂5 2))⊃leads)←'1775 Street Rd'
((⎕IO+(⊂5 3))⊃leads)←'Southampton'
((⎕IO+(⊂5 4))⊃leads)←'PA'
((⎕IO+(⊂6 0))⊃leads)←'Graff'
((⎕IO+(⊂6 1))⊃leads)←'Barbara'
((⎕IO+(⊂6 2))⊃leads)←'8900 Roosevelt Blvd'
((⎕IO+(⊂6 3))⊃leads)←'Morrisville'
((⎕IO+(⊂6 4))⊃leads)←'PA'
((⎕IO+(⊂7 0))⊃leads)←'Jones'
((⎕IO+(⊂7 1))⊃leads)←'Karen'
((⎕IO+(⊂7 2))⊃leads)←'111 South Eleventh Street'
((⎕IO+(⊂7 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂7 4))⊃leads)←'PA'
((⎕IO+(⊂8 0))⊃leads)←'Frangicetto'
((⎕IO+(⊂8 1))⊃leads)←'Renee'
((⎕IO+(⊂8 2))⊃leads)←'300 Allendale Drive'
((⎕IO+(⊂8 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂8 4))⊃leads)←'PA'
((⎕IO+(⊂9 0))⊃leads)←'Naftulin'
((⎕IO+(⊂9 1))⊃leads)←'Steve'
((⎕IO+(⊂9 2))⊃leads)←'3807 Oakhill Road'
((⎕IO+(⊂9 3))⊃leads)←'Newtown'
((⎕IO+(⊂9 4))⊃leads)←'PA'
((⎕IO+(⊂10 0))⊃leads)←'Brookins'
((⎕IO+(⊂10 1))⊃leads)←'Jon C'
((⎕IO+(⊂10 2))⊃leads)←'2400 Byberry Road'
((⎕IO+(⊂10 3))⊃leads)←'Langhorne'
((⎕IO+(⊂10 4))⊃leads)←'PA'
((⎕IO+(⊂11 0))⊃leads)←'Feliciano'
((⎕IO+(⊂11 1))⊃leads)←'George'
((⎕IO+(⊂11 2))⊃leads)←'1380 Bristol Rd'
((⎕IO+(⊂11 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂11 4))⊃leads)←'PA'
((⎕IO+(⊂12 0))⊃leads)←'Franklin'
((⎕IO+(⊂12 1))⊃leads)←'Thomas'
((⎕IO+(⊂12 2))⊃leads)←'2222 Trenton Road'
((⎕IO+(⊂12 3))⊃leads)←'Bensalem'
((⎕IO+(⊂12 4))⊃leads)←'PA'
((⎕IO+(⊂13 0))⊃leads)←'O''Brien'
((⎕IO+(⊂13 1))⊃leads)←'AL'
((⎕IO+(⊂13 2))⊃leads)←'10700 Knights Road'
((⎕IO+(⊂13 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂13 4))⊃leads)←'PA'
((⎕IO+(⊂14 0))⊃leads)←'Blumenthal'
((⎕IO+(⊂14 1))⊃leads)←'Jerry R'
((⎕IO+(⊂14 2))⊃leads)←'441 North Fifth Street'
((⎕IO+(⊂14 3))⊃leads)←'Newtown'
((⎕IO+(⊂14 4))⊃leads)←'PA'
((⎕IO+(⊂15 0))⊃leads)←'Lichtas'
((⎕IO+(⊂15 1))⊃leads)←'Connie'
((⎕IO+(⊂15 2))⊃leads)←'401 North Third Street'
((⎕IO+(⊂15 3))⊃leads)←'Langhorne'
((⎕IO+(⊂15 4))⊃leads)←'PA'
((⎕IO+(⊂16 0))⊃leads)←'Gilmore'
((⎕IO+(⊂16 1))⊃leads)←'Michael'
((⎕IO+(⊂16 2))⊃leads)←'2400 Bristol Pike'
((⎕IO+(⊂16 3))⊃leads)←'Morrisville'
((⎕IO+(⊂16 4))⊃leads)←'PA'
((⎕IO+(⊂17 0))⊃leads)←'Kripa'
((⎕IO+(⊂17 1))⊃leads)←'Karen'
((⎕IO+(⊂17 2))⊃leads)←'2 S Delmorr Ave'
((⎕IO+(⊂17 3))⊃leads)←'Morrisville'
((⎕IO+(⊂17 4))⊃leads)←'PA'
((⎕IO+(⊂18 0))⊃leads)←'Simpson'
((⎕IO+(⊂18 1))⊃leads)←'Catherine'
((⎕IO+(⊂18 2))⊃leads)←'1600 North Eighth St'
((⎕IO+(⊂18 3))⊃leads)←'Langhorne'
((⎕IO+(⊂18 4))⊃leads)←'PA'
((⎕IO+(⊂19 0))⊃leads)←'Kelly'
((⎕IO+(⊂19 1))⊃leads)←'Carolyn'
((⎕IO+(⊂19 2))⊃leads)←'102 West Maple Avenue'
((⎕IO+(⊂19 3))⊃leads)←'Yardley'
((⎕IO+(⊂19 4))⊃leads)←'PA'
((⎕IO+(⊂20 0))⊃leads)←'Sicilia'
((⎕IO+(⊂20 1))⊃leads)←'Lydia'
((⎕IO+(⊂20 2))⊃leads)←'8001 Torresdale Avenue'
((⎕IO+(⊂20 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂20 4))⊃leads)←'PA'
((⎕IO+(⊂21 0))⊃leads)←'Berry-Johnson'
((⎕IO+(⊂21 1))⊃leads)←'Thomas'
((⎕IO+(⊂21 2))⊃leads)←'2417 Welsh Road Suite 202'
((⎕IO+(⊂21 3))⊃leads)←'Morrisville'
((⎕IO+(⊂21 4))⊃leads)←'PA'
((⎕IO+(⊂22 0))⊃leads)←'Smith'
((⎕IO+(⊂22 1))⊃leads)←'Yitzchok'
((⎕IO+(⊂22 2))⊃leads)←'345 Lakeside Drive'
((⎕IO+(⊂22 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂22 4))⊃leads)←'PA'
((⎕IO+(⊂23 0))⊃leads)←'Konopka'
((⎕IO+(⊂23 1))⊃leads)←'Robert L'
((⎕IO+(⊂23 2))⊃leads)←'111 South Independence Mall East, Suite 570'
((⎕IO+(⊂23 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂23 4))⊃leads)←'PA'
((⎕IO+(⊂24 0))⊃leads)←'Kinslow'
((⎕IO+(⊂24 1))⊃leads)←'Tracey'
((⎕IO+(⊂24 2))⊃leads)←'1069 Jacksonville Road'
((⎕IO+(⊂24 3))⊃leads)←'Langhorne'
((⎕IO+(⊂24 4))⊃leads)←'PA'
((⎕IO+(⊂25 0))⊃leads)←'Stewart'
((⎕IO+(⊂25 1))⊃leads)←'Steven'
((⎕IO+(⊂25 2))⊃leads)←'9150 Marshall Street No 9'
((⎕IO+(⊂25 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂25 4))⊃leads)←'PA'
((⎕IO+(⊂26 0))⊃leads)←'Flocco'
((⎕IO+(⊂26 1))⊃leads)←'John Greer'
((⎕IO+(⊂26 2))⊃leads)←'499 North 5th Street'
((⎕IO+(⊂26 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂26 4))⊃leads)←'PA'
((⎕IO+(⊂27 0))⊃leads)←'Hyer MPA'
((⎕IO+(⊂27 1))⊃leads)←'Barbara'
((⎕IO+(⊂27 2))⊃leads)←'1210 Northbrook Dr Ste 200'
((⎕IO+(⊂27 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂27 4))⊃leads)←'PA'
((⎕IO+(⊂28 0))⊃leads)←'Hagan'
((⎕IO+(⊂28 1))⊃leads)←'William'
((⎕IO+(⊂28 2))⊃leads)←'1802 Westover Road'
((⎕IO+(⊂28 3))⊃leads)←'Bensalem'
((⎕IO+(⊂28 4))⊃leads)←'PA'
((⎕IO+(⊂29 0))⊃leads)←'Hisle'
((⎕IO+(⊂29 1))⊃leads)←'Melissa'
((⎕IO+(⊂29 2))⊃leads)←'31 W College Ave'
((⎕IO+(⊂29 3))⊃leads)←'Langhorne'
((⎕IO+(⊂29 4))⊃leads)←'PA'
((⎕IO+(⊂30 0))⊃leads)←'Mcbride'
((⎕IO+(⊂30 1))⊃leads)←'Rabbi Ira'
((⎕IO+(⊂30 2))⊃leads)←'616 East Lincoln Highway'
((⎕IO+(⊂30 3))⊃leads)←'Penndel'
((⎕IO+(⊂30 4))⊃leads)←'PA'
((⎕IO+(⊂31 0))⊃leads)←'Long'
((⎕IO+(⊂31 1))⊃leads)←'Wendy'
((⎕IO+(⊂31 2))⊃leads)←'9225 Old Bustleton Avenue'
((⎕IO+(⊂31 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂31 4))⊃leads)←'PA'
((⎕IO+(⊂32 0))⊃leads)←'Stadelberger'
((⎕IO+(⊂32 1))⊃leads)←'Joseph'
((⎕IO+(⊂32 2))⊃leads)←'690a E Parker St'
((⎕IO+(⊂32 3))⊃leads)←'Trevose'
((⎕IO+(⊂32 4))⊃leads)←'PA'
((⎕IO+(⊂33 0))⊃leads)←'Sizer'
((⎕IO+(⊂33 1))⊃leads)←'Alan N.'
((⎕IO+(⊂33 2))⊃leads)←'444 North Third Street, No 202'
((⎕IO+(⊂33 3))⊃leads)←'Morrisville'
((⎕IO+(⊂33 4))⊃leads)←'PA'
((⎕IO+(⊂34 0))⊃leads)←'Axe'
((⎕IO+(⊂34 1))⊃leads)←'Patrica'
((⎕IO+(⊂34 2))⊃leads)←'9300 New Falls Rd'
((⎕IO+(⊂34 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂34 4))⊃leads)←'PA'
((⎕IO+(⊂35 0))⊃leads)←'Snipes'
((⎕IO+(⊂35 1))⊃leads)←'Ted'
((⎕IO+(⊂35 2))⊃leads)←'4411 Rhawn Street'
((⎕IO+(⊂35 3))⊃leads)←'Morrisville'
((⎕IO+(⊂35 4))⊃leads)←'PA'
((⎕IO+(⊂36 0))⊃leads)←'Hammon'
((⎕IO+(⊂36 1))⊃leads)←'Douglas H.'
((⎕IO+(⊂36 2))⊃leads)←'1239 Spring Garden Street'
((⎕IO+(⊂36 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂36 4))⊃leads)←'PA'
((⎕IO+(⊂37 0))⊃leads)←'Berkoff'
((⎕IO+(⊂37 1))⊃leads)←'Darletta'
((⎕IO+(⊂37 2))⊃leads)←'141 East Hunting Park'
((⎕IO+(⊂37 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂37 4))⊃leads)←'PA'
((⎕IO+(⊂38 0))⊃leads)←'Navitsky'
((⎕IO+(⊂38 1))⊃leads)←'Joel'
((⎕IO+(⊂38 2))⊃leads)←'150 James Way'
((⎕IO+(⊂38 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂38 4))⊃leads)←'PA'
((⎕IO+(⊂39 0))⊃leads)←'Mcnamara'
((⎕IO+(⊂39 1))⊃leads)←'Kathleen'
((⎕IO+(⊂39 2))⊃leads)←'PO BOX 934'
((⎕IO+(⊂39 3))⊃leads)←'Southampton'
((⎕IO+(⊂39 4))⊃leads)←'PA'
((⎕IO+(⊂40 0))⊃leads)←'Naftulin'
((⎕IO+(⊂40 1))⊃leads)←'Ron'
((⎕IO+(⊂40 2))⊃leads)←'PO BOX 300'
((⎕IO+(⊂40 3))⊃leads)←'Southampton'
((⎕IO+(⊂40 4))⊃leads)←'PA'
((⎕IO+(⊂41 0))⊃leads)←'Gold'
((⎕IO+(⊂41 1))⊃leads)←'Jonathan'
((⎕IO+(⊂41 2))⊃leads)←'1842 Brownsville Rd'
((⎕IO+(⊂41 3))⊃leads)←'Bensalem'
((⎕IO+(⊂41 4))⊃leads)←'PA'
((⎕IO+(⊂42 0))⊃leads)←'Brady'
((⎕IO+(⊂42 1))⊃leads)←'Geoffrey'
((⎕IO+(⊂42 2))⊃leads)←'PO Box 165'
((⎕IO+(⊂42 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂42 4))⊃leads)←'PA'
((⎕IO+(⊂43 0))⊃leads)←'Krug'
((⎕IO+(⊂43 1))⊃leads)←'Pat'
((⎕IO+(⊂43 2))⊃leads)←'1023 Callowhill Street'
((⎕IO+(⊂43 3))⊃leads)←'Yardley'
((⎕IO+(⊂43 4))⊃leads)←'PA'
((⎕IO+(⊂44 0))⊃leads)←'Lipkovskaya'
((⎕IO+(⊂44 1))⊃leads)←'Val'
((⎕IO+(⊂44 2))⊃leads)←'444 North Third Street'
((⎕IO+(⊂44 3))⊃leads)←'Fallsington'
((⎕IO+(⊂44 4))⊃leads)←'PA'
((⎕IO+(⊂45 0))⊃leads)←'Parisi'
((⎕IO+(⊂45 1))⊃leads)←'Mae'
((⎕IO+(⊂45 2))⊃leads)←'400 Freedom Drive'
((⎕IO+(⊂45 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂45 4))⊃leads)←'PA'
((⎕IO+(⊂46 0))⊃leads)←'Rosso-Gana'
((⎕IO+(⊂46 1))⊃leads)←'Diane'
((⎕IO+(⊂46 2))⊃leads)←'407-411 Fairmount Avenue'
((⎕IO+(⊂46 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂46 4))⊃leads)←'PA'
((⎕IO+(⊂47 0))⊃leads)←'Szamborski'
((⎕IO+(⊂47 1))⊃leads)←'Stephen I'
((⎕IO+(⊂47 2))⊃leads)←'8001 Torresdale Avenue'
((⎕IO+(⊂47 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂47 4))⊃leads)←'PA'
((⎕IO+(⊂48 0))⊃leads)←'Soltis'
((⎕IO+(⊂48 1))⊃leads)←'Kim'
((⎕IO+(⊂48 2))⊃leads)←'11 Bellwood Dr'
((⎕IO+(⊂48 3))⊃leads)←'Bensalem'
((⎕IO+(⊂48 4))⊃leads)←'PA'
((⎕IO+(⊂49 0))⊃leads)←'Schmid'
((⎕IO+(⊂49 1))⊃leads)←'Joseph'
((⎕IO+(⊂49 2))⊃leads)←'308 Arborlea Avenue'
((⎕IO+(⊂49 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂49 4))⊃leads)←'PA'
((⎕IO+(⊂50 0))⊃leads)←'Tucker'
((⎕IO+(⊂50 1))⊃leads)←'Anne Marie'
((⎕IO+(⊂50 2))⊃leads)←'1701 Grant Avenue'
((⎕IO+(⊂50 3))⊃leads)←'Feasterville'
((⎕IO+(⊂50 4))⊃leads)←'PA'
((⎕IO+(⊂51 0))⊃leads)←'Lepping'
((⎕IO+(⊂51 1))⊃leads)←'Nancy'
((⎕IO+(⊂51 2))⊃leads)←'5245 Bensalem Boulevard'
((⎕IO+(⊂51 3))⊃leads)←'Ivyland'
((⎕IO+(⊂51 4))⊃leads)←'PA'
((⎕IO+(⊂52 0))⊃leads)←'McPartlin'
((⎕IO+(⊂52 1))⊃leads)←'John'
((⎕IO+(⊂52 2))⊃leads)←'447 North Broad Street'
((⎕IO+(⊂52 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂52 4))⊃leads)←'PA'
((⎕IO+(⊂53 0))⊃leads)←'Joyner'
((⎕IO+(⊂53 1))⊃leads)←'Steven'
((⎕IO+(⊂53 2))⊃leads)←'934 Ralph Avenue PO BOX 7072'
((⎕IO+(⊂53 3))⊃leads)←'Bensalem'
((⎕IO+(⊂53 4))⊃leads)←'PA'
((⎕IO+(⊂54 0))⊃leads)←'Millard'
((⎕IO+(⊂54 1))⊃leads)←'Tanley M'
((⎕IO+(⊂54 2))⊃leads)←'406 W Street Rd'
((⎕IO+(⊂54 3))⊃leads)←'Bansalem'
((⎕IO+(⊂54 4))⊃leads)←'PA'
((⎕IO+(⊂55 0))⊃leads)←'Cantor'
((⎕IO+(⊂55 1))⊃leads)←'David G'
((⎕IO+(⊂55 2))⊃leads)←'520 Delaware Ave.; 7th Floor'
((⎕IO+(⊂55 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂55 4))⊃leads)←'PA'
((⎕IO+(⊂56 0))⊃leads)←'III'
((⎕IO+(⊂56 1))⊃leads)←'Michael R'
((⎕IO+(⊂56 2))⊃leads)←'12271 Townsend Road'
((⎕IO+(⊂56 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂56 4))⊃leads)←'PA'
((⎕IO+(⊂57 0))⊃leads)←'Schade'
((⎕IO+(⊂57 1))⊃leads)←'Amy'
((⎕IO+(⊂57 2))⊃leads)←'417 North Eighth Street'
((⎕IO+(⊂57 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂57 4))⊃leads)←'PA'
((⎕IO+(⊂58 0))⊃leads)←'Schiavone'
((⎕IO+(⊂58 1))⊃leads)←'Andre'
((⎕IO+(⊂58 2))⊃leads)←'80 West Trenton Avenue'
((⎕IO+(⊂58 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂58 4))⊃leads)←'PA'
((⎕IO+(⊂59 0))⊃leads)←'Flynn'
((⎕IO+(⊂59 1))⊃leads)←'Robert'
((⎕IO+(⊂59 2))⊃leads)←'947 Street Road'
((⎕IO+(⊂59 3))⊃leads)←'Churchville'
((⎕IO+(⊂59 4))⊃leads)←'PA'
((⎕IO+(⊂60 0))⊃leads)←'Kravitz'
((⎕IO+(⊂60 1))⊃leads)←'Nancy H'
((⎕IO+(⊂60 2))⊃leads)←'7 Neshaminy Interplex Dr Ste 103'
((⎕IO+(⊂60 3))⊃leads)←'Fallsington'
((⎕IO+(⊂60 4))⊃leads)←'PA'
((⎕IO+(⊂61 0))⊃leads)←'Fluehr'
((⎕IO+(⊂61 1))⊃leads)←'Kathleen'
((⎕IO+(⊂61 2))⊃leads)←'499 North Fifth Street'
((⎕IO+(⊂61 3))⊃leads)←'Morrisville'
((⎕IO+(⊂61 4))⊃leads)←'PA'
((⎕IO+(⊂62 0))⊃leads)←'Malkemes'
((⎕IO+(⊂62 1))⊃leads)←'Aurora'
((⎕IO+(⊂62 2))⊃leads)←'111 S Independence Mall East, Suite 701'
((⎕IO+(⊂62 3))⊃leads)←'Morrisville'
((⎕IO+(⊂62 4))⊃leads)←'PA'
((⎕IO+(⊂63 0))⊃leads)←'Wolf'
((⎕IO+(⊂63 1))⊃leads)←'Maku'
((⎕IO+(⊂63 2))⊃leads)←'4 Cornerstone Drive'
((⎕IO+(⊂63 3))⊃leads)←'Southampton'
((⎕IO+(⊂63 4))⊃leads)←'PA'
((⎕IO+(⊂64 0))⊃leads)←'Buchanon'
((⎕IO+(⊂64 1))⊃leads)←'Carol'
((⎕IO+(⊂64 2))⊃leads)←'2005 Cabot Blvd Suite 100'
((⎕IO+(⊂64 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂64 4))⊃leads)←'PA'
((⎕IO+(⊂65 0))⊃leads)←'Budow'
((⎕IO+(⊂65 1))⊃leads)←'Joseph'
((⎕IO+(⊂65 2))⊃leads)←'301 Oxford Valley Road , Ste 1701'
((⎕IO+(⊂65 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂65 4))⊃leads)←'PA'
((⎕IO+(⊂66 0))⊃leads)←'Kelly'
((⎕IO+(⊂66 1))⊃leads)←'Eric'
((⎕IO+(⊂66 2))⊃leads)←'3839 Richlieu Road PO BOX 1470'
((⎕IO+(⊂66 3))⊃leads)←'Levittown'
((⎕IO+(⊂66 4))⊃leads)←'PA'
((⎕IO+(⊂67 0))⊃leads)←'Dellavella'
((⎕IO+(⊂67 1))⊃leads)←'Vladimir'
((⎕IO+(⊂67 2))⊃leads)←'1850 Byberry Road'
((⎕IO+(⊂67 3))⊃leads)←'Levittown'
((⎕IO+(⊂67 4))⊃leads)←'PA'
((⎕IO+(⊂68 0))⊃leads)←'Ingram'
((⎕IO+(⊂68 1))⊃leads)←'Eric'
((⎕IO+(⊂68 2))⊃leads)←'21 Penn Valley Road'
((⎕IO+(⊂68 3))⊃leads)←'Levittown'
((⎕IO+(⊂68 4))⊃leads)←'PA'
((⎕IO+(⊂69 0))⊃leads)←'Howell'
((⎕IO+(⊂69 1))⊃leads)←'Marina'
((⎕IO+(⊂69 2))⊃leads)←'635 N Delmorr Ave'
((⎕IO+(⊂69 3))⊃leads)←'Trevose'
((⎕IO+(⊂69 4))⊃leads)←'PA'
((⎕IO+(⊂70 0))⊃leads)←'Weiler'
((⎕IO+(⊂70 1))⊃leads)←'Besie'
((⎕IO+(⊂70 2))⊃leads)←'441 North Fifth Street, Suite 101'
((⎕IO+(⊂70 3))⊃leads)←'Bensalem'
((⎕IO+(⊂70 4))⊃leads)←'PA'
((⎕IO+(⊂71 0))⊃leads)←'B. Harman'
((⎕IO+(⊂71 1))⊃leads)←'Terry'
((⎕IO+(⊂71 2))⊃leads)←'9857 Bustleton Ave.'
((⎕IO+(⊂71 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂71 4))⊃leads)←'PA'
((⎕IO+(⊂72 0))⊃leads)←'Platonov'
((⎕IO+(⊂72 1))⊃leads)←'Paul'
((⎕IO+(⊂72 2))⊃leads)←'1336 Spring Garden Street'
((⎕IO+(⊂72 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂72 4))⊃leads)←'PA'
((⎕IO+(⊂73 0))⊃leads)←'Stein CPA'
((⎕IO+(⊂73 1))⊃leads)←'Robert'
((⎕IO+(⊂73 2))⊃leads)←'8900 Roosevelt Blvd.'
((⎕IO+(⊂73 3))⊃leads)←'Southampton'
((⎕IO+(⊂73 4))⊃leads)←'PA'
((⎕IO+(⊂74 0))⊃leads)←'Byrd'
((⎕IO+(⊂74 1))⊃leads)←'Regan'
((⎕IO+(⊂74 2))⊃leads)←'2451 Grant Avenue'
((⎕IO+(⊂74 3))⊃leads)←'Penndel'
((⎕IO+(⊂74 4))⊃leads)←'PA'
((⎕IO+(⊂75 0))⊃leads)←'Butler'
((⎕IO+(⊂75 1))⊃leads)←'Gary B'
((⎕IO+(⊂75 2))⊃leads)←'3830 Hulmeville Road'
((⎕IO+(⊂75 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂75 4))⊃leads)←'PA'
((⎕IO+(⊂76 0))⊃leads)←'Quirk'
((⎕IO+(⊂76 1))⊃leads)←'Susan'
((⎕IO+(⊂76 2))⊃leads)←'701 Arch St'
((⎕IO+(⊂76 3))⊃leads)←'Newtown'
((⎕IO+(⊂76 4))⊃leads)←'PA'
((⎕IO+(⊂77 0))⊃leads)←'Riblet'
((⎕IO+(⊂77 1))⊃leads)←'Joanna'
((⎕IO+(⊂77 2))⊃leads)←'3207 Street Road'
((⎕IO+(⊂77 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂77 4))⊃leads)←'PA'
((⎕IO+(⊂78 0))⊃leads)←'Demiri'
((⎕IO+(⊂78 1))⊃leads)←'Valerie'
((⎕IO+(⊂78 2))⊃leads)←'928 Jaymor Road Suite B-150'
((⎕IO+(⊂78 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂78 4))⊃leads)←'PA'
((⎕IO+(⊂79 0))⊃leads)←'Steinke'
((⎕IO+(⊂79 1))⊃leads)←'David P'
((⎕IO+(⊂79 2))⊃leads)←'PO BOx 908'
((⎕IO+(⊂79 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂79 4))⊃leads)←'PA'
((⎕IO+(⊂80 0))⊃leads)←'Katz'
((⎕IO+(⊂80 1))⊃leads)←'Angela'
((⎕IO+(⊂80 2))⊃leads)←'3380 Byberry Rd'
((⎕IO+(⊂80 3))⊃leads)←'Langhorne'
((⎕IO+(⊂80 4))⊃leads)←'PA'
((⎕IO+(⊂81 0))⊃leads)←'Vapniarek'
((⎕IO+(⊂81 1))⊃leads)←'Janeya'
((⎕IO+(⊂81 2))⊃leads)←'9350 Ashton Road'
((⎕IO+(⊂81 3))⊃leads)←'Morrisville'
((⎕IO+(⊂81 4))⊃leads)←'PA'
((⎕IO+(⊂82 0))⊃leads)←'Coleman'
((⎕IO+(⊂82 1))⊃leads)←'Michael'
((⎕IO+(⊂82 2))⊃leads)←'1231 North Franklin Street'
((⎕IO+(⊂82 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂82 4))⊃leads)←'PA'
((⎕IO+(⊂83 0))⊃leads)←'Fiordaliso'
((⎕IO+(⊂83 1))⊃leads)←'Ernest'
((⎕IO+(⊂83 2))⊃leads)←'4 Yardley Avenue'
((⎕IO+(⊂83 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂83 4))⊃leads)←'PA'
((⎕IO+(⊂84 0))⊃leads)←'Simmons'
((⎕IO+(⊂84 1))⊃leads)←'Gregory'
((⎕IO+(⊂84 2))⊃leads)←'C/O Andre Krug, 10100 Jamison Avenue'
((⎕IO+(⊂84 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂84 4))⊃leads)←'PA'
((⎕IO+(⊂85 0))⊃leads)←'Reiley'
((⎕IO+(⊂85 1))⊃leads)←'Howard'
((⎕IO+(⊂85 2))⊃leads)←'890 West Bridge Street'
((⎕IO+(⊂85 3))⊃leads)←'Levittown'
((⎕IO+(⊂85 4))⊃leads)←'PA'
((⎕IO+(⊂86 0))⊃leads)←'Topley'
((⎕IO+(⊂86 1))⊃leads)←'James'
((⎕IO+(⊂86 2))⊃leads)←'PO Box 617'
((⎕IO+(⊂86 3))⊃leads)←'Morrisville'
((⎕IO+(⊂86 4))⊃leads)←'PA'
((⎕IO+(⊂87 0))⊃leads)←'McIver'
((⎕IO+(⊂87 1))⊃leads)←'Veronica'
((⎕IO+(⊂87 2))⊃leads)←'3801 Grant Avenue'
((⎕IO+(⊂87 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂87 4))⊃leads)←'PA'
((⎕IO+(⊂88 0))⊃leads)←'Karasow'
((⎕IO+(⊂88 1))⊃leads)←'Regan'
((⎕IO+(⊂88 2))⊃leads)←'2600 Southampton Rd'
((⎕IO+(⊂88 3))⊃leads)←'Yardley'
((⎕IO+(⊂88 4))⊃leads)←'PA'
((⎕IO+(⊂89 0))⊃leads)←'Bell'
((⎕IO+(⊂89 1))⊃leads)←'Patrick'
((⎕IO+(⊂89 2))⊃leads)←'400 Pennsbury Memorial Road'
((⎕IO+(⊂89 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂89 4))⊃leads)←'PA'
((⎕IO+(⊂90 0))⊃leads)←'Schonfeld'
((⎕IO+(⊂90 1))⊃leads)←'Anne'
((⎕IO+(⊂90 2))⊃leads)←'858 Street Road'
((⎕IO+(⊂90 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂90 4))⊃leads)←'PA'
((⎕IO+(⊂91 0))⊃leads)←'Callihan'
((⎕IO+(⊂91 1))⊃leads)←'Nora'
((⎕IO+(⊂91 2))⊃leads)←'586 Middleton Boulevard Suite C-100'
((⎕IO+(⊂91 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂91 4))⊃leads)←'PA'
((⎕IO+(⊂92 0))⊃leads)←'Warrakah-Ali'
((⎕IO+(⊂92 1))⊃leads)←'Vivian S'
((⎕IO+(⊂92 2))⊃leads)←'10901 Dutton Road'
((⎕IO+(⊂92 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂92 4))⊃leads)←'PA'
((⎕IO+(⊂93 0))⊃leads)←'Mcquaid'
((⎕IO+(⊂93 1))⊃leads)←'Sonia'
((⎕IO+(⊂93 2))⊃leads)←'611 Spring Garden Street'
((⎕IO+(⊂93 3))⊃leads)←'Philadelphia'
((⎕IO+(⊂93 4))⊃leads)←'PA'
∇key←adhoc∆key ln;tmp
⍝ Function to create a key of lastname,FirstInitial
key←(⊃ln[1]),1↑⊃ln[2]
∇
∇h1←h adhoc∆assign array;k;l;i;labels
⍝ Function for assigning leads to a hashed lexicon
labels←((1↑⍴array)⍴start),end
i←1
h1←h
start:
k←⊂(⊃array[i;1]),1↑⊃array[i;2]
l←⊂( array[i;])
h1← h1 lex1∆assign k,l
→labels[i←i+1]
end:
→0
∇
1 assert∆toScreen 'lex1∆is t1← lex1∆init 97'
0 assert∆toScreen 'lex1∆is leads'
assert∆setup 't1←t1 adhoc∆assign leads'
1 assert∆toScreen 'lex1∆is t1'
assert∆message 'Display the distribtuion of items to the buckets in t1:'
assert∆setup '⍞←lex1∆distribution t1'
(1↑⍴leads) assert∆toScreen '1↑⍴lex1∆keys t1'
(1↑⍴leads) assert∆toScreen '+/lex1∆distribution t1'
assert∆message 'Lookup the values of various keys',⎕av[11]
'Demiri' 'Valerie' '928 Jaymor Road Suite B-150' 'Philadelphia' 'PA'
assert∆toScreen 't1 lex1∆lookup ''DemiriV'''
'Kinslow' 'Tracey' '1069 Jacksonville Road' 'Langhorne' 'PA' assert∆toScreen
't1 lex1∆lookup ''KinslowT'''
'Stewart' 'Steven' '9150 Marshall Street No 9' 'Philadelphia' 'PA'
assert∆toScreen 't1 lex1∆lookup ''StewartS'''
'Dellavella' 'Vladimir' '1850 Byberry Road' 'Levittown' 'PA' assert∆toScreen
't1 lex1∆lookup ''DellavellaV'''
(1↑⍴lex1∆keys t1) assert∆toScreen '⍴lex1∆values t1'
⍝)off