NB. =========================================================
coclass 'pmem'
create=: 3 : 0
KEY=: ''
VAL=: ''
)
destroy=: codestroy
find=: 3 : 0
if. (#KEY)>i=.KEY i.boxopen y do.i{::VAL else. '' end.
)
set=: 4 : 0
KEY=: KEY,boxopen x
VAL=: VAL,boxopen y
)
cocurrent 'base'
mv=: 2 : 0
if. 0=#r=. find__n y do.y set__n r=.u y end. r
)
defm=: 1 : 0
u mv (''conew'pmem')
)
NB. =========================================================
fib1=: (+&$: <:)@<:`1:@.(<&2)
fib2=: (+&$: <:)@<:`1:@.(<&2) defm
fib2"0 i.20
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
(fib2 (-: , ]) fib1) 25
1 121393
5 ts'fib1 25'
0.343449 14720
5 ts'fib2 25'
5.1219e_5 4160
0.343449 % 5.1219e_5
6705.5
--- p j <[EMAIL PROTECTED]> wrote:
> define an adverb A such that:
>
> f A = 'f'
>
> that is for any verb f, f A returns the string that
> names f.
>
> If this is currently impossible, is there a way to use
> the 5!: functions such that f A generates a unique
> string for any value of f.
>
> A =: 1 : '5!:5 < ''u.''' NB. generates a string for
> the functionality of u. instead of the name of u.
>
> If none of this can be done, has anyone come up with a
> method to memoize results of a verb?
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325905
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm