load'data.struct.ijs ' make 0!:0@< make_z_ 0!:0@< NB.vi spawn 2!:1 NB.vi 'stddefs.ijs' NB.vi'j' a |value error: a |[-7] history-20091001 for_effect_only a =:'hi there' unspecified a hi there cat 3 : 'system ''cat '',y.' cat'simple.object.ijs' NB. A simple object having a data value NB. and methods to access and set the data value. data =: 0 simple =: monad define 'method value' =. 2 {. y. if. method -: 'type' do. 'simple object' elseif. method -: 'get' do. data elseif. method -: 'set' do. for_effect_only data =: value elseif. 1 do. root_object method ; value end. ) 3 {. 1 1 0 0 #3{.'ab' 3 3{.'ab' ab make_s1_ 'simple.object.ijs' make_s2_ 'simple.object.ijs' simple_s1_ 'type' In root object: t: Invalid method name. 2{'type' p 2{<'type' |index error | 2 {<'type' |[-19] history-20091001 2{.<'type' +----++ |type|| +----++ simple_s1_ <'type' simple object simple_s1_ <'get' 0 simple_s1_ 'set';i.100 unspecified simple_s1_ <'get' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 simple_s2_ <'get' 0 make_s_ 'stack.object.ijs' stack_s_ <'type' stack stack_s_ <'size' 0 stack_s_ <'emptyp' 1 stack_s_ 'push';'Jack Howland' unspecified stack_s_ <'top' Jack Howland stack_s_ <'print' top of stack Jack Howland stack_s_ 'push'; %i.2 3 unspecified stack_s_ <'top' _ 1 0.5 0.333333 0.25 0.2 stack_s_ <'print' top of stack _ 1 0.5 0.333333 0.25 0.2 Jack Howland names list_z_@nl names_s_ '' data stack names_s_ noun data names_s_ verb stack noun,verb 0 3 stack_s_ 3 : 0 'method value' =. 2 {. y. if. method -: 'type' do. 'stack' elseif. method -: 'emptyp' do. 0 = # data elseif. method -: 'push' do. for_effect_only data =: (< value) , data elseif. method -: 'top' do. if. 0 = # data do. 'top: stack is empty' else. > {. data end. elseif. method -: 'pop' do. if. 0 = # data do. 'pop: stack is empty' else. for_effect_only data =: }. data end. elseif. method -: 'size' do. # data elseif. method -: 'print' do. if. 0 = # data do. 'print: stack is empty' else. for_effect_only display 'top of stack' s =. data while. 0 < # s do. for_effect_only display > {. s s =. }. s end. end. elseif. 1 do. root_object method ; value end. ) names '' a empty_queuep empty_stackp enter_queue front_queue lookup make_queue make_stack people pop_stack print_queue print_stack push_stack queue_tag queuep remove_queue size_queue size_stack stack_tag stackp the_empty_queue the_empty_stack top_stack names locale base j s s1 s2 stddefs z locale 6 names_z_ '' ARGV BINPATH CR CRLF DEL EAV FF FIXFONT IF64 IFCONSOLE IFJAVA IFUNIX IFWIN32 IFWINCE IFWINNT JVERSION LF Note PROFONT TAB UNAME adverb apply assert bind boxopen boxxopen break bx clear coclass cocreate cocurrent codestroy coerase cofind cofullname coinfo coinsert coname conames conew conjunction conl conouns conounsx copath copathnl copathnlx coreset coselect coselect_result costate cutopen datatype def define display do drop dyad each echo empty erase every exit expand fetch for_effect_only getenv inv invalid_method_name_indicator inverse items jcwdpath jhelp jhostpath jpath jsystemdefs leaf list load loadd make monad nameclass namelist names nc nl noun on pick require root_object rows script scriptd setbreak sign smoutput sort split startupconsole startupide stderr stdin stdout table take toCRLF toHOST toJ tolower toupper type ucp ucpcount utf8 uucp verb wcsize wd wdinfo names_j_ '' BOXES DISPLAYLOAD IFJIJX LOADED PATHSEP PUBLIC SCRIPTS SYSTEMFOLDERS TARGET USERFOLDERS addfname boxdraw buildpublic cutnames deb exist extijs fexist fullname getpath getscripts gettarget gettargetlocale jpath head open@first head ;/i.3 0 rest ;/i.3 +-+-+ |1|2| +-+-+ first ;/i.3 +-+ |0| +-+ people +-----------------------------------------+----------------------------+-------------------------------+-----------------------------------+----------------------------------+ |+-------+----+--------------------------+|+-------+----+-------------+|+-------+-------+-------------+|+-----+----+----------------------+|+----+------+--------------------+| ||howland|jack|computer science professor|||clinton|bill|president usa|||clinton|hillary|president usa|||perot|ross|wanted to be president|||bush|george|used to be president|| |+-------+----+--------------------------+|+-------+----+-------------+|+-------+-------+-------------+|+-----+----+----------------------+|+----+------+--------------------+| +-----------------------------------------+----------------------------+-------------------------------+-----------------------------------+----------------------------------+ >people +-------+-------+--------------------------+ |howland|jack |computer science professor| +-------+-------+--------------------------+ |clinton|bill |president usa | +-------+-------+--------------------------+ |clinton|hillary|president usa | +-------+-------+--------------------------+ |perot |ross |wanted to be president | +-------+-------+--------------------------+ |bush |george |used to be president | +-------+-------+--------------------------+ 0{people +-----------------------------------------+ |+-------+----+--------------------------+| ||howland|jack|computer science professor|| |+-------+----+--------------------------+| +-----------------------------------------+ look_up 'howland';people |value error: look_up | look_up'howland';people |[-54] history-20091001 lookup 'howland';people |length error: lookup | 'name database' =.y. lookup 3 : 0 'name database' =. y. if. nullp database do. '' else. if. name match head head database do. head database else. lookup name ; box rest database end. end. ) lookup 'howland';people |length error: lookup | 'name database' =.y. lookup 'howland';people +-------+-------+--------------------------+ |howland|jack |computer science professor| +-------+-------+--------------------------+ |clinton|bill |president usa | +-------+-------+--------------------------+ |clinton|hillary|president usa | +-------+-------+--------------------------+ |perot |ross |wanted to be president | +-------+-------+--------------------------+ |bush |george |used to be president | +-------+-------+--------------------------+ lookup 'clinton';