Advertisement
EstebanRevelo

Untitled

Apr 5th, 2021
1,974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 1.02 KB | None | 0 0
  1.  
  2. ;estructuras
  3. (define-struct pokemon(ID nombre estadisticas generacion legendario))
  4. (define-struct estadisticas(HP atq dfn atq-especial dfn-especial velocidad))
  5.  
  6. ;carga de datos
  7. ;contrato:lista de string -> lista de estructura
  8. (define(cargar-pokemon Ubicacion)
  9.   (local
  10.     (
  11.      (define lista(read-csv-file Ubicacion))
  12.      )
  13.     (transformar-estructura lista)))
  14. (define (transformar-estructura lista)
  15.   (cond
  16.     [(empty? lista)empty]
  17.     [else (cons (make-pokemon(string->number (first(rest(first lista)))))
  18.                 (first(rest (rest(first lista))))
  19.                 (first(rest(rest(rest(first lista)))))
  20.                 (string->number(first(rest(rest(rest(rest(first lista)))))))
  21.                 (if(String=? (First (rest (rest (rest (rest (rest (rest (rest (rest ( rest (Rest (rest (rest ( first lista)))))))))))
  22.                                                 "False" )#false #true))))
  23.                 (transformar-estructura(rest lista)))]
  24.     ))
  25. (define lst-pokemon(cargar-pokemon "data/pokemon.cvs"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement