-
Notifications
You must be signed in to change notification settings - Fork 0
/
TDA_date_20793038_SanhuezaVega.rkt
74 lines (60 loc) · 1.9 KB
/
TDA_date_20793038_SanhuezaVega.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#lang racket
; ######################################## LLAMADO DE RACKET/DATE ############################
(require racket/date)
; ######################################## TDA DATE ##########################################
; ######################################## REPRESENTACION ####################################
; Este TDA corresponde a una fecha.
; dentro de ella se incluye el dia, mes, año y hora.
; ######################################## CONSTRUCTOR #######################################
; Descripcion: Funcion que construye la fecha actual.
; Dom: null
; Rec: date (string)
; Recursion: -
(define make-current-date (lambda ()
(string-append
(get-current-day)
"/"
(get-current-month)
"/"
(get-current-year)
" "
(get-current-hour)
)
))
; ######################################## SELECTOR ##########################################
; Descripcion: Funcion que obtiene el dia actual.
; Dom: null
; Rec: day (string)
; Recursion: -
(define get-current-day (lambda ()
(number->string (date-day (current-date)))
))
; Descripcion: Funcion que obtiene el mes actual.
; Dom: null
; Rec: month (string)
; Recursion: -
(define get-current-month (lambda ()
(number->string (date-month (current-date)))
))
; Descripcion: Funcion que obtiene el año actual.
; Dom: null
; Rec: year (string)
; Recursion: -
(define get-current-year (lambda ()
(number->string (date-year (current-date)))
))
; Descripcion: Funcion que obtiene la hora actual.
; Dom: null
; Rec: hour (string)
; Recursion: -
(define get-current-hour (lambda ()
(string-append
(number->string (date-hour (current-date)))
":"
(number->string (date-minute (current-date)))
":"
(number->string (date-second (current-date)))
)
))
; ######################################## EXPORTACION DE FUNCION ############################
(provide make-current-date)