[Jprogramming] Request for comments: multiple assignment
'Pascal Jasmin' via Programming
programming at jsoftware.com
Tue Jul 4 19:41:22 UTC 2017
though I didn't define the monadic section of is, there should be one, so
2 * is 'y' NB. replace y with its double.
or
*: is 'y' NB. replace y with its square.
the constant parameter is the assigned variable.
as to ~ (im referring to evoke not passive/reflect)
'a b'~ is an ill-formed name error, and so no harm in redefining it.
if one of a or b is a verb, then the proposal would be that it would error, but
'`a b'~ would return the gerund of each's ar (so noun and verbs mixed will be natural)
basically 'name(s)'~ would be the "inverse" of 'name(s)' =: boxes of nouns (this already works when just one name)
and '`name(s)'~ would be the "inverse" of '`name(s)' =: gerund.
________________________________
From: Raul Miller <rauldmiller at gmail.com>
To: Programming forum <programming at jsoftware.com>
Sent: Tuesday, July 4, 2017 2:55 PM
Subject: Re: [Jprogramming] Request for comments: multiple assignment
I do not understand why I want y to be the assigned variable,
actually. If our motivation is patterned on C, there's no x*=;
More generally, "because we can" as the only motivation for a design
decision quickly gets us into utterly dysfunctional territory.
It also bothers me that you seem to be suggesting we change ~ in a
fashion which is incompatible with the current implementation.
Right now:
m=: *
m~ 3
9
Changing m~ to return a noun (or, worse, munging the noun/verb
distinction) has all sorts of other consequences.
Anyways, some changes are good, but I do not see why I should think
these changes are good.
Thanks,
--
Raul
On Tue, Jul 4, 2017 at 2:30 PM, 'Pascal Jasmin' via Programming
<programming at jsoftware.com> wrote:
> for your is verb, you want y to be the assigned variable to support monadic verbs.
>
>
> is =: 1 : (':';'(y) =: x u y~'
>
> to support x u is 'a b',
>
> 'a b'~ would have to be defined as 'a'~ ; 'b'~
>
> and then, '`a b c'~ could be defined as (a ar), (b ar), (c ar)
>
> where
>
> ar =: 1 : '5!:1 <''u'''
>
>
> ________________________________
> From: Raul Miller <rauldmiller at gmail.com>
> To: Programming forum <programming at jsoftware.com>
> Sent: Tuesday, July 4, 2017 2:12 PM
> Subject: Re: [Jprogramming] Request for comments: multiple assignment
>
>
>
> It might be interesting to try redefining the dictionary II.E parsing
> rules at http://www.jsoftware.com/help/dictionary/dicte.htm to support
> stuff like a+=:i.20
>
> That said, you can already do this:
>
> a=:10
> is=:1 :(':';'(y)=:(".x) u y')
> 'a'+is i.20
> 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
>
> And, maybe that's good enough, since it's not really clear what should
> be done for most of the potential left arguments for =:
>
> b=:9
> 'a b',is 1
> |syntax error
> | a b
>
> Or, for example:
>
> a=:+/`%
> '`a',is #`''
> +-+
> |#|
> +-+
>
> We could patch those things up, and we could replace the definition
> with a tacit version based on ". (perhaps with explicit helpers), to
> allow an =. workalike, but the real problem with this line of thinking
> is that a C expression like *p+=3 is not what you want to be doing in
> J. What you should be trying to do is >>understand what the C
> implementation is doing<< and implementing that understanding in J.
>
> And, if you do not understand the C code, you should probably spend
> some time instrumenting and debugging the C code to build up that
> understanding. Or, work forward from the original specifications (to
> the degree that they exist at all - if you get enough people working
> on a system you'll wind up with all sorts of contradictory details -
> most of which should be ignored, but some of which people will have
> come to want and occasionally even need).
>
> Anyways this could be a fun exercise - but probably one which should
> be discarded after completing.
>
> Thanks,
>
> --
> Raul
>
>
>
> On Tue, Jul 4, 2017 at 1:55 PM, 'Mike Day' via Programming
> <programming at jsoftware.com> wrote:
>> Not multiple assignment, but copula-related.
>>
>> I've often wondered why J doesn't have the C family feature of assignments
>> such as
>> t =: 1 2 3
>> [t+=: 3
>> 4 5 6
>>
>> I don't know what it's called, and I realise it's only an arguably
>> attractive
>> feature, not an essential one, but would be useful, especially when
>> translating
>> (or plagiarising) to J from C-like code.
>>
>> John Scholes et al managed to include it in Dyalog APL many years ago; it's
>> in his "dfns" (dynamic functions, I think) as well as their more
>> conventional
>> APL functions and session operations. If I recall correctly, John spells
>> out rules
>> for passing values to variables of local scope within dfns using such
>> operators.
>>
>> Dyalog doesn't have constructs like t++, though.
>>
>> Thanks,
>> Mike
>>
>>
>> On 04/07/2017 06:40, HenryRich wrote:
>>>
>>> Here is a feature that I have wanted for a long time:
>>>
>>>
>>> http://code.jsoftware.com/wiki/System/Interpreter/Requests#Expanded_Multiple_Assignment
>>>
>>> It attempts to solve the problem of moving verb arguments into
>>> variable-names. Allows defaults and multilevel arguments. I will implement
>>> this within a month or so, so get your comments in ASAP.
>>>
>>> Henry Rich
>>>
>>> ---
>>> This email has been checked for viruses by AVG.
>>> http://www.avg.com
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>
>>
>>
>> ----------------------------------------------------------------------
>> 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
More information about the Programming
mailing list