This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pair_multiply s1 s2 = | |
[ for x in s1 do | |
for y in s2 do | |
yield (x,y) ] | |
let enumerate (a:'a[]) = | |
Array.mapi (fun i x -> (i,x)) a | |
let pandigital (n:int) = | |
let a = string(n).ToCharArray() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Problem 31 - Coin sums | |
---------------------- | |
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: | |
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). | |
It is possible to make £2 in the following way: | |
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p | |
How many different ways can £2 be made using any number of coins? | |
*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 --validate run | |
sysbench 0.4.12: multi-threaded system evaluation benchmark | |
Running the test with following options: | |
Number of threads: 1 | |
Additional request validation enabled. | |
Doing CPU performance benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attempt 2 - use recursion, threading the index and current triangle number to each call | |
// less memory intensive, shouldn't be too terrible on stack (tail recursion) | |
// but the "countFactors" function sticks out as a little nasty | |
// | |
// run in f# jupyter notebook, or using mono (fsharpc prob12.fs && mono prob12.exe) | |
let minFactors = 5 | |
// let minFactors = 500 | |
let isFactor x y = (x % y = 0UL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1999 | |
amused | |
charmed | |
cheery | |
diverted | |
employed | |
engaged | |
engrossed | |
entertained | |
tickled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
ipy.py | |
This is a fairly nastily hacked together piece of code to produce a visualisation of the execution | |
of a simple python application IronPython. It uses PIL to produce a series of PNG files in a | |
directory ./out which each have a listing of instructions, stack, globals and output for the | |
ipy vm. | |
""" |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InitParameter() | |
InitParameter() | |
InitParameter() | |
InitParameter() | |
LoadLocal() | |
LoadCached(0) | |
TypeEquals()() | |
LoadCached(1) | |
Call(Boolean InterpretedCallSiteTest(Boolean, System.Object)) | |
BranchFalse(16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 10 | |
y = 20 | |
z = x + y | |
print z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets a singleton boxed value for the given integer if possible, otherwise boxes the integer. | |
/// </summary> | |
/// <param name="value">The value to box.</param> | |
/// <returns>The boxed value.</returns> | |
public static object Int32ToObject(Int32 value) { | |
// caches improves pystone by ~5-10% on MS .Net 1.1, this is a very integer intense app | |
// TODO: investigate if this still helps perf. There's evidence that it's harmful on | |
// .NET 3.5 and 4.0 | |