Re: Simple Pascal question

Liste des GroupesRevenir à co vms 
Sujet : Re: Simple Pascal question
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 07. Aug 2024, 00:57:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8ud9t$1uf43$2@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 8/5/2024 8:34 AM, Michael S wrote:
On Sun, 4 Aug 2024 21:00:35 -0400
Arne Vajhøj <arne@vajhoej.dk> wrote:
On 8/4/2024 8:09 PM, Dan Cross wrote:
In article <v8o4h8$2ut3$1@dont-email.me>,
Arne Vajhøj  <arne@vajhoej.dk> wrote:
Like:
>
public class FlexArray {
      private static void dump(int[] a) {
          for(int v : a) {
              System.out.printf(" %d", v);
          }
          System.out.println();
      }
      public static void main(String[] args) throws Exception {
          int[] a1 = { 1 };
          int[] a2 = { 1, 2 };
          int[] a3 = { 1, 2, 3 };
          dump(a1);
          dump(a2);
          dump(a3);
      }
}
>
Java arrays are more like the aforementioned slices.
>
I don't think so.
>
Java does not have anything like slices.
>
C# does.
 >>
C# Span is similar to slices. But C# Span and C# array are far from
the same.
 Pay attention that despite being designed (or at least brought to
public) in this century, C# originally lacked slices.
They were added relatively recently, in v. 8.0, and referred in c# docs
as "Indices and ranges".
I thought it was C# 7.2.
It is important to note that C# Span and Range are
a little bit different than similar syntax in some of
the newer native languages supporting slice.
int[] a = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
Span<int> s1 = a[1..3];
does not create a span/slice/view of the second and third
element of a - it allocates a new array of length 2,
copy the second and third element of a to it and
create a span/slice/view of the new array.
Span<int> s2 = ((Span<int>)a).Slice(1, 2);
Span<int> s3 = (new Span<int>(a)).Slice(1, 2);
Span<int> s4 = new Span<int>(a, 1, 2);
all create a span/slice/view of the second and third
element of a.
Arne

Date Sujet#  Auteur
1 Aug 24 * Simple Pascal question41Arne Vajhøj
2 Aug 24 `* Re: Simple Pascal question40Uli Bellgardt
3 Aug 24  +* Re: Simple Pascal question38Scott Dorsey
3 Aug 24  i+- Re: Simple Pascal question1Arne Vajhøj
4 Aug 24  i+* Re: Simple Pascal question33Dan Cross
4 Aug 24  ii`* Re: Simple Pascal question32Arne Vajhøj
4 Aug 24  ii +* Re: Simple Pascal question4Lawrence D'Oliveiro
5 Aug 24  ii i+* Re: Simple Pascal question2Arne Vajhøj
5 Aug 24  ii ii`- Re: Simple Pascal question1Lawrence D'Oliveiro
5 Aug 24  ii i`- Re: Simple Pascal question1John Reagan
5 Aug 24  ii `* Re: Simple Pascal question27Dan Cross
5 Aug 24  ii  +* Re: Simple Pascal question24Arne Vajhøj
5 Aug 24  ii  i+* Re: Simple Pascal question3Dan Cross
7 Aug 24  ii  ii`* Re: Simple Pascal question2Arne Vajhøj
8 Aug 24  ii  ii `- Re: Simple Pascal question1Dan Cross
5 Aug 24  ii  i+- Re: Simple Pascal question1Lawrence D'Oliveiro
5 Aug 24  ii  i+* Re: Simple Pascal question5Michael S
5 Aug 24  ii  ii+* Re: Simple Pascal question2Lawrence D'Oliveiro
7 Aug 24  ii  iii`- Re: Simple Pascal question1Arne Vajhøj
7 Aug 24  ii  ii`* Re: Simple Pascal question2Arne Vajhøj
7 Aug 24  ii  ii `- Re: Simple Pascal question1Arne Vajhøj
7 Aug 24  ii  i`* Re: Simple Pascal question14Arne Vajhøj
7 Aug 24  ii  i `* Re: Simple Pascal question13Lawrence D'Oliveiro
8 Aug 24  ii  i  +* Re: Simple Pascal question10Arne Vajhøj
8 Aug 24  ii  i  i`* Re: Simple Pascal question9Simon Clubley
8 Aug 24  ii  i  i `* Re: Simple Pascal question8Arne Vajhøj
8 Aug 24  ii  i  i  +- Re: Simple Pascal question1Arne Vajhøj
9 Aug 24  ii  i  i  `* Re: Simple Pascal question6Simon Clubley
9 Aug 24  ii  i  i   `* Re: Simple Pascal question5Arne Vajhøj
9 Aug 24  ii  i  i    `* Re: Simple Pascal question4Dennis Boone
9 Aug 24  ii  i  i     `* Re: Simple Pascal question3Arne Vajhøj
9 Aug 24  ii  i  i      `* Re: Simple Pascal question2Dennis Boone
10 Aug 24  ii  i  i       `- Re: Simple Pascal question1Lawrence D'Oliveiro
8 Aug 24  ii  i  `* Re: Simple Pascal question2Arne Vajhøj
8 Aug 24  ii  i   `- Re: Simple Pascal question1Lawrence D'Oliveiro
5 Aug 24  ii  `* Re: Simple Pascal question2Arne Vajhøj
5 Aug 24  ii   `- Re: Simple Pascal question1Dan Cross
4 Aug 24  i`* Re: Simple Pascal question3John Reagan
5 Aug 24  i `* Re: Simple Pascal question2Arne Vajhøj
7 Aug 24  i  `- Re: Simple Pascal question1Arne Vajhøj
3 Aug 24  `- Re: Simple Pascal question1Arne Vajhøj

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal