We're discussing Cap as defined in an earlier post in this thread [1] . In
this case, it's a tacit adverb which consumes a verb and produces a similar
verb, where f@g phrases have been replaced by ([: f g) phrases.
It uses (`(<":0)) as part of its definition, which precludes J from
displaying it, once defined.
-Dan
PS: Following Raul's (& traditional) conventions, I capitalized the first
letter of Cap, to hint that it's an adverb. If I were defining a cover for
[: , I'd use all lowercase, as in
cap =: [:
(Though of course, there's not a lot of reason to name primitives.)
[1] Definition of Cap
http://www.jsoftware.com/pipermail/programming/2012-February/027112.html
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Don Guinn
Sent: Sunday, February 12, 2012 1:43 PM
To: Programming forum
Subject: Re: [Jprogramming] Another early morning exercise
What is the definition of Cap being used here? If Cap is defined as
Cap=:[:
it works fine.
5!:5<'Cap'
[:
1 2([: *: +)3 4
16 36
1 2(Cap *: +)3 4
16 36
On Sun, Feb 12, 2012 at 10:30 AM, Dan Bron <[email protected]> wrote:
> Linda wrote:
> > Cap
> > |domain error
>
> Yes, as I noted in my original message, there is a bug in the display
> family
> (5!:) that prevents the definition of Cap from being displayed. It boils
> down to this:
>
> ((<":0)`)
> |domain error
>
> Which has been known for a while. If this clause is removed from the
> definition of Cap, it will display just fine (but stop working, of
course).
>
> > What would be really great would be to UnCap and show me
> > all the phrases using @ in a tacit expression.
>
> Could you describe this in a little more detail, and maybe give some
> examples? I enjoy building J tools, so I'd be happy to take a whack at
it,
> if it's within my capabilities.
>
> Are you asking for something like this?
>
> definitions =: 'namelist' ;@:(] (,&.> <)~&.> [ ".@:,L:0
> ' i.4',L:0~ ]) ('_' ,&.> '_' ,L:0~ ])@:conl bind ''
> executable =: #~ 0 < nc
> tacit =: #~ 0 = [: +/ 1 2 (#@(5!:7))L:0 1"0/ ]
> atop_using =: #~ {.@('@' e.&;: ])@(5!:5) :: 0:"0
>
> list atop_using tacit executable definitions ''
>
> atop_using_base_ atterBoys_base_
> definitions_base_ tacit_base_
> GetSystemMetrics_j_ deb_j_
> dltb_j_ fexist_j_
> fileprintsetup_j_ deb_jijs_
> flexist_jijs_ id2name_jijs_
> ...
> tolist_jijs_ boxxopen_z_
> coclass_z_ cocurrent_z_
> codestroy_z_ conames_z_
> conl_z_ jcwdpath_z_
> jhostpath_z_ names_z_
> pick_z_ toCRLF_z_
> toJ_z_ type_z_
> ucpcount_z_ uucp_z_
> wdclipread_z_ wdforms_z_
> wdisparent_z_ wdreset_z_
>
> NB. Or, as re-usable verbs...
>
> atterBoys =: list@atop_using@tacit@executable@definitions
>
> upAndAtEm =: [: list [: atop_using [: tacit [: executable
> definitions
>
> (On the topic of @, it is instructive to compare atterBoys with the
> original
> noun phrase, and then upAndAtEm with atterBoys and the noun phrase...)
>
> > That is probably impossible because the definitions are so
> > ambiguous.
>
> Can you elaborate on this comment?
>
> -Dan
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm