[Jprogramming] Request for comments: multiple assignment

'Pascal Jasmin' via Programming programming at jsoftware.com
Tue Jul 11 14:48:04 UTC 2017




assignment within a delegated function includes default values, handling unassigned names, and other applications. Although update can be a "delegated assigment function" append is more relevant to default values.

Even if there are just a few "general applications" to delegated assignment, "other applications" count.  I mentioned append rather than update as a better example of using default values, but update is still a delegatable assignment function.  Instead of default values, it uses the "C pattern" u}= 'name' ... another general feature mentioned in this thread.


________________________________
From: Raul Miller <rauldmiller at gmail.com>
To: Programming forum <programming at jsoftware.com> 
Sent: Tuesday, July 11, 2017 10:17 AM
Subject: Re: [Jprogramming] Request for comments: multiple assignment



In every definition of default assignment that I have seen, update is
not supported, does not make sense, and is not implemented.

So that is what I am asking about: How does it make sense to optimize
for the impossible case?

Thanks,

-- 
Raul


On Tue, Jul 11, 2017 at 10:07 AM, 'Pascal Jasmin' via Programming
<programming at jsoftware.com> wrote:
> fields can often have default values other than null... relevant more to append than update.
>
> But this is more of a comment on "assignment within a delegated function" family of processes, which is what =:: and =.. essentially propose.
>
> For a different proposal of a "string dsl" for default values and type restrictions/coercions, than what Henry is hinting towards:
>
> https://github.com/Pascal-J/type-system-j
>
> Though it avoids using an assignment function.
>
>
> ________________________________
> From: Raul Miller <rauldmiller at gmail.com>
> To: Programming forum <programming at jsoftware.com>
> Sent: Tuesday, July 11, 2017 9:46 AM
> Subject: Re: [Jprogramming] Request for comments: multiple assignment
>
>
>
> How can update assignment be relevant when assigning default values?
>
> Thanks,
>
> --
> Raul
>
>
> On Tue, Jul 11, 2017 at 9:43 AM, 'Pascal Jasmin' via Programming
> <programming at jsoftware.com> wrote:
>> pretty much any use of =:
>>
>> (newrec ;reclookup) update assignwith 'database'
>>
>>
>>
>> ________________________________
>> From: Raul Miller <rauldmiller at gmail.com>
>> To: Programming forum <programming at jsoftware.com>
>> Sent: Tuesday, July 11, 2017 9:36 AM
>> Subject: Re: [Jprogramming] Request for comments: multiple assignment
>>
>>
>>
>> In what sort of cases are in-place optimizations a relevant issue for
>> assigning default values?
>>
>> Thanks,
>>
>> --
>> Raul
>>
>>
>> On Tue, Jul 11, 2017 at 9:06 AM, 'Pascal Jasmin' via Programming
>> <programming at jsoftware.com> wrote:
>>> The way I handle that,
>>>
>>> assignwithC
>>> 2 : 0
>>> (y) =: u (y~ [ ]) :: (n"_) 1
>>> :
>>> (y) =: x u (y~ [ ]) :: (n"_) 1
>>> )
>>>
>>>
>>> I think the call for =:: and =.. is based on 2 things.
>>>
>>> 1.  Although defaults and "ORvals"/unassigned default values can be handled easily enough through J expressions, for 805 anyway, it lost any inplace optimizations.
>>>
>>> 2. it only works for =: and not =.
>>>
>>>
>>>
>>> ________________________________
>>> From: Marshall Lochbaum <mwlochbaum at gmail.com>
>>> To: programming at jsoftware.com
>>> Sent: Tuesday, July 11, 2017 4:02 AM
>>> Subject: Re: [Jprogramming] Request for comments: multiple assignment
>>>
>>>
>>> Does this scheme support easily assigning a default value to a variable,
>>> that is, assigning only if the name is currently unused? This is a
>>> common case for me and I'm just now realizing that the "default" option
>>> doesn't really do that.
>>>
>>> See https://github.com/mlochbaum/JSound/blob/master/wav.ijs for an
>>> example, where I'm forced to write an awkward line of code to set the
>>> default format to 16-bit 44.1kHz. This seems easy enough to support with
>>> another trailing character on the name, like ^ or ?. So I would write
>>>    'FMT? F?' =: 1 16;44100
>>> instead of the current version.
>>>
>>> On a side note, Earl Grey is a good language to look at if you are
>>> interested in more sophisticated assignment schemes. I don't know if
>>> much of it is relevant to J, but it's very cool to see what can happen
>>> if you build a language to handle pattern matching from the bottom up.
>>> See http://www.earl-grey.io/doc.html, up to the section on pattern
>>> matching.
>>>
>>> Marshall
>>>
>>> On Tue, Jul 04, 2017 at 01:40:52AM -0400, 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

>
>>
>>>
>>> ----------------------------------------------------------------------
>>> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


More information about the Programming mailing list