Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,11 +1,11 @@
import std.stdio, std.algorithm, std.range, std.ascii;
import std.stdio, std.algorithm, std.range, std.ascii, std.string;
auto longMult(in string x1, in string x2) pure /*nothrow*/ {
auto digits1 = x1.retro.map!q{a - '0'};
immutable digits2 = x2.retro.map!q{a - '0'}.array;
auto longMult(in string x1, in string x2) pure nothrow @safe {
auto digits1 = x1.representation.retro.map!q{a - '0'};
immutable digits2 = x2.representation.retro.map!q{a - '0'}.array;
uint[] res;
foreach (immutable i, immutable d1; uint.max.iota.zip(digits1)) {
foreach (immutable i, immutable d1; digits1.enumerate) {
foreach (immutable j, immutable d2; digits2) {
immutable k = i + j;
if (res.length <= k)

View file

@ -1,2 +1,5 @@
: (* (** 2 64) (** 2 64))
-> 340282366920938463463374607431768211456
(de multi (A B)
(setq A (format A) B (reverse (chop B)))
(let Result 0
(for (I . X) B
(setq Result (+ Result (* (format X) A (** 10 (dec I)))))) ) )

View file

@ -1 +1,8 @@
(* (expt 2 64) (expt 2 64))
(define one (lambda (f) (lambda (x) (f x))))
(define (add a b) (lambda (f) (lambda (x) ((a f) ((b f) x)))))
(define (mult a b) (lambda (f) (lambda (x) ((a (b f)) x))))
(define (expo a b) (lambda (f) (lambda (x) (((b a) f) x))))
(define two (add one one))
(define six (add two (add two two)))
(define sixty-four (expo two six))
(display (mult (expo two sixty-four) (expo two sixty-four)))