Re: [stack] R

Stevan Apter <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
that link is really REALLY slow.  if you're a member of ACM you can
get it there -- a better instance than the PDF of the photocopy at
the link i provided.  or you can purchase the collected turing award
papers, in which it appears.  or you can probably find that paper
and others by iverson at jsoftware.com. 

here's an illustration.

given a vector v (list, array, whatever) of integers and a maximum
value n, chop v into maximum subvectors s.  intuitively, you build s
by taking as much as you can from v without exceeding n, then take 
some more, &c.  the remainder (if any) is the final subvector of s.

  v:3 2 2 0 1 4 0 4 3 2 3 4 3 4 1 1 2 2 2 4
  n:10

  bp[n;v]
0 5 8 11 13 18  / breakpoints of v 

so:

  bp[n;v]_v     / chop v at those breakpoints
3 2 2 0 1
4 0 4
3 2 3
4 3
4 1 1 2 2
2 4

i picked this one off the k mailing list -- a recent query by a k
newbie.

as it happens, bp is idiomatic.  it crops up in lots of contexts.
for example, wordwrap:

  wordwrap:{" "sv'bp[x;count each w]_w:" "vs y}

  wordwrap[20;"split words on 20 column boundaries - produce a list of strings"]
"split words on 20 column"
"boundaries - produce a"
"list of strings"

that is,

    w:" "vs y              / split the string into words
    b:msv[x;count each w]  / find the breakpoints where count <= x
    s:b _w                 / chop the words into sublists at those points
    " "sv s                / fuse the words into a string
    
array languages evolve in the direction of finding a better range of
datatypes and a better set of primitives, with the result that a larger
set of problems come in range of array solution.  programs get smaller,
have less cruft, run faster, and take less space.

here's bp:

    bp:{-2_(1+a bin a|x+-1_0,a:sums y)\[0]}

enchilada is an array-oriented concatenative language, but very very
different from APL or j or k.  i don't know why it slipped my mind
when i raised the subject.

----- Original Message ----- 
From: "Christopher Diggins" <[email protected]>
To: <[email protected]>
Sent: Thursday, March 20, 2008 2:41 PM
Subject: Re: [stack] R


> On Thu, Mar 20, 2008 at 8:02 AM, Stevan Apter <[email protected]> wrote:
>> ----- Original Message -----
>> From: "John Nowak" <[email protected]>
>> >
>> > On Mar 19, 2008, at 8:54 PM, Stevan Apter wrote:
>> >
>> >> if that's intellectual curiosity, i am marie of roumania.
>> >
> 
> My original post (sorry if sounded like I was trolling) was because
> the R language looked to me like PostScript with several overloaded
> operators for dealing specifically with arrays. I was wondering if
> that is all that it took for a language to be considered an array
> language.
> 
>>
>> www.jdl.ac.cn/turing/pdf/p444-iverson.pdf
>>
>> still the best exposition of the central ideas of array programming.
> 
> Thanks for the link. I should emphasize that I am not in any way
> trying to negate any of the benefits of array programming, but as a
> language designer I want to know what characteristics a langauge
> should have to be considered an array language.
> 
> Thanks again,
> Christopher
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.