Here's an exercise. Cover these three verbs.
po=: 13 :'|:y#:i.*/y'   
cm=: 13 :'(*/y)(#"0)0,}:+/\y'
ac=: 13 :'((po + cm) ($y)#2){,'' '',.y'
   
TThese  three verbs provide all combinations of a penny, nickel, dime and 
quarter.

   po 2 2 2
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
   
   cm 2 2 2
0 0 0 0 0 0 0 0
2 2 2 2 2 2 2 2
4 4 4 4 4 4 4 4
   
   ac 'PNDQ'
        PPPPPPPP
    NNNN    NNNN
  DD  DD  DD  DD
 Q Q Q Q Q Q Q Q

Use the tacit forms to see if you can write the See if you can write thre 
explicit verbs. Then look at the definitions.    
   po
[: |: ] #: [: i. */
   
   cm
*/ (#"0) 0 , [: }: +/\
   
   ac
([: (po + cm) 2 #~ $) { [: , ' ' ,. ]
   
Tacitverbs are executed from right to left.
You can chop them into words to help make the
Verbs easier to find.

   ;:'([: (po + cm) 2 #~ $) { [: , '' '' ,. ]'
┌─┬──┬─┬──┬─┬──┬─┬─┬─┬─┬─┬─┬─┬──┬─┬───┬──┬─┐
│(│[:│(│po│+│cm│)│2│#│~│$│)│{│[:│,│' '│,.│]│
└─┴──┴─┴──┴─┴──┴─┴─┴─┴─┴─┴─┴─┴──┴─┴───┴──┴─┘
   
   
I find trees helpful too. Note when J inserts [: and when it doesn't   

5!:4 <'ac'
      ┌─ [:          
      │    ┌─ po     
      ├────┼─ +      
  ┌───┤    └─ cm     
  │   │              
  │   │    ┌─ 2      
  │   └────┼─ ~ ─── #
──┤        └─ $      
  ├─ {               
  │   ┌─ [:          
  │   ├─ ,           
  └───┤    ┌─ ' '    
      └────┼─ ,.     
           └─ ]      
      
   
Another day start with the explicit and write the explicit.

Next take an explicit verb you have written that  13:  has modified. And work 
backwards from  the tacit form.

Just a strategy I've used.

Linda   
   








-----Original Message-----
From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 
'robert therriault' via Programming
Sent: Friday, July 26, 2019 7:48 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Learning Tacit Programming

Hi Josh,

I have always leaned heavily on Henry Rich's excellent book "J for C 
Programmers" 
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.jsoftware.com%2Fhelp%2Fjforc%2Fcontents.htm%23_Toc191734581&amp;data=02%7C01%7C%7C4cad6234f9974c02b3ce08d71223a6f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636997816641507591&amp;sdata=5Utd2UwjRm73sQOaLUTXCzH9%2BheXZ3oB4EOnx4feHyA%3D&amp;reserved=0
 

In particular the section "Tacit Programs" helps with the technical details 
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.jsoftware.com%2Fhelp%2Fjforc%2Ftacit_programs.htm%23_Toc191734582&amp;data=02%7C01%7C%7C4cad6234f9974c02b3ce08d71223a6f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636997816641517602&amp;sdata=cuYJcfZm%2BZWt4FNBDWoVhBxBAwV62brSMTZTyDG%2Bz04%3D&amp;reserved=0
  

Also, using 13 : to declare verbs usually gives a tacit version of explicit one 
line verbs

    13 : ' x + y * y'
[ + ] * ]
   13 : ' x +: @ * y'
+:@*

Cheers, bob
   

> On Jul 26, 2019, at 4:20 PM, The3DSquare Josh Yang 
> <joshua.the3dsqu...@gmail.com> wrote:
> 
> I was wondering if you guys have any resources for learning tacit 
> programming in J. I've been struggling with tacit programming, 
> probably because all the other programming languages are mainly 
> explicit. Something like "Tacit programming for the explicit 
> programmer" would be great since I often fail to derive the tacit 
> equivalent of a series of explicit eeaxpressions (especially when there are 
> mutable variables).
> 
> I know I need to think differently, but having some guidance would 
> help greatly.
> ----------------------------------------------------------------------
> For information about J forums see 
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&amp;data=02%7C01%7C%7C4cad6234f9974c02b3ce08
> d71223a6f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63699781664151
> 7602&amp;sdata=z9MfRDOZIsLbU1Uv%2FpLRyfPzw00lVk8HjPTy1LEmnLw%3D&amp;re
> served=0

----------------------------------------------------------------------
For information about J forums see 
https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C4cad6234f9974c02b3ce08d71223a6f8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636997816641517602&amp;sdata=z9MfRDOZIsLbU1Uv%2FpLRyfPzw00lVk8HjPTy1LEmnLw%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to