Advertisement
JF_Jaramillo

1

Sep 26th, 2020
1,873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 1.78 KB | None | 0 0
  1. (require 2htdp/batch-io)
  2. (define-struct aspirante (numero-inscripcion nombre apellido c1 c2 c3 c4 c5 codigo-programa))
  3.  
  4. ;; Autor: Paola Andrea Dominguez - 202059956 ,  Juan Felipe Jaramillo - 202060257
  5. ;; Fecha de Creación: 26 de Septiembre de 2020
  6. ;; Contrato: Cargar-datos: string -> lista de empleados
  7. ;; Propósito: Esta función lee un archivo del cual le pasamos la ubicación como parámetro, y retorna los datos leidos como una lista de empleados.
  8. ;; Ejemplos:
  9. ;; (cargar-datos "Data/Empleados.txt"), retorna:
  10. ;; Definición:
  11. (define listaAspirantes empty) ;; Variable de lista de empleados
  12.  
  13. (define (cargar-datos ubicacion)
  14.   (local
  15.     (
  16.      (define (cargarAspirantes listaAspirantes)
  17.        (cond
  18.          [(empty? listaAspirantes) empty]
  19.          [(not (cons? listaAspirantes)) "Porfavor cargue una lista"]
  20.          [(cons? (first listaAspirantes))
  21.           (cons
  22.            (make-aspirante
  23.             (string->number (first (first listaAspirantes)))
  24.             (second (first listaAspirantes))
  25.             (third (first listaAspirantes))
  26.             (string->number (fourth (first listaAspirantes)))
  27.             (string->number (fifth (first listaAspirantes)))
  28.             (string->number (sixth (first listaAspirantes)))
  29.             (string->number (seventh (first listaAspirantes)))
  30.             (string->number (first (rest (rest (rest (rest (rest (rest (first listaAspirantes)))))))))
  31.             (string->number (first (rest (rest (rest (rest (rest (rest (rest (first listaAspirantes))))))))))
  32.            
  33.             ) (cargarAspirantes (rest listaAspirantes))
  34.               )]
  35.          [else (error "Error al cargar los Aspirantes. Por favor intente de nuevo.")]
  36.          ))
  37.      )
  38.     (set! listaAspirantes (cargarAspirantes (read-words/line ubicacion)))
  39.     ))
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement