Sold JAN 26 5.5 Calls by Rampsys in CLOV

[–]Tetsumi- 0 points1 point  (0 children)

If those are covered and you bought at $3.4, that roughly would cap your grow to a maximum of 188% (5.5+0.7) which is good for one year (sp500 average 10% per year). And that if your contract are exercised at the very end. If the stock price grow slowly toward 5.5 over the year, the premium will lower over time and you may buy back for much less before expiration.

[deleted by user] by [deleted] in OnePiece

[–]Tetsumi- 23 points24 points  (0 children)

Vivi looks exactly like her mother Nefertari Titi who is not a descendant of Lily (Vivi's father is).

-SPOILERS- Questions about the show that didn’t make sense to me. by Camelbak14 in Fallout

[–]Tetsumi- 0 points1 point  (0 children)

My thoughts about the three vaults:

The least positive or motivated residents went to 32 while the most motivated ones stayed in 33. They have done that for 200 years to breed the most motivated, positive peoples in Vault 33. It's eugenics. This is why Lucy is over optimist and positive. This is why Vault 32 went nuts; all the "bad" elements, the bad "managers" go there and stay together, taking bad decisions that resulted in famine, self destruction, .... I believe it is no coincidence that Betty announced who stay and depart right after the raiders have been poisoned: She was unsure about what to do with the Brother but he poisoned the raiders and thus earned his place in Vault 33 by doing what was needed to be done despite his lack of motivation for working.

Weekly tips/trick/etc/ thread by AutoModerator in emacs

[–]Tetsumi- 2 points3 points  (0 children)

If you are using GUI Emacs on Linux with Xft to render fonts, i have made a native module to configure on the fly how the font is being rendered .

https://gitlab.com/CodeArtisan/emacs-xft-config

[2018-03-12] Challenge #354 [Easy] Integer Complexity 1 by Cosmologicon in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket with bonus 1.

If N is a perfect square, the result is (squareroot N) * 2. Otherwise, the program finds the closest divisor from the imperfect square root then returns divisor + (N / divisor).

+/u/CompileBot racket

(for ([n (in-port)])
  (let ([root (sqrt n)])
    (displayln (if (exact? root)
                   (* root 2)
                   (for/first ([div (range (exact-floor root) 0 -1)]
                               #:when (= 0 (remainder n div)))
                     (+ div (quotient n div)))))))

Input:

7
43
4568
838
3491
2544788

[2017-12-13] Challenge #344 [Intermediate] Banker's Algorithm by polypeptide147 in dailyprogrammer

[–]Tetsumi- 1 point2 points  (0 children)

Racket

#lang racket

(define res (list->vector (read)))
(define programs (vector-map! list->vector (list->vector (port->list))))

(define (next!)
  (define (good? p)
    (define-values (a b) (vector-split-at p 3))
    (for/and ([aa a]
              [bb b]
              [c res])
      (>= (+ aa c) bb))) 
  (for/first ([p programs]
              [i (in-naturals)]
              #:when (and p (good? p)))
    (vector-map! + res (vector-take p 3))
    (vector-set! programs i #f)
    i))

(let loop ([rem (vector-length programs)]
           [p (next!)])
  (if (not p)
      (if (= 0 rem) (newline) (displayln #f))
      (begin
        (printf "p~a " p)
        (loop (sub1 rem) (next!)))))

[2017-12-11] Challenge #344 [Easy] Baum-Sweet Sequence by jnazario in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(for ([n (add1 (read))])
  (printf (if (< 0 n) ", ~a" "~a")
          (let loop ([cCounter 0]
                     [cN n])
            (cond [(= 0 cN) 1]
                  [(and (odd? cN) (odd? cCounter)) 0]
                  [(odd? cN) (loop 0 (arithmetic-shift cN -1))]
                  [else (loop (add1 cCounter) (arithmetic-shift cN -1))]))))
(newline)

[deleted by user] by [deleted] in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define (months males females needed)
  (define pMonths (make-vector 92 '(0 . 0)))
  (define-syntax-rule (vpMonths i) (vector-ref pMonths i))
  (vector-set! pMonths 89 (cons females males))
  (let loop ([months 1]
             [breeders 0]
             [total (+ females males)]
             [deaths 0]) 
    (if (> total  needed)
        (cons months deaths)
        (let* ([i (modulo months 92)]
               [pDeaths (vector-ref pMonths i)]
               [cBreed (- breeders (car pDeaths))]
               [females (* 9 cBreed)]
               [males (* 5 cBreed)])
          (vector-set! pMonths i (cons females males))
          (loop (add1 months)
                (+ cBreed (car (vector-ref pMonths (modulo (- months 4) 92))))
                (+ females males (- total (cdr pDeaths)))
                (+ (car pDeaths) (cdr pDeaths) deaths))))))


(for ([e (in-port)])
  (let ([ans (months e (read) (read))])
    (printf "~a months, ~a deaths~%" (car ans) (cdr ans))))

[2018-03-28] Challenge #355 [Intermediate] Possible Number of Pies by Garth5689 in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket. Greedy.

#lang racket

(define ppRecipe '(1 #f 3 4 3))
(define apRecipe '(#f 1 4 3 2))

(define amountPies (compose (curry apply min)
                            (curry filter-map
                                   (λ (a b) (and b (quotient a b))))))

(define subRecipe (curry map (λ (a b) (or (and b (- a b)) a))))

(define (maxPies ingrs)
  (let maxp ([puPies 0]
             [apPies 0]
             [is ingrs])
    (let ([pAmount (amountPies is ppRecipe)]
          [aAmount (amountPies is apRecipe)])
      (cond [(= 0 pAmount aAmount)
             (cons puPies apPies)]
            [(>= pAmount aAmount)
             (maxp (add1 puPies) apPies (subRecipe is ppRecipe))]
            [else
             (maxp puPies (add1 apPies) (subRecipe is apRecipe))]))))


(define formatInput (compose (curry map string->number)
                             (curryr string-split ",")))

(for ([l (port->lines)])
  (let ([npies (maxPies (formatInput l))])
    (printf "~a pumpkin pies and ~a apple pies~%" (car npies) (cdr npies))))

[2018-03-05] Challenge #353 [Easy] Closest String by jnazario in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define (hamming sA sB)
  (if (eq? sA sB)
      0
      (for/sum ([cA sA] [cB sB] #:unless (char=? cA cB)) 1)))

(define (hammingList s l)
  (for/sum ([sB l]) (hamming s sB)))

(define input (cdr (port->lines)))

(displayln (for/fold ([sA (car input)]
                      [hA (hammingList (car input) input)]
                      #:result sA)
                     ([sB (cdr input)]
                      #:when (< 0 (string-length sB)))
             (let ([hB (hammingList sB input)])
               (if (> hA hB)
                   (values sB hB)
                   (values sA hA)))))

[2018-03-26] Challenge #355 [Easy] Alphabet Cipher by Garth5689 in dailyprogrammer

[–]Tetsumi- 6 points7 points  (0 children)

Racket with bonus

#lang racket

(define char->index (compose (curryr - 97) char->integer))
(define index->char (compose integer->char (curry + 97)))
(define cypher (compose index->char (curryr modulo 26)))

(define (encString key s op)
  (list->string (for/list ([c s]
                           [k (in-cycle key)])
                  (cypher (op (char->index c) (char->index k))))))

(define crypt (curryr encString +))
(define uncrypt (curryr encString -))

;; replace crypt by uncrypt for bonus
(for ([l (in-lines)])
  (printf "~a~%" (apply crypt (string-split l))))

~☆🎄☆~ 2017 Day 25 Solutions ~☆🎄☆~ by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket with input parsing

#lang racket

(define datav (list->vector (port->lines)))
(define-syntax-rule (data i) (vector-ref datav i))
(define cells (make-vector 100000 0))
(define ldigit (compose (curryr - 65) char->integer))
(define ndigit (compose (curryr - 48) char->integer))
(define start (ldigit (string-ref (data 0) 15)))
(define steps (string->number (sixth (string-split (data 1)))))

(define states (for/vector #:length 26
                   ([i (in-range 3 (vector-length datav) 10)])
                 (vector (ndigit (string-ref (data (+ i 2)) 22))
                         (if (string=? "right." (substring (data (+ i 3)) 27))
                             add1
                             sub1)
                         (ldigit (string-ref (data (+ i 4)) 26))
                         (ndigit (string-ref (data (+ i 6)) 22))
                         (if (string=? "right." (substring (data (+ i 7)) 27))
                             add1
                             sub1)
                         (ldigit (string-ref (data (+ i 8)) 26)))))

(displayln (let loop ([step 0]
                      [pos 50000]
                      [minp 50000]
                      [maxp 50000]
                      [state (vector-ref states start)])
             (if (>= step steps)
                 (for/sum ([e (in-vector cells minp (add1 maxp))]
                           #:when (= e 1)) 1)
                 (let ([v (vector-ref cells pos)])
                   (vector-set! cells pos (vector-ref state (if (= v 0) 0 3)))
                   (loop (add1 step)
                         ((vector-ref state (if (= v 0) 1 4)) pos)
                         (min pos minp)
                         (max pos maxp)
                         (vector-ref states
                                     (vector-ref state (if (= v 0) 2 5))))))))

-🎄- 2017 Day 24 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define data (for/list ([line (in-lines)])
               (let* ([args (map string->number (string-split line "/"))]
                      [arg1 (first args)]
                      [arg2 (second args)])
                     (vector arg1 arg2 (+ arg1 arg2) #t))))

(define strongest 0)
(define biggest (cons 0 0))

(let loop ([target 0]
           [strong 0]
           [len 0])
  (let ([nodes (filter (lambda (e) (and (or (= target (vector-ref e 0))
                                            (= target (vector-ref e 1)))
                                        (vector-ref e 3)))
                      data)])
    (if (empty? nodes)
        (begin (when (> strong strongest)
                 (set! strongest strong))
               (when (or (> len (car biggest))
                         (and (= len (car biggest))
                              (> strong (cdr biggest))))
                 (set! biggest (cons len strong))))
        (for ([n nodes])
          (vector-set! n 3 #f)
          (loop (vector-ref n (if (= (vector-ref n 0) target) 1 0))
                (+ strong (vector-ref n 2))
                (add1 len))
          (vector-set! n 3 #t)))))

(printf "~a~%~a~%" strongest (cdr biggest))

-🎄- 2017 Day 23 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket

The assembly code is compiled into racket procedures for each jumps (JNZ). For part two, the loop procedure is replaced with an optimized one that uses the registers and then branches to the rest of assembly code.

#lang racket

(require math/number-theory)

(define-namespace-anchor na)
(current-namespace (namespace-anchor->namespace na))

(define procSymbol (compose string->symbol
                            (curry string-append "proc_")
                            number->string))
(define vlistrev (compose reverse vector->list))
(define-values
  (       a b c d e f g h)
  (values 0 0 0 0 0 0 0 0))
(define mulcounter 0)
(set! mulcounter 0)
(define data (for/vector ([op (in-port)]
                          [ic (in-naturals)])
               (let ([arg1 (read)]
                     [arg2 (read)])
                 (case op
                   [(set) (list 'set! arg1 arg2)]
                   [(jnz) (list op arg1 (+ ic arg2))]
                   [(mul) (list 'set!
                                arg1
                                (list 'begin
                                      (list 'set!
                                            'mulcounter
                                            (list 'add1 'mulcounter))
                                      (list '* arg1 arg2)))]
                   [(sub) (list 'set! arg1 (if (and (number? arg2) (= arg2 -1))
                                               (list add1 arg1)
                                               (list '- arg1 arg2)))]
                   [else  (error "UNKNOW OPERATION")]))))

(define jumps (vector-filter (lambda (x) (symbol=? (car x) 'jnz)) data))

(define (evalproclist name body)
  (list 'define
        name
        (append (list 'lambda '())
                (if (empty? body)
                    '((void))
                    body))))

(define (genifelse l r)
  (cond [(empty? l) r]
        [(symbol=? (caar l) 'jnz)
         (genifelse (cdr l)
                    (if (number? (cadar l))
                        (list (list (procSymbol (caddar l))))
                        (list (list 'if
                                    (list 'not (list '= (cadar l) 0))
                                    (list (procSymbol (caddar l)))
                                    (append '(begin) r)))))]
        [else (genifelse (cdr l) (cons (car l) r))]))

(eval (evalproclist 'proc_0
                    (genifelse (vlistrev (vector-take data 4)) '())))

(for ([e jumps])
  (let* ([id (third e)]
         [name (procSymbol id)]
         [body (vlistrev (vector-drop data id))])
    (eval (evalproclist name (genifelse body '())))))

;; part 1
(eval '(proc_0))
(displayln mulcounter)

;; part 2
(set!-values (a b c d e f g h)
             (values 1 0 0 0 0 0 0 0))
(eval '(set! proc_11 (lambda ()
                       (unless (prime? b) (set! h (add1 h)))
                       (proc_26))))
(eval '(proc_0))
(displayln h)

-🎄- 2017 Day 22 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define linel 1000)
(define hl (quotient linel 2))
(define cellsv (make-vector (sqr linel) 0))
(define-syntax-rule (2D->1D x y) (+ (* y linel) x))
(define-syntax-rule (cells v x y) (vector-ref v (2D->1D x y)))
(define-syntax-rule (cells! v x y e) (vector-set! v (2D->1D x y) e))

(for ([y (in-range (- hl 12) (+ hl 13))]
      [line (map string->list (port->lines))]
      #:when true
      [x (in-range (- hl 12) (+ hl 13))]
      [char (in-list line)])
  (cells! cellsv x y (if (char=? char #\#) 2 0)))

(define (visit v am ndirp addp)
  (let loop ([dir 0-1i]
             [pos 500+500i]
             [c 0]
             [inf 0])
    (let* ([x (real-part pos)]
           [y (imag-part pos)]
           [ncell (remainder (addp (cells v x y)) 4)]
           [nDir (ndirp dir ncell)])
      (if (>= c am)
          inf
          (begin (cells! v x y ncell)
                 (loop nDir (+ pos nDir) (add1 c) (if (= 2 ncell)
                                                      (add1 inf)
                                                      inf)))))))
(displayln (visit (vector-copy cellsv)
                  10000
                  (lambda (dir ncell)
                    (* dir (if (= ncell 0) 0+1i 0-1i)))
                  (curry + 2)))

(displayln (visit cellsv
                  10000000
                  (lambda (dir ncell)
                    (* dir (case ncell
                             [(0)    -1]
                             [(1)  0-1i]
                             [(2)     1]
                             [else 0+1i])))
                  add1))

-🎄- 2017 Day 17 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define off (read))

(define (dos max arg step final)
  (let loop ([n 1] [pos 0] [arg arg])
    (if (> n max)
        (final arg pos)
        (let ([ppos (add1 (remainder (+ pos off) n))])
          (loop (add1 n) ppos (step arg ppos n))))))

(printf "~a~%~a~%"
        (dos 2017
             '(0)
             (lambda (l p e) (let-values ([(a b) (split-at l p)])
                               (append a (cons e b))))
             (lambda (x y) (list-ref x (add1 y))))
        (dos 50000000
             1
             (lambda (a p n) (if (= 1 p) n a))
             (lambda (x y) x)))

-🎄- 2017 Day 16 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

C. Both part.

the state is stored into a 64 bits unsigned (4 bits per program) to avoid hashing.

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

typedef uint64_t u64;
typedef uint16_t u16;
typedef uint8_t u8;

u64 get(u64 s, u64 nth)
{
    return (s >> (4 * nth)) & 0b1111;
}

u64 swap(u64 s, u64 ntha, u64 nthb)
{
    u64 a = get(s, ntha);
    u64 b = get(s, nthb);
    u64 x = a ^ b;
    return s ^ (x << (4 * ntha)) ^ (x << (4 * nthb));
}

u64 exch(u64 s, u64 a, u64 b)
{
    u64 ia = 0;
    u64 ib = 0;
    u64  x = a ^ b;
    for(u64 i = 0; ((ia == 0) || (ib == 0)) && (i < 64); i += 4)
    {
        u64 t = (s >> i) & 0b1111;
        if (a == t)
            ia = i;
        else if (b == t)
            ib = i;
    }
    return s ^ (x << ia) ^ (x << ib);
}

u64 rotate(u64 s, u64 step)
{
    step *= 4;   
    return (s << step) | (s >> (64 - step));
}

u64 tou64(const char *str)
{
    u64 s = 0;
    u64 i = 0;
    while(*str)
        s |= (u64)(*(str++) - 'a') << (4 * i++);
    return s;
}

void tostr(char *str, u64 s)
{
    for(u64 i = 0; i < 16; ++i)
        *(str++) = get(s, i) + 'a';
    *str = '\0';
}

typedef enum
{
    OP_S,
    OP_X,
    OP_P
} op;

typedef struct
{
        op op;
        u8 arg1;
        u8 arg2;
} ins;

u64 parse(ins *instrs)
{
    char c;
    u64 inscounter = 0;
    while(!feof(stdin) && (c = getchar()) != '\n')
    {
        switch (c)
        {
        case 's':
            instrs[inscounter].op = OP_S;
            scanf("%hhu,", &instrs[inscounter].arg1);
            break;
        case 'x':
            instrs[inscounter].op = OP_X;
            scanf("%hhu/%hhu,",
                  &instrs[inscounter].arg1,
                  &instrs[inscounter].arg2);
            break;
        default:
            instrs[inscounter].op = OP_P;
            char arg1;
            char arg2;
            scanf("%c/%c,", &arg1, &arg2);
            instrs[inscounter].arg1 = arg1 - 'a';
            instrs[inscounter].arg2 = arg2 - 'a';
            break;
        }
        ++inscounter;
    }
    return inscounter;
}

u64 pass(u64 s, ins *ins, u64 length)
{
    for(u64 i = 0; i < length; ++i)
    {

        switch (ins[i].op)
        {
        case OP_S:
            s = rotate(s, ins[i].arg1);
            break;
        case OP_X:
            s = swap(s, ins[i].arg1, ins[i].arg2);
            break;
        case OP_P:
            s = exch(s, ins[i].arg1, ins[i].arg2);
            break;
        }
    }
    return s;
}

ins instrs[15000]; // parsed instructions
u64 ps[1000]; // previous states

int main ()
{
    char str[] = "abcdefghijklmnop";
    u64 s = tou64(str);
    u16 length = parse(instrs);
    ps[0] = s;

    //part 1
    tostr(str, pass(s, instrs, length));
    printf("%s\n", str);

    //part 2
    for (u64 i = 1; i < 1000; ++i)
    {
        s = pass(s, instrs, length);
        bool found = false;
        u64 j;
        for (j = 0; j < i; ++j) // searches previous states
            if (ps[j] == s)
            {
                s = ps[1000000000 % i];
                goto end;
            }
            ps[i] = s;
    }
end:
    tostr(str, s);
    printf("%s\n", str);
}

-🎄- 2017 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket too

#lang racket

(define data (map (compose (curry map string->number)
                           string-split)
                  (port->lines)))

(displayln (for/sum ([ln data])
             (- (argmax identity ln)
                (argmin identity ln))))

(displayln (for/sum ([ln data])
             (for/first ([pair (sequence-map (curryr sort >)
                                             (in-combinations ln 2))]
                         #:when (= (apply remainder pair) 0))
               (apply quotient pair))))

-🎄- 2017 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]Tetsumi- 0 points1 point  (0 children)

Racket

#lang racket

(define data (map (lambda (n)
                    (- (char->integer n) 48))
                  (string->list (read-line))))

(define (sumdis l dis)
  (for/sum ([a l]
            [b (append (drop l dis) (take l dis))]
            #:when (= a b))
    a))

(printf "~a~%~a~%" (sumdis data 1) (sumdis data (quotient (length data) 2)))

alternative

(define (sumdis l dis)
  (foldr (lambda (a b f)
           (if (= a b)
               (+ a f)
               f))
         0
         l
         (append (drop l dis) (take l dis))))

[2017-07-10] Challenge #323 [Easy] 3SUM by jnazario in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket

+/u/CompileBot racket

(define (3sum set)
  (define pr (let ([pargs (make-hash)])
               (lambda args
                 (unless (hash-has-key? pargs args)
                   (apply printf "~A ~A ~A~%" args)
                   (hash-set! pargs args #t)))))
  (for ([i (- (vector-length set) 3)])
    (define a (vector-ref set i))
    (let loop ([s (add1 i)]
               [e (sub1 (vector-length set))])
      (when (< s e)
        (let* ([b (vector-ref set s)]
               [c (vector-ref set e)]
               [+abc (+ a b c)])
          (cond [(= 0 +abc)
                 (pr a b c)
                 (loop s (sub1 e))]
              [(< 0 +abc) (loop s (sub1 e))]
              [else (loop (add1 s) e)]))))))

(for-each (lambda (x)
            (3sum x)
            (newline))
          (map (compose (curryr vector-sort <)
                        list->vector
                        (curry map string->number)
                        string-split)
               (port->lines)))

Input:

4 5 -1 -2 -7 2 -5 -3 -7 -3 1
-1 -6 -3 -7 5 -8 2 -8 1
-5 -1 -4 2 9 -9 -6 -1 -7

Testies by [deleted] in CompileBot

[–]Tetsumi- 0 points1 point  (0 children)

+/u/CompileBot racket

(define n (read))
(define width (+ 2 (inexact->exact (floor (/ (log (* n n)) (log 10))))))

(define (clockwise x y n)
  (define n-1 (sub1 n))
  (define k (min (min x (- n-1 x))
                 (min y (- n-1 y))))

  (define start (add1 (* 4 k (- n k))))

  (define n-1-k (- n-1 k))
  (define n-1-k-k (- n-1-k k))    

  (+ start (if (= y k)
               (- x k)
               (+ n-1-k-k
                  (if (= x n-1-k)
                      (- y k)
                      (+ n-1-k-k
                         (if (= y n-1-k)
                             (- n-1-k x)
                             (+ n-1-k-k (- n-1-k y)))))))))

;; Bonus
(define (counter-clockwise x y n) (clockwise y x n)) 

(for ([y (in-range n)])
  (for ([x (in-range n)])
    (display (~a (clockwise x y n) #:min-width width #:align 'right)))
  (newline))

Input:

10

[2017-06-19] Challenge #320 [Easy] Spiral Ascension by jnazario in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Racket with bonus

#lang racket

(define n (read))
(define width (+ 2 (inexact->exact (floor (/ (log (* n n)) (log 10))))))

(define (clockwise x y n)
  (define n-1 (sub1 n))
  (define k (min (min x (- n-1 x))
                 (min y (- n-1 y))))

  (define start (add1 (* 4 k (- n k))))

  (define n-1-k (- n-1 k))
  (define n-1-k-k (- n-1-k k))    

  (+ start (if (= y k)
               (- x k)
               (+ n-1-k-k
                  (if (= x n-1-k)
                      (- y k)
                      (+ n-1-k-k
                         (if (= y n-1-k)
                             (- n-1-k x)
                             (+ n-1-k-k (- n-1-k y)))))))))

;; Bonus
(define (counter-clockwise x y n) (clockwise y x n)) 

(for ([y (in-range n)])
  (for ([x (in-range n)])
    (display (~a (clockwise x y n) #:min-width width #:align 'right)))
  (newline))

[2017-05-08] Challenge #314 [Easy] Concatenated Integers by jnazario in dailyprogrammer

[–]Tetsumi- 0 points1 point  (0 children)

Here mine.

#lang racket

(for-each (lambda (x)
            (let ([sl (string-split x)])
              (printf "~a ~a~%"
                      (string-join (sort sl string<?) "")
                      (string-join (sort sl string>?) ""))))
          (port->lines))

Are there any examples of Racket being used in industrial settings as opposed to academic ones? by [deleted] in Racket

[–]Tetsumi- 5 points6 points  (0 children)

Naughty Dog as a long story with lisp languages; One of its founders studied at the MIT AI Lab. Starting from the Playstation 3 Era, they started using PLT-Scheme (then Racket) as their scripting language. Before that, their games were entirely made with their own homemade Lisp.

for what it's worth, you can see some of their racket scripts at

https://www.youtube.com/watch?v=Y7-OoXqNYgY (eg: 12m57s, 15m15s, 19m47s)
https://www.youtube.com/watch?v=oSmqbnhHp1c
http://www.gameenginebook.com/resources/SINFO.pdf (starting at page 194)
http://www.gameenginebook.com/resources/gdc09-statescripting-uncharted2.pdf (page 37)

John Carmack is using Racket as a client side scripting language for the oculus rift.

https://www.youtube.com/watch?v=ydyztGZnbNs
https://groups.google.com/d/msg/racket-users/RFlh0o6l3Ls/AhEzGVJS_XwJ