Created
January 22, 2017 23:02
-
-
Save wdkrnls/93f8f462dc03b8618ddf8b2885512f0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env racket | |
#lang racket/base | |
(require racket/vector) | |
;; Capture the command line args sent to this script | |
(define args | |
(current-command-line-arguments)) | |
;; Non-trivial function to apply to vector goes here | |
(define (f x) (sqrt x)) | |
;; Convert commandline arguments into numeric format | |
(define xs | |
(vector-map string->number args)) | |
;; Map the function across the vector | |
(define ys | |
(vector-map f xs)) | |
;; Print the results | |
(for ([y (in-vector ys)]) (displayln y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment