1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team-Mitglieder
    4. Trophäen
    5. Mitgliedersuche
  4. Tutorial Bereich
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. Informatik Forum
  2. Webmaster & Internet
  3. Entwicklung

Haskell

    • Frage
  • rose1000
  • 23. April 2006 um 18:20
  • Unerledigt
  • rose1000
    2
    rose1000
    Mitglied
    Punkte
    20
    Beiträge
    3
    • 23. April 2006 um 18:20
    • #1

    Hi to all,
    i am a newbie in Haskell, and it has recently become my nightmare.. i have several years of programming experince, but i have never been stuck like this..
    please share your knowlodge, if you have any about my problem.. so here is my basic and first problem;
    i have a text file and lines in it, i need to get the contents of the file line by line to a list in my program..

    Then i will process the list in some way this is not the deal.. the big deal is how do i get the contents of the file line by line to a list !?
    i will appreciate any help.. Thanks..




    (Ich kann Deutsch nicht ganz erklären, deshalb musste ich Egnlisch geschrieben)

  • Spockman
    5
    Spockman
    Mitglied
    Punkte
    210
    Beiträge
    41
    • 24. April 2006 um 02:10
    • #2
    Zitat von rose1000


    i have a text file and lines in it, i need to get the contents of the file line by line to a list in my program..

    Code
    main = do
      c <- getContents
      let ls0 = lines c
      let ls1 = map process_line ls0
      putStr (unlines ls1)
    
    
    process_line xs = drop 3 xs


    Now:

    $ cat txt
    1232652
    20aeusatheou
    3209625209856
    aoeu',l.cry,'rcg

    $ cat txt | runhugs test.hs
    2652
    eusatheou
    9625209856
    u',l.cry,'rcg

  • rose1000
    2
    rose1000
    Mitglied
    Punkte
    20
    Beiträge
    3
    • 24. April 2006 um 16:47
    • #3

    vielen dank

    mfG

  • Maximilian Rupp 27. Dezember 2024 um 12:06

    Hat das Thema aus dem Forum Programmieren nach Entwicklung verschoben.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!

Benutzerkonto erstellen Anmelden

Rechtliches

Impressum

Datenschutzerklärung