NB. Some functions to manage the sysadmin database. NB. A database is a list of boxed items, called records. NB. A record is list of 6 boxed items: NB. problem-date (format yyyymmdd) NB. problem-source (initials of the person who reports the problem) NB. problem-completion-date (format yyyymmdd) NB. problem-solver (initials of person who solves the problem) NB. problem-name (brief phrase describing problem; potential search key) NB. problem-description (detailed text describing problem) NB. database file-name sysadmin.db NB. db_create, usage: db_create 'db-file-name' db_create =: monad def 0 '' write_list y. ) NB. add_record, usage: 'yyyymmdd' add_record 'initials-of-problem-source' add_record =: dyad def 0 'ProblemName'write'prob-name' 'ProblemDescription'write'prob-desc' vi'prob-name' vi'prob-desc' ((read_list 'my.db'), < x. ; y. ; 'wwww' ; 'xx' ; (_1 }. read'prob-name') ; _1 }. read'prob-desc')write_list 'my.db' ) NB. edit_record, usage: field edit_record record-number edit_record =: dyad def 0 db =. read_list 'my.db' record =. y. { > db (> x. { record) write'temp' vi'temp' new_record =. (< _1 }. read'temp') x. } record (( read_list y.' NB. Key accessor functions, usage: key-fn 'db-file-name' get_prob_date =: prob_date&get_keys get_prob_source =: prob_source&get_keys get_completion_date =: completion_date&get_keys get_prob_solver =: prob_solver&get_keys get_prob_name =: prob_name&get_keys get_prob_description =: prob_description&get_keys NB. locate_all (build db of all records matching a given key) NB. usage: locate_all field-name ; 'search-text' ; 'db-file-name' NB. A useful command to build incomplete.db (database of incomplete problems) NB. (locate_all completion_date ; 'wwww' ; 'sysadmin.db')write_list 'incomplete.db' locate_all =: monad def 0 ('x' ; 'y' ; 'db') =. y. ((< y) -: "0 x get_keys db) # read_list db ) NB. locate (get record of first match of a given key) NB. usage: locate field-name ; 'search-text' ; 'db-file-name' locate =: (>@ {.)@ locate_all