Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (require 2htdp/batch-io)
- (define-struct aspirante (numero-inscripcion nombre apellido c1 c2 c3 c4 c5 codigo-programa))
- ;; Autor: Paola Andrea Dominguez - 202059956 , Juan Felipe Jaramillo - 202060257
- ;; Fecha de Creación: 26 de Septiembre de 2020
- ;; Contrato: Cargar-datos: string -> lista de empleados
- ;; 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.
- ;; Ejemplos:
- ;; (cargar-datos "Data/Empleados.txt"), retorna:
- ;; Definición:
- (define listaAspirantes empty) ;; Variable de lista de empleados
- (define (cargar-datos ubicacion)
- (local
- (
- (define (cargarAspirantes listaAspirantes)
- (cond
- [(empty? listaAspirantes) empty]
- [(not (cons? listaAspirantes)) "Porfavor cargue una lista"]
- [(cons? (first listaAspirantes))
- (cons
- (make-aspirante
- (string->number (first (first listaAspirantes)))
- (second (first listaAspirantes))
- (third (first listaAspirantes))
- (string->number (fourth (first listaAspirantes)))
- (string->number (fifth (first listaAspirantes)))
- (string->number (sixth (first listaAspirantes)))
- (string->number (seventh (first listaAspirantes)))
- (string->number (first (rest (rest (rest (rest (rest (rest (first listaAspirantes)))))))))
- (string->number (first (rest (rest (rest (rest (rest (rest (rest (first listaAspirantes))))))))))
- ) (cargarAspirantes (rest listaAspirantes))
- )]
- [else (error "Error al cargar los Aspirantes. Por favor intente de nuevo.")]
- ))
- )
- (set! listaAspirantes (cargarAspirantes (read-words/line ubicacion)))
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement