Its a bit of a weird function, as it doesn't produce correct combinations for x 
other than 2.

A version that doesn't repeat the list calculation (could get very large)

2    I.@([ (([=  +/@:|:@]) #"2 ]) (#~#:i.@^)) 5

But I don't know what this function is supposed to do (result) for x other than 
2.




----- Original Message -----
From: Linda A Alvord <lindaalv...@verizon.net>
To: programm...@jsoftware.com
Sent: Saturday, November 28, 2015 10:39 AM
Subject: Re: [Jprogramming] dyadic J

What would cr look like in your perfect world?
How could you modify it in the ways you suggest?

Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com 
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of 'Pascal Jasmin' 
via Programming
Sent: Saturday, November 28, 2015 10:00 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] dyadic J

tacit code is primarily a writting convenience and performance benefit.

A recent point of conversion of mine is that u@:v is both easier to read and 
edit/expand and easier to see subresults by cutting out parts of an @ train 
"s@t@u@v" even if its u@:(v) compared to [: u v.

13 : may be readable, but may also require outter parentheses, double quoting 
of any strings, and may fail at converting to tacit.  Its also not perfectly 
predictable, ie. I remember cases where it failed to do what I wished it to, 
and so adds a layer of "debugging".




----- Original Message -----
From: Linda A Alvord <lindaalv...@verizon.net>
To: programm...@jsoftware.com
Sent: Saturday, November 28, 2015 2:27 AM
Subject: Re: [Jprogramming] dyadic J

Pascal and others. I am curious to know if you find tacit code easy to read.

cr=:([ = [: +/ [: |: #~ #: [: i. ^) #"2 #~ #: [: i. ^
divy=:([: ,. [: <"1 '*' $~ ] ,~ [: <. %) , [: < '*' $~ [ - ] * [: <. %  
  
Those two tacit lines seem hard to translate for me. Instead I find the 
expressions below are quite easy to follow.
  
   cr=: 13 :'(x= +/ |:(y#x)#:i.x^y) #"2 (y#x)#:i.x^y'
   divy=: 13 :'(,.<"1((<.x%y),y)$''*''),<(x-y*<.x%y)$''*'''
  
In most cases, with examples there is little documentation that is necessary.

2 cr 5                          
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 1
0 1 0 1 0
0 1 1 0 0
1 0 0 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
18 divy 5
------┐
│*****│
+-----+
│*****│
+-----+
│*****│
+-----+
│***  │
L------
Maybe it is just that the explicit code looks like mathematics. It might be 
interesting and useful to hear how programmers and J users read code most 
easily.

Linda
-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Kelly
Sent: Friday, November 27, 2015 10:37 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] dyadic J

there is nothing wrong with saying something like plus =: + conjugate =:+ and 
knowing that  plus is intended to be monadic (although  +(real
number) is the real number in either case.  If you want one to work as monadic 
onlyand the other as dyadic only-then you have to dress them up a bit with some 
test and error message.
you can do  mean=:  sum divideby count  in any language.
J has 2 meanings for +  -which are dependent on the context. English also is 
like that in that some words have two unrelated meanings (e.g bow , can, twig, 
butt ) as well as having some with related meanings (e.g rise, level) and a lot 
of other things that depend on context It would be possible to build up a long 
list of names so that all uses of the primitives have different names and do 
just what the names indicate but is that of any more than limited  use?



On 11/27/2015 1:08 PM, 'Pascal Jasmin' via Programming wrote:
> Are you saying that if I define
>
> floor =: (<. : (<.@]))"0 _ 0
>
> that it does not have integrated rank support?
>
> The criticism about english and documentation seems hollow to me.  I 
> don't
say that Nuvoc is useless because it hasn't been implemented in 150 languages.  
An ability to read the dictionary in English is essential to learn J, and code 
typically uses english shaddows from profile.ijs.  Making foreign language 
cover verbs including autotranslating the english ones is straightforward, and 
answers that part of the criticism.  Using the exact names from the dictionary 
(what I'm refering to as autodocumentation because the exact same place you 
would look up i. is where iota will be explained.) seems like an elegant way to 
ease a shallow learning curve on the process.
>
> The entire criticism could be applied to "you should never assign a 
> verb
to any name"
>
>
>
>
> ----- Original Message -----
> From: Raul Miller <rauldmil...@gmail.com>
> To: Programming forum <programm...@jsoftware.com>
> Sent: Friday, November 27, 2015 3:27 PM
> Subject: Re: [Jprogramming] dyadic J
>
> On Thu, Nov 26, 2015 at 4:12 PM, 'Pascal Jasmin' via Programming 
> <programm...@jsoftware.com> wrote:
>> The only disadvantage I recognize is the point about special code.
> It would be interesting to go over the reasons you do not recognize 
> the other disadvantages.
>
>> As to your other points, because the primitives are tacit, I believe
there is integrated rank support.
>>
>>    floor b. 0
>> 0 _ _
> You might want to read
> http://www.jsoftware.com/pipermail/general/1998-October/000041.html
>
> All verbs have rank support, even verbs which contain explicit 
> definitions. However, for some combinations of primitives, the 
> interpreter takes special steps - bypassing the default implementation 
> of rank support with something more efficient.
>
>> English is needed to read dictionary, and all of the primitives are 
>> the
monad dictionary entries, so everything is autodocumented.
> In my experience, documentation is difficult and autodocumentation 
> quickly falls victim to entropy. It sounds great, but most examples I 
> have seen become incredibly useless in practice. It's possible to work 
> around this with manual effort, but the effort involved often seems to 
> be greater than the effort of simply doing it manually in the first 
> place. Where automation shines is replicating the useful manual 
> efforts.
>
>> The advantage bigger than the one you mentioned is better seeing the
intent of code.
> Agreed.
>
> Thanks,
>

----------------------------------------------------------------------
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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to