[Jprogramming] Parsing {{ }}
'Mike Day' via Programming
programming at jsoftware.com
Tue Jan 11 15:34:12 UTC 2022
Oh well. I thought you might have test-bedded these forms in J before moving to C, Henry, in which case there might have been a readymade J script!
As for Raul’s suggestion, that’s fine, but, in as far as I have copied across to J701, just typing the verb’s name in the session reveals the n : 0 ... ) form. Essentially, this leads to amending the J903 script, which rather defeats the purpose. I haven’t use nested ddefs.
Anyway, I’ve got a little way into writing a basic parser which will suffice.
Thanks,
Mike
Sent from my iPad
> On 11 Jan 2022, at 14:42, Henry Rich <henryhrich at gmail.com> wrote:
>
> There is nothing I know of that does what {{ }} does. But Raul's idea is pretty close. As he notes, it fails for nested {{ }} (there is much code that expects the result of 5!:5 <'explicitname' to have the form m : string, but nested {{ }} seemed OK).
>
> Henry Rich
>
>> On 1/11/2022 9:19 AM, Raul Miller wrote:
>> If you avoid nested {{ }} blocks, 5!:5 would do this.
>>
>> In other words, this works:
>>
>> mean=: {{ (+/ % #) y}}
>> 5!:5<'mean'
>> 3 : '(+/ % #) y'
>>
>> But this would be useless for your purposes:
>>
>> mean=: {{ {{x + y}} {{u/}} {{x % y}} {{#y}} }}
>> 5!:5<'mean'
>> 3 : '{{ x + y }} {{ u/ }} {{ x % y }} {{ #y }} '
>>
>> FYI,
>>
>>
>> --
>> Raul
>>
>> On Tue, Jan 11, 2022 at 4:25 AM 'Mike Day' via Programming
>> <programming at jsoftware.com> wrote:
>>> For Henry I expect: as I share code between J903 on the laptop and J701 on this iPad, I’ve been avoiding the use of {{ }} objects. (My iPad can’t support Ian’s new J902.)
>>>
>>> But I was just wondering about adding a routine to the J701 start.ijs script to parse a J903 script translating direct definitions to their earlier equivalents. And then I thought there might already be native J code to do this.
>>>
>>> So: do I need to invent this wheel?
>>>
>>> Thanks,
>>>
>>> Mike
>>>
>>> Sent from my iPad
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list