News for hackers. Stuff that matters.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by eru on Tuesday March 17, 2015 @11:23PM (#9223419)
Racket is quite a lot more than call/cc and macros.

By the way, FOR loops invite off-by-one errors and worse. Use a combinator like map, or filter or foldr etc, to keep things boring.

Re:John Carmack: “I just dumped the C++ server I wrote for a... by minikomi on Tuesday March 17, 2015 @11:46PM (#9223481)
There are also the extremely "boring" & practical list comprehensions / iterators within racket itself:

http://docs.racket-lang.org/reference/for.html

eg. fizzbuzz using for, match:

    -> (for ([i (range 1 16)])
        (match (list (modulo i 3) (modulo i 5))
          [(list 0 0) (displayln "fizzbuzz")]
          [(list 0 _) (displayln "fizz")]
          [(list _ 0) (displayln "buzz")]
          [_          (displayln i)]))
    1
    2
    fizz
    4
    buzz
    fizz
    7
    8
    fizz
    buzz
    11
    fizz
    13
    14
    fizzbuzz
Re:John Carmack: “I just dumped the C++ server I wrote for a... by ktg on Wednesday March 18, 2015 @02:58AM (#9224010)
In for, in-range is faster.

http://docs.racket-lang.org/reference/sequences.html?q=in-ra...

An in-range application can provide better performance for number iteration when it appears directly in a for clause.

    -> (for ([i (in-range 1 16)])
        (match (list (modulo i 3) (modulo i 5))
          [(list 0 0) (displayln "fizzbuzz")]
          [(list 0 _) (displayln "fizz")]
          [(list _ 0) (displayln "buzz")]
          [_          (displayln i)]))
Re:John Carmack: “I just dumped the C++ server I wrote for a... by minikomi on Wednesday March 18, 2015 @06:25AM (#9224530)
Oh, thanks for that :)
Re:John Carmack: “I just dumped the C++ server I wrote for a... by Sanddancer on Tuesday March 17, 2015 @11:30PM (#9223441)
For loops in perl have two styles. The first is the c-style loop, the other is a map. One often uses the latter style a lot more often.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by pyre on Wednesday March 18, 2015 @03:40AM (#9224117)
That, and Perl has an actual `map` function too:

  map { $_ + 1 } (@list);
Re:John Carmack: “I just dumped the C++ server I wrote for a... by huehue on Wednesday March 18, 2015 @06:00AM (#9224456)
Sometimes Perl can be a beauty:

  sub sum_of_squared_pairs {
    reduce { $a + $b } map { $_ * $_ } grep { $_ % 2 == 0 } @_
  }

  sub schwartzian_transform {
    map  { $_->[0] }
    sort { $a->[1] <=> $b->[1] } # use numeric comparison
    map  { [$_, length $_] }     # calculate the length of the string
         @_
  }
Re:John Carmack: “I just dumped the C++ server I wrote for a... by eru on Wednesday March 18, 2015 @11:03PM (#9229999)
Yes, but _ has dynamic scope (I believe). That's very dangerous in general.