Re: Whaddaya think?

Liste des GroupesRevenir à cl c  
Sujet : Re: Whaddaya think?
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.c
Date : 16. Jun 2024, 17:56:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4n1uh$40n6$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 16/06/2024 17:09, DFS wrote:
On 6/16/2024 12:44 AM, Janis Papanagnou wrote:
On 16.06.2024 06:17, Keith Thompson wrote:
>
For the original problem, where the input consists of digits and
whitespace, you could read a character at a time and accumulate the
value of each number.  (You probably want to handle leading signs as
well, which isn't difficult.)
>
Yes. Been there, done that. Sometimes it's good enough to go back
to the roots if higher-level functions are imperfect or quirky.
>
That is admittedly reinventing the
wheel, but the existing wheels aren't entirely round.  You still
have to dynamically allocate the array of ints, assuming you need
to store all of them rather than processing each value as it's read.
>
A subclass of tasks can certainly process data on the fly but for
the general solution there should be a convenient way to handle it.
>
I still prefer higher-level languages that take the burden from me.
 nums = []
with open('data.txt','r') as f:
     for nbr in f.read().split():
         nums.append(int(nbr))
     print(*sorted(nums))
 
nums = sorted(map(int, open('data.txt', 'r').read().split()))
But you'll learn more doing it with C :-)  And it's nice to see someone starting on-topic threads here.

Date Sujet#  Auteur
15 Jun 24 * Whaddaya think?96DFS
15 Jun 24 +- Re: Whaddaya think?1Malcolm McLean
16 Jun 24 +* Re: Whaddaya think?5Ben Bacarisse
16 Jun 24 i+* Re: Whaddaya think?2bart
16 Jun 24 ii`- Re: Whaddaya think?1Ben Bacarisse
16 Jun 24 i`* Re: Whaddaya think?2DFS
17 Jun 24 i `- Re: Whaddaya think?1Ben Bacarisse
16 Jun 24 +* Re: Whaddaya think?23Keith Thompson
16 Jun 24 i`* Re: Whaddaya think?22DFS
16 Jun 24 i +- Re: Whaddaya think?1Keith Thompson
17 Jun 24 i +* Re: Whaddaya think?19James Kuyper
17 Jun 24 i i+- Re: Whaddaya think?1Tim Rentsch
17 Jun 24 i i+* Re: Whaddaya think?13Kaz Kylheku
17 Jun 24 i ii+- Re: Whaddaya think?1Chris M. Thomasson
17 Jun 24 i ii+* Re: Whaddaya think?6DFS
17 Jun 24 i iii`* Re: Whaddaya think?5Richard Harnden
17 Jun 24 i iii +- Re: Whaddaya think?1David Brown
23 Jun 24 i iii `* Re: Whaddaya think?3Kaz Kylheku
23 Jun 24 i iii  +- Re: Whaddaya think?1Keith Thompson
23 Jun 24 i iii  `- Re: Whaddaya think?1Phil Carmody
18 Jun 24 i ii`* Re: Whaddaya think?5Tim Rentsch
18 Jun 24 i ii `* Re: Whaddaya think?4Keith Thompson
19 Jun 24 i ii  `* Re: Whaddaya think?3Tim Rentsch
19 Jun 24 i ii   `* Re: Whaddaya think?2Keith Thompson
19 Jun 24 i ii    `- Re: Whaddaya think?1Kaz Kylheku
17 Jun 24 i i`* Re: Whaddaya think?4DFS
17 Jun 24 i i `* Re: Whaddaya think?3Ben Bacarisse
18 Jun 24 i i  `* Re: Whaddaya think?2Janis Papanagnou
18 Jun 24 i i   `- Re: Whaddaya think?1Keith Thompson
17 Jun 24 i `- Re: Whaddaya think?1James Kuyper
16 Jun 24 +* Re: Whaddaya think?60Michael S
16 Jun 24 i+* Re: Whaddaya think?58Lawrence D'Oliveiro
16 Jun 24 ii`* Re: Whaddaya think?57Janis Papanagnou
16 Jun 24 ii +* Re: Whaddaya think?8Keith Thompson
16 Jun 24 ii i+- Re: Whaddaya think?1Lawrence D'Oliveiro
16 Jun 24 ii i`* Re: Whaddaya think?6Janis Papanagnou
16 Jun 24 ii i `* Re: Whaddaya think?5DFS
16 Jun 24 ii i  `* Re: Whaddaya think?4David Brown
16 Jun 24 ii i   +* Re: Whaddaya think?2bart
17 Jun 24 ii i   i`- Re: Whaddaya think?1David Brown
17 Jun 24 ii i   `- Re: Whaddaya think?1DFS
16 Jun 24 ii +* Re: Whaddaya think?45Janis Papanagnou
16 Jun 24 ii i`* Re: Whaddaya think?44Keith Thompson
16 Jun 24 ii i `* Re: Whaddaya think?43Janis Papanagnou
16 Jun 24 ii i  +* Re: Whaddaya think?20Keith Thompson
16 Jun 24 ii i  i`* Re: Whaddaya think?19Janis Papanagnou
16 Jun 24 ii i  i +* Re: Whaddaya think?2Malcolm McLean
16 Jun 24 ii i  i i`- Re: Whaddaya think?1Janis Papanagnou
16 Jun 24 ii i  i `* Re: Whaddaya think?16Keith Thompson
17 Jun 24 ii i  i  `* Re: Whaddaya think?15Janis Papanagnou
17 Jun 24 ii i  i   +* Re: Whaddaya think?12Keith Thompson
17 Jun 24 ii i  i   i`* Re: Whaddaya think?11Janis Papanagnou
17 Jun 24 ii i  i   i +* Re: Whaddaya think?5James Kuyper
18 Jun 24 ii i  i   i i+- Re: Whaddaya think?1Keith Thompson
18 Jun 24 ii i  i   i i`* Re: Whaddaya think?3Janis Papanagnou
18 Jun 24 ii i  i   i i +- Re: Whaddaya think?1James Kuyper
18 Jun 24 ii i  i   i i `- Re: Whaddaya think?1Keith Thompson
18 Jun 24 ii i  i   i `* Re: Whaddaya think?5Keith Thompson
18 Jun 24 ii i  i   i  +- Re: Whaddaya think?1Janis Papanagnou
19 Jun 24 ii i  i   i  `* Re: Whaddaya think?3Keith Thompson
19 Jun 24 ii i  i   i   `* Re: Whaddaya think?2David Brown
19 Jun 24 ii i  i   i    `- Re: Whaddaya think?1Keith Thompson
17 Jun 24 ii i  i   `* Re: Whaddaya think?2James Kuyper
17 Jun 24 ii i  i    `- Re: Whaddaya think?1Janis Papanagnou
16 Jun 24 ii i  +* Re: Whaddaya think?7Michael S
16 Jun 24 ii i  i`* Re: Whaddaya think?6Janis Papanagnou
16 Jun 24 ii i  i `* Re: Whaddaya think?5Michael S
16 Jun 24 ii i  i  `* Re: Whaddaya think?4Janis Papanagnou
16 Jun 24 ii i  i   `* Re: Whaddaya think?3Michael S
16 Jun 24 ii i  i    `* Re: Whaddaya think?2Janis Papanagnou
16 Jun 24 ii i  i     `- Re: Whaddaya think?1Michael S
17 Jun 24 ii i  `* Re: Whaddaya think?15Keith Thompson
17 Jun 24 ii i   +* Re: Whaddaya think?11Tim Rentsch
17 Jun 24 ii i   i+* Re: Whaddaya think?8Janis Papanagnou
17 Jun 24 ii i   ii+* Re: Whaddaya think?6DFS
17 Jun 24 ii i   iii+* Re: Whaddaya think?2Chris M. Thomasson
18 Jun 24 ii i   iiii`- Re: Whaddaya think?1Keith Thompson
18 Jun 24 ii i   iii+* Re: Whaddaya think?2Keith Thompson
18 Jun 24 ii i   iiii`- Re: Whaddaya think?1David Brown
18 Jun 24 ii i   iii`- Re: Whaddaya think?1Janis Papanagnou
18 Jun 24 ii i   ii`- Re: Whaddaya think?1Tim Rentsch
17 Jun 24 ii i   i`* Re: Whaddaya think?2James Kuyper
19 Jun 24 ii i   i `- Re: Whaddaya think?1Tim Rentsch
17 Jun 24 ii i   `* Re: Whaddaya think?3Janis Papanagnou
17 Jun 24 ii i    `* Re: Whaddaya think?2Keith Thompson
17 Jun 24 ii i     `- Re: Whaddaya think?1Janis Papanagnou
16 Jun 24 ii +- Re: Whaddaya think?1Malcolm McLean
16 Jun 24 ii `* Re: Whaddaya think?2Michael S
16 Jun 24 ii  `- Re: Whaddaya think?1Janis Papanagnou
16 Jun 24 i`- Re: Whaddaya think?1DFS
16 Jun 24 `* Re: Whaddaya think?6Lew Pitcher
16 Jun 24  +- Re: Whaddaya think?1Malcolm McLean
18 Jun 24  +- Re: Whaddaya think?1Lawrence D'Oliveiro
25 Jun 24  `* Re: Whaddaya think?3Lew Pitcher
25 Jun 24   `* Re: Whaddaya think?2DFS
25 Jun 24    `- Re: Whaddaya think?1Lew Pitcher

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal