[PL-sem-jr] Next week: Plotkin

Benjamin Greenman types at ccs.neu.edu
Wed Dec 2 18:07:01 EST 2015

Next week at PL Junior, we'll look at Plotkin's "Call By Name, Call By
Value, and the Lambda Calculus".


Until then, here's my KWIK system.

#lang racket

;; Usage: racket kwik.rkt FILE.txt

(module+ main
  (define (rotate* x*)
    (for/fold ([acc '()])
              ([_i (in-list x*)])
      (if (null? acc) (cons x* acc) (cons (append (cdar acc) (list (caar
acc))) acc))))
  (with-input-from-file (vector-ref (current-command-line-arguments) 0)
    (lambda ()
      (for ([ln (in-list (sort (apply append (for/list ([ln (in-lines)])
(rotate* (string-split ln " ")))) string<? #:key car))])
        (displayln (string-join ln " "))))))
-------------- next part --------------
HTML attachment scrubbed and removed

More information about the Pl-sem-jr mailing list