This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var values = new List<int> { 2, 3, 4, 5, 6, 10, 15, 45 }; |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (string-repeat n s) | |
(string-append* (make-list n s))) | |
(define (romanize-map n) | |
(let ([arabic->roman | |
(list (cons 1000 "M") (cons 900 "CM") | |
(cons 500 "D") (cons 400 "CD") |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (map-orelse pred val d) | |
(lambda (x) | |
(if (pred x) val d))) | |
(define (divisible-by? d) | |
(lambda (x) | |
(zero? (modulo x d)))) |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (prime-factors n) | |
(define (factors acc canidate x) | |
(if (equal? 1 x) | |
(reverse acc) | |
(if (zero? (modulo x canidate)) | |
(factors (cons canidate acc) canidate (quotient x canidate)) | |
(factors acc (add1 canidate) x)))) |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (change-for coins amount) | |
(for/list ([coin coins]) | |
(if (zero? amount) | |
0 | |
(let ([change (quotient amount coin)]) | |
(set! amount (remainder amount coin)) | |
change)))) |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (prime-factors n) | |
(define (factors result n value) | |
(cond | |
[(<= n 1) (reverse result)] | |
[(zero? (modulo n value)) (factors (cons value result) (/ n value) value)] | |
[else (factors result n (add1 value))])) | |
(factors '() n 2)) |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (guess upper lower) | |
(quotient (+ upper lower) 2)) | |
(define (smaller upper lower) | |
(guess | |
(max lower |
This file contains hidden or 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
#lang racket | |
(require rackunit rackunit/text-ui) | |
(define (fizz-buzz n) | |
(cond | |
[(zero? (modulo n 15)) "fizzbuzz"] | |
[(zero? (modulo n 3)) "fizz"] | |
[(zero? (modulo n 5)) "buzz"] | |
[else (number->string n)])) |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="FSharp.Core" | |
publicKeyToken="b03f5f7f11d50a3a" | |
culture="neutral"/> | |
<bindingRedirect oldVersion="4.3.1.0" | |
newVersion="4.4.0.0"/> |