>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




General

Author Thread: Problem adding a function to an existing []mom reference
Joe.Tibollo
Problem adding a function to an existing []mom reference
Posted: Thursday, November 30, 2006 1:29 PM (EST)

I have the following two []mom objects:

 

      ws.[]nl 2 3
fns
fns2
vars

      test.[]nl 3
vars
vars2

I would like to add vars in test and vars2 in test to my ws object.  Here is my attempt:

 

      ws.[]fx test.[]cr 'vars'
vars
      ws.[]fx test.[]cr 'vars2'
1

Does anyone know why I am having trouble adding function 'vars2'  to []mom object ws?

 

If I try to add vars2 outside of test to ws I get the same result i.e.

 

      ws.[]fx []cr 'vars'
vars
      ws.[]fx []cr 'vars2'
1

Does anyone know why I can't add 'vars2'.  I can initialize a []mom reference with vars2 without any problem.  I just can't add to an existing object...

 

/Joe


Comments:

Author Thread:
Support
Problem adding a function to an existing []mom reference
Posted: Thursday, November 30, 2006 5:12 PM (EST)

What version of APL+Win are you using?

What are the results from " test.Œcr 'vars2' " and " Œcr 'vars2' "?

 

APL2000 Support

     

Joe.Tibollo
Problem adding a function to an existing []mom reference
Posted: Friday, December 01, 2006 3:41 PM (EST)

Okay, this is a restatement of the problem, along with the display of vars2 under the conditions that you requested:

 

Please be sure you are using an APL FONT in

order to read the statements that follow:

 

(My only observation is that vars2 contains []PW

localized in the header.  The function vars does not (however, if a create another function called foo and it localized []pw, it seems to work just fine...)

 

Exerpts from APL session follow:

 

      test„Œmom 'vars' 'vars2'
      ws„Œmom 'fns' 'fns2' 'vars'
      test.Œnl 3
vars
vars2
      ws.Œnl 3
fns
fns2
vars
      ws.Œfx Œcr 'vars'
vars
      ws.Œfx Œcr 'vars2'
1
      Œcr 'vars2'
R„type vars2 filter;m1;m2;t1;t2;cc;colnums;fv;Œpw
© if type=0 use first chars of names
© else type=1 return names with filter anywhere in the name
© if fv=1 then fns else vars
fv„2
Œpw„96

colnums„6
:if 2=½,filter
    colnums„2œfilter
    filter„1œfilter
:endif

:if 0=½,filter
    filter„''
    :if 1=fv
        m1„Œnl 3
    :else
        m1„Œnl 2
    :endif
    R„iDEB ,(m1,' ')
    R„' ' icut R
    …skip
:endif
:if 0=Œnc 'type'
    type„0
:endif
:if fv=1
    m1„Œnl 3
:else
    m1„Œnl 2
:endif
filter„,filter
m2„m1[;¼½filter]
:if type=0
    t1„(Œsplit m2) Œss¨›filter
:else
    t1„(Œsplit m1) Œss¨›filter
:endif
t1„+/¨t1
:if 0=+/t1
    :if fv=1
        t2„'functions'
    :else
        t2„'vars'
    :endif
    :if type = 0
        R„'No ',t2,' found that begin with: ',filter
    :else
        R„'No ',t2,' found that contain: ',filter
    :endif
    …done
:endif

R„iDEB ,t1/[1](m1,' ')

© display colnums items per row
R„' ' icut R
skip:
:if ((½,R)>0)^((½,R)<colnums)
    colnums„½,R
:endif
t1„—(½R)÷colnums
R„(t1,colnums)½(t1×colnums)†R

t1„1†½R ª cc„1 ª m1„''
loop:
    t2„((colnums×cc-1)+¼½R[cc;]),[.5]R[cc;]
    cc„cc+1
    m1„m1 iOVER t2
    m1„m1,[1]›' '
    …(ccˆt1)/loop
    R„m1
    …done

done: …0
© done

      test.Œcr 'vars2'
R„type vars2 filter;m1;m2;t1;t2;cc;colnums;fv;Œpw
© if type=0 use first chars of names
© else type=1 return names with filter anywhere in the name
© if fv=1 then fns else vars
fv„2
Œpw„96

colnums„6
:if 2=½,filter
    colnums„2œfilter
    filter„1œfilter
:endif

:if 0=½,filter
    filter„''
    :if 1=fv
        m1„Œnl 3
    :else
        m1„Œnl 2
    :endif
    R„iDEB ,(m1,' ')
    R„' ' icut R
    …skip
:endif
:if 0=Œnc 'type'
    type„0
:endif
:if fv=1
    m1„Œnl 3
:else
    m1„Œnl 2
:endif
filter„,filter
m2„m1[;¼½filter]
:if type=0
    t1„(Œsplit m2) Œss¨›filter
:else
    t1„(Œsplit m1) Œss¨›filter
:endif
t1„+/¨t1
:if 0=+/t1
    :if fv=1
        t2„'functions'
    :else
        t2„'vars'
    :endif
    :if type = 0
        R„'No ',t2,' found that begin with: ',filter
    :else
        R„'No ',t2,' found that contain: ',filter
    :endif
    …done
:endif

R„iDEB ,t1/[1](m1,' ')

© display colnums items per row
R„' ' icut R
skip:
:if ((½,R)>0)^((½,R)<colnums)
    colnums„½,R
:endif
t1„—(½R)÷colnums
R„(t1,colnums)½(t1×colnums)†R

t1„1†½R ª cc„1 ª m1„''
loop:
    t2„((colnums×cc-1)+¼½R[cc;]),[.5]R[cc;]
    cc„cc+1
    m1„m1 iOVER t2
    m1„m1,[1]›' '
    …(ccˆt1)/loop
    R„m1
    …done

done: …0

 

      Œcr 'vars'
R„vars;t1;t2;cc;ccmax;t3;t4;t5;t6
Œ„'--- Begin VARS -',30½'-'
t1„(Œnl 2)[;1]
t1„,[1.5]t1
R„iremdups,t1[Œav“t1;]
cc„0 ª ccmax„½R ª t3„Œnl 2
lp1: cc„cc+1 ª …(cc>ccmax)/done
t2„ccœR ª t4„'-',t2,'-' ª t4„(1,(½t4))½t4
t1„(t3[;1]=t2)/[1]t3
t5„(Œsplit t1) imkcol 4
t6„(1†½t5)½0 ª t6[1]„1
(t6\[1]t4),t5
…lp1
done:
Œ„'=== End VARS =',30½'-'
 …0
© all done

     

Joe.Tibollo
Problem adding a function to an existing []mom reference
Posted: Friday, December 01, 2006 3:43 PM (EST)

Also, you asked about the version of APL that I am using.  As far as I know, I am using the latest version of APL v6.4.

 

/Joe

     

Support
Problem adding a function to an existing []mom reference
Posted: Friday, December 01, 2006 7:07 PM (EST)

You've found a bug in ŒMOM.  ŒFX fails to define a function when the header contains a quad name followed by a blank space.  In your example, the header in VARS3 is one of the shorter lines in the function.  This combined with ŒPW as the last localized variable in the header, caused the bug when ŒCR of VARS3 padded the header with blanks.

 

Thanks for bringing this bug to our attention.

 

APL2000 Support

     

Support
Problem adding a function to an existing []mom reference
Posted: Monday, December 18, 2006 5:06 PM (EST)

This bug is fixed in the version 7.0 beta (76.5.01) downloadable from http://apldn.apl2000.com/downloads/APLWI+Downloads/APLWIB6/default.aspx.

 

APL2000 Support

     



APL2000 Official Web Site

Make others happy and joyful. Your happiness will multiply a thousand fold.
--- Swami Sivananda

APLDN Home   |    |  Events   |  Trainings   |  APL Books   |  APLDN Links   |    |  Discussion Groups   |    |  Downloads   |  Articles   |  Library   |  Learning Tools   |  APLDN User IO   |  APL2000.com   |