NB. J standard definitions for CS2321 NB. Usually read into the z locale NB. Explicit definition noun =: 0 adverb =: 1 conj =: 2 verb =: 3 monad =: 3 dyad =: 4 locale =: 6 tacit =: 13 def =: : NB. Miscelaneous read_z_ =: 1 !: 1 @ < write_z_ =: (1 !: 2) < write_append_z_ =: (1 !: 3) < write_data_z_ =: dyad define x. =. , (format x.) ,. 10 { a. minus =. (x. = '_') # i. # x. ('-' minus } x.) write y ) box_chars =: (9!:7) & (1 0 2 3 4 5 & {) & (9!:6) write_append_data_z_ =: dyad define x. =. , (format x.) ,. 10 { a. minus =. (x. = '_') # i. # x. ('-' minus } x.) write_append y ) plot_z_ =: monad define nl =. 10 { a. y write_data 'plot.out' ('set autoscale y',nl)write'plot.cmd' NB.('set yrange[',(": <./ 1{"1 y),':',(": >./ 1{"1 y),']',nl)write_append'plot.cmd' NB.('set xrange[',(": <./ 0{"1 y),':',(": >./ 0{"1 y),']',nl)write_append'plot.cmd' ('plot "plot.out" with lines', nl )write_append'plot.cmd' ('pause -1' , nl) write_append 'plot.cmd' system'gnuplot plot.cmd' ) rows =: " 1 time =: 6 !: 2 space =: 7 !: 2 format =: ": names =: > @ (4 !: 1) system =: 2 !: 0 spawn_z_ =: 2 !: 1 ed =: vi =: monad def 'spawn_z_ ''vi '',y' gvim =: monad def 'spawn_z_ ''gvim '',y' gedit =: monad def 'spawn_z_ ''gedit '',y' emacs =: monad def 'spawn_z_ ''emacs '',y' xemacs =: monad def 'spawn_z_ ''xemacs '',y' gxedit =: monad def 'spawn_z_ ''gxedit '',y' gnuplot =: monad def 'spawn_z_ ''gnuplot ''' gnp =: monad def 'spawn_z_ ''gnp '',y' representation =: 5 !: 1 & < linear =: 5 tree =: 4 boxed =: 2 atomic =: 1 query_display =: 9!:2 set_display =: 9!:3 roll =: ? do =: ". log_session =: (0 !: 1 & 1) @ < print_precision =: 9 !: 10 set_print_precision =: 9 !: 11 over =: ({.;}.)@":@, by =: ' '&;@,.@[,.] table =: adverb def '[ by ] over x./' atop =: @ bond =: & rank =: " numberp =: monad def '+/1 4 8 16 64 e. 3 !: 0 y' charp =: monad def '2 = 3!:0 y' boxp =: monad def '32 = 3!:0 y' transpose =: |: rotate =: |. cat =: monad def 'system ''cat '',y' cut_last =: ;. _2 cut_first =: ;. _1 box_cut_last =: < cut_last box_cut_first =: < cut_first NB. Tracing display_z_ =: 1 !: 2 & 2 trace_z_ =: monad define display_z_ y : display_z_ (format x.),format y y ) entering =: 'Entering, input = '&trace_z_ leaving =: 'Leaving, result = '&trace_z_ error =: % atop display atop format erase =: 4 !:55 @ < NB. Standard Input/Output stdin_z_ =. monad def 'read_z_ 1' stdout_z_ =. write_z_ & 2 NB. Introduction tally =: # copy =: # shape =: $ reshape =: $ first =: {. rest =: }. append =: , integer =: i. box =: < open =: > link =: ; NB. Computer Organization rep =: #: base =: #. NB. Computer Circuits from =: { and =: *. or =: +. amend =: } take =: {. drop =: }. insert =: / NB. Data Structures reverse =: |. not =: -. last =: _1 & from drop_last =: _1 & drop match =: -: head =: open atop first nullp =: (0 bond =) atop tally NB. Object Programming make_z_ =: 0 !: 0 @ < for_effect_only_z_ =: monad def '''unspecified''' invalid_method_name_indicator_z_ =: 'unknown' root_object_z_ =: monad define ('method' ; 'value') =. 2 take y if. method -: 'type' do. 'root object' else. 'In root object: ',method,': Invalid method name.' end. ) NB. Programming Methodology to_char =: 3 !: 1 to_internal =: 3 !: 2 write_list =: dyad def '(to_char x.) write y' write_append_list =. dyad def '(to_char x.) write_append y' read_list =: to_internal @ read NB. Software Engineering gcd =: +. NB. Language Translation word =: ;: NB. Computability residue =: | NB. Artificial Intelligence stitch =: ,. not_equal =: ~: index_of =: i. ravel =: , query_output =: 9!:36 set_output =: 9!:37 max_output =: 0 2147483647 0 2147483647