figured out how to use keywords to create files
parent
ae2b6ae9a8
commit
7cdd820138
9
rodo.rkt
9
rodo.rkt
|
@ -16,13 +16,20 @@
|
||||||
'yes '("yes" "Yes" "y" "Y")
|
'yes '("yes" "Yes" "y" "Y")
|
||||||
'no '("no" "No" "n" "N")))
|
'no '("no" "No" "n" "N")))
|
||||||
|
|
||||||
|
(define (open/create-file path)
|
||||||
|
(let ([path (expand-user-path path)])
|
||||||
|
(open-output-file path
|
||||||
|
#:mode 'text
|
||||||
|
#:exists 'can-update)))
|
||||||
|
|
||||||
; just figuring out stuff here
|
; just figuring out stuff here
|
||||||
(define (prompt-user prompt-message)
|
(define (prompt-user prompt-message)
|
||||||
(display-hash message prompt-message)
|
(display-hash message prompt-message)
|
||||||
(let ([user-input (read-line)])
|
(let ([user-input (read-line)])
|
||||||
(cond
|
(cond
|
||||||
[(member user-input (hash-ref y-n 'yes))
|
[(member user-input (hash-ref y-n 'yes))
|
||||||
(displayln "You chose yes")]
|
(displayln "You chose yes")
|
||||||
|
(open/create-file "~/.rodo")]
|
||||||
[(member user-input (hash-ref y-n 'no))
|
[(member user-input (hash-ref y-n 'no))
|
||||||
(displayln "You chose no")]
|
(displayln "You chose no")]
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue