Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
- The question must be Community-wiki. Please flag for moderator attention to make it so.
;;;; SHA-1 and SHA-2 implementations. | |
;;;; Uses R7RS bytevector and byte I/O interfaces. | |
;;;; Requires SRFIs 1, 26, 43, and 60. | |
;;; Auxiliary definitions to avoid having to use giant tables of constants. | |
(define primes80 '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 | |
79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 | |
163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 | |
241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 |
import java.util.Arrays; | |
/** | |
* Demonstration of bound method references. | |
*/ | |
public class MethodReferenceExample1 { | |
public static void main(String[] args) { | |
Arrays.stream(args, 1, args.length).filter(args[0]::contains) | |
.forEach(System.out::println); | |
} |
#lang racket | |
(define (get-candidates) | |
(define row (sub1 (read))) | |
(for/seteqv ((i (in-range 16)) | |
(item (in-producer read)) | |
#:when (= (quotient i 4) row)) | |
item)) | |
(define T (read)) | |
(for ((c (in-range T))) |
(define-syntax pollute-my-namespace | |
(let ((letters "abcdefghijklmnopqrstuvwxyz_") | |
(char->symbol (compose string->symbol string))) | |
(define (make-macros stx) | |
(lambda () | |
(for*/lists (ids syntaxes) | |
((x letters) | |
(y letters)) | |
(if (char=? x y) | |
(values (datum->syntax stx (char->symbol #\^ x)) |
(use-srfis '(1 69)) | |
(read-hash-extend #\# | |
(lambda (c port) | |
(define ht (make-hash-table eqv?)) | |
(define (ht-ref key) | |
(hash-table-ref ht key (lambda () | |
(define sym (gensym)) | |
(hash-table-set! ht key sym) | |
sym))) | |
(define (hash-key x) |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
#lang racket | |
(define (primes-less-than n) | |
(define size (sub1 (quotient n 2))) | |
(define table (build-vector size (lambda (i) (+ i i 3)))) | |
(for ((x (in-vector table 0 (integer-sqrt size))) | |
#:when x | |
(y (in-range (quotient (- (* x x) 3) 2) size x))) | |
(vector-set! table y #f)) | |
(cons 2 (filter values (vector->list table)))) |
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 | |
#include <functional> | |
#include <iostream> | |
#include <map> | |
#include <memory> | |
#include <boost/format.hpp> | |
#include <boost/iostreams/categories.hpp> | |
#include <boost/iostreams/copy.hpp> |
package nz.kiwi.chris.j7gs.types; | |
import com.google.common.base.Preconditions; | |
public class GSString implements Comparable<GSString> { | |
private final String value; | |
public GSString(String value) { | |
this.value = value; | |
} |
(define (modexp a b q) | |
(define (modmul a b) | |
(modulo (* a b) q)) | |
(do ((a a (modmul a a)) | |
(b b (quotient b 2)) | |
(r 1 (if (odd? b) (modmul r a) r))) | |
((zero? b) r))) |