Here is how you can get this "into the released interpreter" as well
as what might be some examples of the coding styles this asymmetry
encourages:
rightfold=:1 :0
[: > u&.>/@(<"_1@[ , <@])
)
(p:i.5) (":@[, ', ', ]) rightfold 'and ',":p:5
2, 3, 5, 7, 11, and 13
(p:i.4) (":@[, ', ', ]) rightfold (":p:4),' and ',":p:5
2, 3, 5, 7, 11 and 13
(p:i.5) (":@[, '-(', ], ')'"_) rightfold ":p:5
2-(3-(5-(7-(11-(13)))))
(p:i.5) - rightfold p:5
_5
(p:i.4) - rightfold (p:4)-p:5
_5
--
Raul
On Tue, Jun 23, 2015 at 4:01 AM, <[email protected]> wrote:
> The language allows it, with
>
> u&.>/@(<"_1@[ , <@])
>
> so all that would be needed is support for that form, right?
>
> The real problem is how to get an interpreter change into the released path.
> If Marshall can't do that, what hope is there for someone like me?
>
> Henry Rich
>
> ---- Marshall Lochbaum <[email protected]> wrote:
>> Short answer: there is no efficient way (and I find this to be a huge
>> problem).
>>
>> The most recent thread on this topic is here:
>> http://jsoftware.com/pipermail/programming/2015-February/041005.html
>>
>> Marshall
>>
>> On Tue, Jun 23, 2015 at 01:53:36AM +0000, Marshall Bockrath-Vandegrift wrote:
>> > Hi all,
>> >
>> > I'm still in the process of learning J, and trying to adapt ideas from
>> > other languages. In many (other?) functional programming languages it is
>> > possible to reduce over a collection starting with a provided initial value
>> > which does not belong to the reduced collection. To attempt to put this in
>> > J terms, such an operation would allow the initial value and result of each
>> > reduction step to have a different shape than that of the the items of the
>> > value being reduced. As far as I can tell, the standard `/` adverb provides
>> > no such facility. Is there a J idiom for this?
>> >
>> > Thanks,
>> >
>> > -Marshall
>> > ----------------------------------------------------------------------
>> > 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