Skip to content

Instantly share code, notes, and snippets.

@wdkrnls
Created January 22, 2017 23:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/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