Here is g:
  g=: 13 :'x?$y'
  g
[ ? [: $ ]

So, these expressions are equivalent:

  1 2 g 3 4 5
|length error
  1 2 ([ ? [: $ ]) 3 4 5
|length error
  1 2 ? ($ ] 3 4 5)
|length error
  1 2 ? ,3
|length error

--
Raul

On Mon, Feb 6, 2012 at 2:59 AM, bill lam <bbill....@gmail.com> wrote:
> If the sentence has a left argument,
>
> 1 2 ([: % [: # [) 3 4 5
> is
> % # 1 2
>
> The "y" is ignored for dyad g.
>
> for monadic g
> ([: % [: # [) 3 4 5
> is
> % # 3 4 5
>
> Пнд, 06 Фев 2012, Linda Alvord писал(а):
>> If what Bill states is correct
>>
>> Every verb in J is ambivalent determined by its context. If you put a noun
>> argument for it, it becomes dyadic.
>>
>> Then shouldn't the result be
>>
>>   1 2 g 3 4 5
>> 1 1
>>
>> Since
>>
>>   1 2 % 1 2
>> 1 1
>>
>> Linda
>>
>> -----Original Message-----
>> From: programming-boun...@jsoftware.com
>> [mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
>> Sent: Monday, February 06, 2012 2:08 AM
>> To: 'Programming forum'
>> Subject: Re: [Jprogramming] Another early morning exercise
>>
>> I can see now that  [  is a verb. There is still something I do not
>> understand about  g  .
>>
>>    g=: 13 :'%#x'
>>    g
>> [: % [: # [
>>
>>    x=: 3 4 5
>>    #x
>> 3
>>    %3
>> 0.333333
>>    g 3 4 5
>> 0.333333
>>
>> That is fine, but look at your example:
>>
>>    1 2 g 3 4 5
>> 0.5
>>
>> How did this happen?
>>
>>  1 2 [ 3 4 5
>> 1 2
>>    %1 2
>> 1 0.5
>>
>> What happened to the  1  ?  The result should be a list.
>>
>> Maybe the result should be "I'm only a monadic function and I can't do that.
>>
>> Linda
>>
>> -----Original Message-----
>>
>> From: programming-boun...@jsoftware.com
>> [mailto:programming-boun...@jsoftware.com] On Behalf Of Kip Murray
>> Sent: Monday, February 06, 2012 12:46 AM
>> To: Programming forum
>> Subject: Re: [Jprogramming] Another early morning exercise
>>
>> About [
>>
>>     2 [ 3
>> 2
>>     [ 3
>> 3
>>
>> Thus [ is a verb.  In general x [ y is x and [ y is y .
>>
>>
>> About g
>>
>>     # 1 2
>> 2
>>     1 2 g 3 4 5
>> 0.5
>>
>>     # 3 4 5
>> 3
>>     g 3 4 5
>> 0.333333
>>
>>
>> About f
>>
>>     0 1 2 # 3 4 5
>> 4 5 5
>>     0 1 2 f 3 4 5
>> 0.25 0.2 0.2
>>
>>     # 3 4 5
>> 3
>>     f 3 4 5
>> 0.333333
>>
>>
>> Kip
>>
>> On 2/5/2012 9:32 PM, Linda Alvord wrote:
>> > Dave Lambert mentioned to me in a post that I had made a typing error
>> typing
>> > x  instead of y :
>> >
>> >     i=: 13 :'*:@+/x'
>> >     i i.4
>> > 456976
>> >
>> > So, here are two questions:
>> >
>> >     f=: 13 :'%#y'
>> >     f
>> > [: % #
>> >     g=: 13 :'%#x'
>> >     g
>> > [: % [: # [
>> >
>> > Is  g  a request for a dyadic function or a monadic one?  Since the
>> results
>> > are different, why does  g  have the right  [:  before (to the right of)
>> two
>> > "verbs" if  [  represents a noun ?
>> >
>> > I've often seen this before and wondered about it.
>> >
>> > Linda
>> > -----Original Message-----
>> > From: programming-boun...@jsoftware.com
>> > [mailto:programming-boun...@jsoftware.com] On Behalf Of Don Guinn
>> > Sent: Sunday, February 05, 2012 8:21 AM
>> > To: Programming forum
>> > Subject: Re: [Jprogramming] Another early morning exercise
>> >
>> > Don't you need to change the x to y?
>> >
>> >    i=: 13 :'*:@+/y'
>> >    i i.4
>> > 456976
>> >    i=: 3 :'*:@+/y'
>> >    i i.4
>> > 456976
>> >    i=: 3 :'*:@+/x'
>> >    i i.4
>> > 676
>> >
>> > On Sun, Feb 5, 2012 at 5:11 AM, Linda
>> Alvord<lindaalv...@verizon.net>wrote:
>> >
>> >> My goal has been to translate from expressions with  @  to ones without
>> > it.
>> >>
>> >>
>> >>
>> >>    f=: 13 :'x?@$y'
>> >>
>> >>    2 3 f 6
>> >>
>> >> 2 4 2
>> >> 3 2 5
>> >>
>> >>
>> >>
>> >>    g=: 13 :'x?$y'
>> >>
>> >>    2 3 g 6
>> >>
>> >> |length error: g
>> >> |   2 3     g 6
>> >>
>> >>
>> >>
>> >>    h=: 13 :'?x$y'
>> >>
>> >>    2 3 h 6
>> >>
>> >> 4 3 1
>> >> 5 0 1
>> >>
>> >>
>> >>
>> >>    f
>> >>
>> >> ?@$
>> >>
>> >>    h
>> >>
>> >> [: ? $
>> >>
>> >>
>> >>
>> >> Can you rewrite this without @ ?
>> >>
>> >>
>> >>
>> >>    i=: 13 :'*:@+/x'
>> >>
>> >>    i i.4
>> >>
>> >> 456976
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Linda
>> >>
>> >> ----------------------------------------------------------------------
>> >> 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
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ----------------------------------------------------------------------
> 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