Linda wrote: Jose,  What is  cap?

Cap is an adverb to replace ats (@:) for caps ([:).  It is the counterpart
of the
adverb decap ( see,
http://www.jsoftware.com/pipermail/programming/2014-May/037314.html )
and it is similar to Dan's Cap (see,
http://www.jsoftware.com/pipermail/programming/2012-February/027112.html ).

I did not provide its definition for several reasons:
- Gmai's line wrapping gets in the way (this can be dodged).
- It is written in extended J; so, one would have to use a special
interpreter in the first place.
- I rely on many tools and sometimes it is very hard to unravel a
definition.  These are the
  definitions of cap and decap,

NB. Transform (adv)...
NB. Transforming forms according to the verb u (e.g., [: u transform)

transform=. u([: train ($:e t (0 < L.) o (u g))rs ('' $ '' tie ]) At)
Lambda  NB. (adv)
  NB. Forcing gerunds to ARs                      ('' $ '' tie ])

icf=. (((":verb) -: ('';0)f) *. ('[:' -: ('';1;0)f)) :: 0:  NB. Is an AR of
a capped fork?
decapAR=. (< o ('@:' j }. o (('';1)f))) t icf               NB. Producing
(u @: v) from ([: u v)
decap=. [: decapAR transform f.adv
iat=. ('@:' -: ('';0)f) :: 0:                               NB. Is an AR of
(u @: v)?
capAR=. (< o ((":verb) j '[:' ; ('';1)f)) t iat             NB. Producing
([: u v) from (u @: v)
cap=. [: capAR transform f.adv

  erase'icf decapAR iat capAR'

- Fixing cap would automatically unravel it all the way; actually, cap is
already fixed,

   cap
(1]:(<(,'0');(]:(<'`:'))&6@:($:&.>^:(0 < L.)@:(<@:((,'3') ,&< '[:' ;
('';1)&({::))^:(('@:' -: ('';0)&({::)) ::0:)"0) (103!:0))@:('' $ ''
(]:(<,'`')) ])))

  but unfortunately it is useless to show it because the linear display
cannot handle it;
  worse, the usual workaround does not work either.
So, I just showed the verbs that it produces which, I think, are close to
the form that
you like (and I dislike :) ).  However, cap could be rewritten in the
official J, tacitly
or otherwise.

I hope it helps.  I am afraid that to a considerable extent I am living now
in my own J world.


On Fri, Jun 6, 2014 at 8:50 PM, Linda Alvord <[email protected]>
wrote:

> Jose,  What is  cap?
>
>    ( t3=. t2 f. cap )
>
> Linda
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Jose Mario Quintana
> Sent: Thursday, June 05, 2014 6:07 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Turtle graphics, Gaussian integers and
> Mechanical action...
>
>    t0=. ('0' = _1 {:: ])@:((, <@;@:{~&_1 _2)@]^:(2 -~ [)&('1';'0'))  NB.
> Tacit 0
>
>    BUILD=: 3 : '(B=:A,B);A=:B,A'
>    e0=:    13 :'-.>0{"2 (BUILD^:y'''')[''A B''=:1`0'                 NB.
> Explicit 0
>
>    t1=. _1&({::)@:((] , <@:(_1&({::) , _2&({::)))@:]^:[)&(0;1)       NB.
> Tacit 1
>
>    t2=. _1&({::)@:(({: , ,&.>/@:|.)@:]^:[&(0;1))                     NB.
> Tacit 2
>
>    ( t3=. t2 f. cap )                                                NB.
> Tacit 3 (for Linda)
> [: _1&({::) ([: ({: , [: ,&.>/ |.) ])^:[&(0;1)
>
>    (t0 20) -: (e0 9)
> 1
>    (t1 18) -: (e0 9)
> 1
>    (t2 18) -: (e0 9)
> 1
>    (t3 18) -: (e0 9)
> 1
>
>    st                                                                NB.
> Comparison...
> (] , <@:(1&({::) * 2&({::)))@:(] ; 7!:2@:] ; 6!:2)
>
>    100 st&> 't0 20' ; 'e0 9' ; 't1 18' ; 't2 18' ; 't3 18'
> ┌─────┬─────┬──────────┬────────┐
> │t0 20│38400│3.07565e_5│1.18105 │
> ├─────┼─────┼──────────┼────────┤
> │e0 9 │14592│2.57905e_5│0.376335│
> ├─────┼─────┼──────────┼────────┤
> │t1 18│32000│3.4395e_5 │1.10064 │
> ├─────┼─────┼──────────┼────────┤
> │t2 18│22912│1.2253e_5 │0.28074 │
> ├─────┼─────┼──────────┼────────┤
> │t3 18│23424│1.44645e_5│0.338817│
> └─────┴─────┴──────────┴────────┘
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to