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
namespace Resistor | |
type ResistorColors = | |
| Black | |
| Brown | |
| Red | |
| Orange | |
| Yellow | |
| Green | |
| Blue |
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> | |
/// A four-byte CRC (Cyclic Redundancy Code) | |
/// calculated on the preceding bytes in the chunk, | |
/// including the chunk type field and chunk data fields, | |
/// but not including the length field. | |
/// | |
/// The CRC can be used to check for corruption of the data. | |
/// The CRC is always present, even for chunks containing no data. | |
/// </summary> | |
module CRC32B = |
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
#r "nuget: ply" | |
open System | |
open FSharp.Control.Tasks | |
open System.Threading.Tasks | |
let bigEndianUInt32 (data : Span<byte>) = | |
let mutable total = 0u | |
if data.Length = 4 then | |
for i = 0 to 3 do | |
let value = data.[i] |
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
type Item = | |
{ Name : string | |
Quantity : uint } | |
type Items = Item list | |
type Bucket = | |
| Items of Items | |
| Empty | |
| InvalidItemName |
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
#r "nuget: Flips, 2.4.5" | |
open Flips | |
open Flips.Types | |
// مساله حمل و نقل | |
// مساله: 2 کارخانه با ظرفیت های تولید کالای معین به 3 انبار کالاهای | |
// خود را ارسال می کنند تا تقاضای انبارها تامین شود نه بیشتر نه کمتر | |
// با توجه به هزینه هایی که رفت آمد در پی دارد بیابید که | |
// هر کارخانه به چه مقدار و به کدام انبار اجناس خود را ارسال کند | |
// تا کمترین هزینه ی رفت و آمد را داشته باشیم |