From f9c0a0baefb29e02faa7528e31ea2d54d5d349ff Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Wed, 4 Jul 2018 23:00:30 +0300 Subject: [PATCH 01/13] added .gitignore --- C#/.gitignore | 329 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 C#/.gitignore diff --git a/C#/.gitignore b/C#/.gitignore new file mode 100644 index 0000000..83243f3 --- /dev/null +++ b/C#/.gitignore @@ -0,0 +1,329 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ \ No newline at end of file From 627e9033fabc6185e27e078fcf8e11677549da19 Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Wed, 4 Jul 2018 23:00:39 +0300 Subject: [PATCH 02/13] Added project files --- C#/C#.csproj | 9 +++++++++ C#/DoubleLinked.cs | 9 +++++++++ C#/Program.cs | 12 ++++++++++++ C#/SingleLinked.cs | 9 +++++++++ 4 files changed, 39 insertions(+) create mode 100644 C#/C#.csproj create mode 100644 C#/DoubleLinked.cs create mode 100644 C#/Program.cs create mode 100644 C#/SingleLinked.cs diff --git a/C#/C#.csproj b/C#/C#.csproj new file mode 100644 index 0000000..4557e23 --- /dev/null +++ b/C#/C#.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + C_ + + + diff --git a/C#/DoubleLinked.cs b/C#/DoubleLinked.cs new file mode 100644 index 0000000..d1306d8 --- /dev/null +++ b/C#/DoubleLinked.cs @@ -0,0 +1,9 @@ +using System; + +namespace HowProgrammingWorks +{ + class DoubleLinked + { + + } +} diff --git a/C#/Program.cs b/C#/Program.cs new file mode 100644 index 0000000..4ff673c --- /dev/null +++ b/C#/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace HowProgrammingWorks +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/C#/SingleLinked.cs b/C#/SingleLinked.cs new file mode 100644 index 0000000..b10af2a --- /dev/null +++ b/C#/SingleLinked.cs @@ -0,0 +1,9 @@ +using System; + +namespace HowProgrammingWorks +{ + class SingleLinked + { + + } +} From 4e2de9ab1e8e7aef421f9bcda67b3bff98c8988d Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Wed, 4 Jul 2018 23:33:43 +0300 Subject: [PATCH 03/13] port examples from js to c# --- C#/DoubleLinked.cs | 86 ++++++++++++++++++++++++++++++++++++++++++++-- C#/Program.cs | 9 ++++- C#/SingleLinked.cs | 47 +++++++++++++++++++++++-- 3 files changed, 136 insertions(+), 6 deletions(-) diff --git a/C#/DoubleLinked.cs b/C#/DoubleLinked.cs index d1306d8..0e53929 100644 --- a/C#/DoubleLinked.cs +++ b/C#/DoubleLinked.cs @@ -1,9 +1,91 @@ using System; -namespace HowProgrammingWorks +namespace HowProgrammingWorks.DoubleLinkedList { - class DoubleLinked + class DoubleLinkedList { + public int Length { get; private set; } + + public Node First { get; private set; } + + public Node Last { get; private set; } + + public Node Push(T data) + { + var node = new Node(this, data); + node.Previous = this.Last; + + if (this.Length == 0) this.First = node; + else this.Last.Next = node; + + this.Last = node; + this.Length++; + + return node; + } + + public T Pop() + { + if (this.Length == 0) + return default(T); + + var node = this.Last; + + this.Last = node.Previous; + + node.List = null; + node.Previous = null; + node.Next = null; + + this.Length--; + + return node.Data; + } + + } + + class Node + { + public DoubleLinkedList List { get; set; } + public Node Previous { get; set; } + public Node Next { get; set; } + public T Data { get; set; } + + public Node(DoubleLinkedList list, T data) + : this(list, null, null, data) + { + } + + protected Node(DoubleLinkedList list, Node previous, Node next, T data) + { + List = List; + Data = data; + Next = next; + Previous = previous; + } + } + + public class Example + { + public void Run() + { + var list = new DoubleLinkedList(); + + list.Push("road"); + list.Push("the"); + list.Push("across"); + list.Push("running"); + list.Push("was"); + list.Push("cat"); + list.Push("Black"); + + while (list.Length > 0) + { + Console.Write($"{list.Pop()} "); + } + + Console.ReadKey(); + } } } diff --git a/C#/Program.cs b/C#/Program.cs index 4ff673c..23cb8af 100644 --- a/C#/Program.cs +++ b/C#/Program.cs @@ -6,7 +6,14 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + Console.Clear(); + + var singleLinkedListExample = new HowProgrammingWorks.SingleLinkedList.Example(); + var doubleLinkedListExample = new HowProgrammingWorks.DoubleLinkedList.Example(); + + //singleLinkedListExample.Run(); + + doubleLinkedListExample.Run(); } } } diff --git a/C#/SingleLinked.cs b/C#/SingleLinked.cs index b10af2a..c7009c8 100644 --- a/C#/SingleLinked.cs +++ b/C#/SingleLinked.cs @@ -1,9 +1,50 @@ using System; -namespace HowProgrammingWorks +namespace HowProgrammingWorks.SingleLinkedList { - class SingleLinked + class Node { - + public Node(T data) + : this(null, data) + { + } + + public Node(Node previous, T data) + { + Previous = previous; + Data = data; + } + + public Node() + : this(null, default(T)) + { + } + + public Node Previous { get; set; } + public T Data { get; set; } + } + + class Example + { + public void Run() + { + var n0 = new Node("road"); + var n1 = new Node(n0, "the"); + var n2 = new Node(n1, "across"); + var n3 = new Node(n2, "running"); + var n4 = new Node(n3, "was"); + var n5 = new Node(n4, "cat"); + var n6 = new Node(n5, "Black"); + + var currentNode = n6; + + while (currentNode != null) + { + Console.Write($"{currentNode.Data} "); + currentNode = currentNode.Previous; + } + + Console.ReadKey(); + } } } From 13022c2ae008249ed245ad5add0378f20d656c1a Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Thu, 5 Jul 2018 02:17:30 +0300 Subject: [PATCH 04/13] prepare F# example --- F#/.gitignore | 329 +++++++++++++++++++++++++++++++++++++++++++++ F#/DoubleLinked.fs | 83 ++++++++++++ F#/F#.fsproj | 15 +++ F#/F#.sln | 16 +++ F#/Program.fs | 25 ++++ F#/SingleLinked.fs | 37 +++++ 6 files changed, 505 insertions(+) create mode 100644 F#/.gitignore create mode 100644 F#/DoubleLinked.fs create mode 100644 F#/F#.fsproj create mode 100644 F#/F#.sln create mode 100644 F#/Program.fs create mode 100644 F#/SingleLinked.fs diff --git a/F#/.gitignore b/F#/.gitignore new file mode 100644 index 0000000..83243f3 --- /dev/null +++ b/F#/.gitignore @@ -0,0 +1,329 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ \ No newline at end of file diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs new file mode 100644 index 0000000..1ac266d --- /dev/null +++ b/F#/DoubleLinked.fs @@ -0,0 +1,83 @@ +module HowProgrammingWorks.DoubleLinked + +open System +open HowProgrammingWorks.SingleLinked +open System.Collections.Generic +open System.Threading.Tasks.Dataflow + +type Node<'T> = { + mutable prev : Node<'T> option; + mutable next : Node<'T> option; + mutable data : 'T; +} + +type LinkedList<'T> = { + mutable first : Node<'T> option; + mutable last : Node<'T> option; + mutable count: int; +} + +let push (list : LinkedList<'T>, data) = + match list.count with + | 0 -> + let node = {prev = None; next = None; data = data; } + list.first <- Some node; + list.last <- Some node; + list.count <- list.count + 1; + node + | _ -> + let node = {prev = list.last; next = None; data = data; } + list.last <- Some node; + list.count <- list.count + 1; + node + + +let pull (list : LinkedList<'T>) = + match list.count with + | 0 -> + None; + | 1 -> + let node = list.last.Value; + list.last <- None; + list.first <- None; + list.count <- 0; + node.data; + |_-> + let node = list.last.Value; + list.last <- node.prev; + list.count <- list.count - 1; + node.data; + + +let Example = + + let rec write (list : LinkedList<'T>) = + match list.count with + | 0 -> + Console.WriteLine() + | _ -> + let value = pull list; + Console.WriteLine(String.Format("{0}", value)) + write(list) + + + + let list : LinkedList<'T> = {first = None; last = None; count = 0;} + + + + push (list,"road") |> ignore + push list, "the" |> ignore + push list, "across" |> ignore + push list, "running" |> ignore + push list, "was" |> ignore + push list, "cat" |> ignore + push list, "Black" |> ignore + + write(list) + + 0 + + + + \ No newline at end of file diff --git a/F#/F#.fsproj b/F#/F#.fsproj new file mode 100644 index 0000000..3ed5ebf --- /dev/null +++ b/F#/F#.fsproj @@ -0,0 +1,15 @@ + + + + Exe + netcoreapp2.1 + F_ + + + + + + + + + diff --git a/F#/F#.sln b/F#/F#.sln new file mode 100644 index 0000000..96ce3d1 --- /dev/null +++ b/F#/F#.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "F#", "F#.fsproj", "{4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/F#/Program.fs b/F#/Program.fs new file mode 100644 index 0000000..89e30ed --- /dev/null +++ b/F#/Program.fs @@ -0,0 +1,25 @@ +// Learn more about F# at http://fsharp.org + +open System +open HowProgrammingWorks.SingleLinked +open System.Drawing + + + +[] +let main argv = + Console.Clear() + + // let n0 : Node = { prev = None; data = "1"}; + // let n1 : Node = { prev = Some n0; data = "2"}; + // let n2 : Node = { prev = Some n1; data = "3"}; + + // write (Some n2) + + //HowProgrammingWorks.SingleLinked.Example + HowProgrammingWorks.DoubleLinked.Example + + + + + 0 // return an integer exit code diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs new file mode 100644 index 0000000..7384e8d --- /dev/null +++ b/F#/SingleLinked.fs @@ -0,0 +1,37 @@ +module HowProgrammingWorks.SingleLinked + +open System + +type Node<'T> = { + mutable prev : Node<'T> option; + mutable data : 'T; +} + +let empty() = {prev = None; data = None; } + +let pust node data = + Some { prev = node; data = data } + + +let Example = + + let rec write (x : Node<'T> option) = + match x with + | None -> + Console.WriteLine() + | Some n -> + Console.Write(String.Format("{0} ", n.data)) + write n.prev + + let n0 : Node = {prev = None; data = "road";} + let n1 : Node = {prev = Some n0; data = "the";} + let n2 : Node = {prev = Some n1; data = "across";} + let n3 : Node = {prev = Some n2; data = "running";} + let n4 : Node= {prev = Some n3; data = "was";} + let n5 : Node= {prev = Some n4; data = "cat";} + let n6 : Node= {prev = Some n5; data = "Black";} + + write (Some n6) + + + \ No newline at end of file From 28720ed41baf129fc7c19f1082d2bfe92d60c8bc Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Thu, 5 Jul 2018 14:51:30 +0300 Subject: [PATCH 05/13] update example --- F#/DoubleLinked.fs | 64 ++++++++++++++++++++++++++-------------------- F#/Program.fs | 15 ++++++----- F#/SingleLinked.fs | 5 +--- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs index 1ac266d..061241b 100644 --- a/F#/DoubleLinked.fs +++ b/F#/DoubleLinked.fs @@ -1,9 +1,6 @@ module HowProgrammingWorks.DoubleLinked open System -open HowProgrammingWorks.SingleLinked -open System.Collections.Generic -open System.Threading.Tasks.Dataflow type Node<'T> = { mutable prev : Node<'T> option; @@ -17,22 +14,24 @@ type LinkedList<'T> = { mutable count: int; } -let push (list : LinkedList<'T>, data) = +let push (list : LinkedList<'T>, data: 'T) : Node<'T> = match list.count with | 0 -> let node = {prev = None; next = None; data = data; } list.first <- Some node; list.last <- Some node; list.count <- list.count + 1; + node | _ -> - let node = {prev = list.last; next = None; data = data; } - list.last <- Some node; - list.count <- list.count + 1; + let node = {prev = list.last; next = None; data = data; } + list.last.Value.next <- Some node + list.last <- Some node + list.count <- list.count + 1 node -let pull (list : LinkedList<'T>) = +let pull (list : LinkedList<'T>) : 'T option = match list.count with | 0 -> None; @@ -41,12 +40,28 @@ let pull (list : LinkedList<'T>) = list.last <- None; list.first <- None; list.count <- 0; - node.data; + Some node.data; |_-> let node = list.last.Value; list.last <- node.prev; list.count <- list.count - 1; - node.data; + Some node.data; + +let pullFromStart (list : LinkedList<'T>) : 'T option = + match list.count with + | 0 -> + None; + | 1 -> + let node = list.first.Value; + list.last <- None; + list.first <- None; + list.count <- 0; + Some node.data; + |_-> + let node = list.first.Value; + list.first <- node.next; + list.count <- list.count - 1; + Some node.data; let Example = @@ -56,28 +71,21 @@ let Example = | 0 -> Console.WriteLine() | _ -> - let value = pull list; - Console.WriteLine(String.Format("{0}", value)) + //let value = pull list; + let value = pullFromStart list; + Console.Write(String.Format("{0} ", value.Value)) write(list) - let list : LinkedList<'T> = {first = None; last = None; count = 0;} - - + let list : LinkedList = {first = None; last = None; count = 0;} + push (list, "Black") |> ignore + push (list, "cat") |> ignore + push (list, "was") |> ignore + push (list, "running") |> ignore + push (list, "across") |> ignore + push (list, "the") |> ignore push (list,"road") |> ignore - push list, "the" |> ignore - push list, "across" |> ignore - push list, "running" |> ignore - push list, "was" |> ignore - push list, "cat" |> ignore - push list, "Black" |> ignore - write(list) - - 0 - - - - \ No newline at end of file + write list \ No newline at end of file diff --git a/F#/Program.fs b/F#/Program.fs index 89e30ed..a1d2838 100644 --- a/F#/Program.fs +++ b/F#/Program.fs @@ -10,16 +10,17 @@ open System.Drawing let main argv = Console.Clear() - // let n0 : Node = { prev = None; data = "1"}; - // let n1 : Node = { prev = Some n0; data = "2"}; - // let n2 : Node = { prev = Some n1; data = "3"}; + + printf "Linked list: \n" + HowProgrammingWorks.SingleLinked.Example + printf "\n" - // write (Some n2) - - //HowProgrammingWorks.SingleLinked.Example + printf "Double linked list: \n" HowProgrammingWorks.DoubleLinked.Example + printf "\n" - + Console.ReadKey() + Console.Clear() 0 // return an integer exit code diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs index 7384e8d..b1d3aa9 100644 --- a/F#/SingleLinked.fs +++ b/F#/SingleLinked.fs @@ -31,7 +31,4 @@ let Example = let n5 : Node= {prev = Some n4; data = "cat";} let n6 : Node= {prev = Some n5; data = "Black";} - write (Some n6) - - - \ No newline at end of file + write (Some n6) \ No newline at end of file From 5af122d412e2dcb7d1ff6760c7b472df0ef21b75 Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Thu, 5 Jul 2018 14:53:05 +0300 Subject: [PATCH 06/13] cleanup --- .gitignore | 325 +++++++++++++++++++++++++++++++++++++++++++++++++ C#/.gitignore | 329 -------------------------------------------------- F#/.gitignore | 329 -------------------------------------------------- F#/F#.sln | 16 --- 4 files changed, 325 insertions(+), 674 deletions(-) delete mode 100644 C#/.gitignore delete mode 100644 F#/.gitignore delete mode 100644 F#/F#.sln diff --git a/.gitignore b/.gitignore index ac1e8f7..84f94ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,328 @@ node_modules *.log .DS_Store + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ \ No newline at end of file diff --git a/C#/.gitignore b/C#/.gitignore deleted file mode 100644 index 83243f3..0000000 --- a/C#/.gitignore +++ /dev/null @@ -1,329 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ \ No newline at end of file diff --git a/F#/.gitignore b/F#/.gitignore deleted file mode 100644 index 83243f3..0000000 --- a/F#/.gitignore +++ /dev/null @@ -1,329 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ \ No newline at end of file diff --git a/F#/F#.sln b/F#/F#.sln deleted file mode 100644 index 96ce3d1..0000000 --- a/F#/F#.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "F#", "F#.fsproj", "{4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EA2EF9F-57BE-4E89-BC6C-DCC2F8AFD88E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal From b05f6e8184d5f92c477b8fb5020c3f4aa0ac83ad Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Fri, 6 Jul 2018 13:51:52 +0300 Subject: [PATCH 07/13] cleanup --- F#/DoubleLinked.fs | 13 +++++-------- F#/SingleLinked.fs | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs index 061241b..49dfa21 100644 --- a/F#/DoubleLinked.fs +++ b/F#/DoubleLinked.fs @@ -66,18 +66,15 @@ let pullFromStart (list : LinkedList<'T>) : 'T option = let Example = - let rec write (list : LinkedList<'T>) = + let rec write (list : LinkedList) = match list.count with | 0 -> Console.WriteLine() - | _ -> - //let value = pull list; - let value = pullFromStart list; - Console.Write(String.Format("{0} ", value.Value)) + | _ -> + let value = pullFromStart list; //let value = pull list; + printf "%s " value.Value write(list) - - let list : LinkedList = {first = None; last = None; count = 0;} push (list, "Black") |> ignore @@ -86,6 +83,6 @@ let Example = push (list, "running") |> ignore push (list, "across") |> ignore push (list, "the") |> ignore - push (list,"road") |> ignore + push (list, "road") |> ignore write list \ No newline at end of file diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs index b1d3aa9..c66d047 100644 --- a/F#/SingleLinked.fs +++ b/F#/SingleLinked.fs @@ -15,12 +15,12 @@ let pust node data = let Example = - let rec write (x : Node<'T> option) = + let rec write (x : Node option) = match x with | None -> Console.WriteLine() | Some n -> - Console.Write(String.Format("{0} ", n.data)) + printf "%s " n.data write n.prev let n0 : Node = {prev = None; data = "road";} From 6428f3431d5bf9e08e125012ddd27654da51c081 Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Fri, 6 Jul 2018 14:03:49 +0300 Subject: [PATCH 08/13] update project structure --- C#/DoubleLinked.cs | 2 +- C#/{C#.csproj => HowProgrammingWorks.CS.csproj} | 3 ++- C#/Program.cs | 9 ++++----- C#/SingleLinked.cs | 2 +- F#/DoubleLinked.fs | 2 +- F#/{F#.fsproj => HowProgrammingWorks.FS.fsproj} | 2 +- F#/Program.fs | 13 +++---------- F#/SingleLinked.fs | 2 +- 8 files changed, 14 insertions(+), 21 deletions(-) rename C#/{C#.csproj => HowProgrammingWorks.CS.csproj} (74%) rename F#/{F#.fsproj => HowProgrammingWorks.FS.fsproj} (85%) diff --git a/C#/DoubleLinked.cs b/C#/DoubleLinked.cs index 0e53929..c268bd1 100644 --- a/C#/DoubleLinked.cs +++ b/C#/DoubleLinked.cs @@ -1,6 +1,6 @@ using System; -namespace HowProgrammingWorks.DoubleLinkedList +namespace HowProgrammingWorks.CS.DoubleLinkedList { class DoubleLinkedList { diff --git a/C#/C#.csproj b/C#/HowProgrammingWorks.CS.csproj similarity index 74% rename from C#/C#.csproj rename to C#/HowProgrammingWorks.CS.csproj index 4557e23..3baa15b 100644 --- a/C#/C#.csproj +++ b/C#/HowProgrammingWorks.CS.csproj @@ -3,7 +3,8 @@ Exe netcoreapp2.1 - C_ + HowProgrammingWorks.CS + diff --git a/C#/Program.cs b/C#/Program.cs index 23cb8af..f7eb3ed 100644 --- a/C#/Program.cs +++ b/C#/Program.cs @@ -1,6 +1,6 @@ using System; -namespace HowProgrammingWorks +namespace HowProgrammingWorks.CS { class Program { @@ -8,11 +8,10 @@ static void Main(string[] args) { Console.Clear(); - var singleLinkedListExample = new HowProgrammingWorks.SingleLinkedList.Example(); - var doubleLinkedListExample = new HowProgrammingWorks.DoubleLinkedList.Example(); - - //singleLinkedListExample.Run(); + var singleLinkedListExample = new SingleLinkedList.Example(); + var doubleLinkedListExample = new DoubleLinkedList.Example(); + singleLinkedListExample.Run(); doubleLinkedListExample.Run(); } } diff --git a/C#/SingleLinked.cs b/C#/SingleLinked.cs index c7009c8..757449d 100644 --- a/C#/SingleLinked.cs +++ b/C#/SingleLinked.cs @@ -1,6 +1,6 @@ using System; -namespace HowProgrammingWorks.SingleLinkedList +namespace HowProgrammingWorks.CS.SingleLinkedList { class Node { diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs index 49dfa21..b359581 100644 --- a/F#/DoubleLinked.fs +++ b/F#/DoubleLinked.fs @@ -1,4 +1,4 @@ -module HowProgrammingWorks.DoubleLinked +module HowProgrammingWorks.FS.DoubleLinked open System diff --git a/F#/F#.fsproj b/F#/HowProgrammingWorks.FS.fsproj similarity index 85% rename from F#/F#.fsproj rename to F#/HowProgrammingWorks.FS.fsproj index 3ed5ebf..c385491 100644 --- a/F#/F#.fsproj +++ b/F#/HowProgrammingWorks.FS.fsproj @@ -3,7 +3,7 @@ Exe netcoreapp2.1 - F_ + HowProgrammingWorks diff --git a/F#/Program.fs b/F#/Program.fs index a1d2838..5dbc82c 100644 --- a/F#/Program.fs +++ b/F#/Program.fs @@ -1,26 +1,19 @@ // Learn more about F# at http://fsharp.org open System -open HowProgrammingWorks.SingleLinked -open System.Drawing - - [] let main argv = Console.Clear() - printf "Linked list: \n" - HowProgrammingWorks.SingleLinked.Example + HowProgrammingWorks.FS.SingleLinked.Example printf "\n" printf "Double linked list: \n" - HowProgrammingWorks.DoubleLinked.Example + HowProgrammingWorks.FS.DoubleLinked.Example printf "\n" - - Console.ReadKey() - Console.Clear() + 0 // return an integer exit code diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs index c66d047..36dad26 100644 --- a/F#/SingleLinked.fs +++ b/F#/SingleLinked.fs @@ -1,4 +1,4 @@ -module HowProgrammingWorks.SingleLinked +module HowProgrammingWorks.FS.SingleLinked open System From cad9f0e079ec1537a708d586f8c5adacb41ddf87 Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Fri, 6 Jul 2018 14:07:32 +0300 Subject: [PATCH 09/13] cleanup --- C#/DoubleLinked.cs | 9 +++------ C#/Program.cs | 10 ++++++---- C#/SingleLinked.cs | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/C#/DoubleLinked.cs b/C#/DoubleLinked.cs index c268bd1..f6099a3 100644 --- a/C#/DoubleLinked.cs +++ b/C#/DoubleLinked.cs @@ -32,14 +32,13 @@ public T Pop() var node = this.Last; + this.Length--; this.Last = node.Previous; node.List = null; node.Previous = null; node.Next = null; - - this.Length--; - + return node.Data; } @@ -81,11 +80,9 @@ public void Run() list.Push("Black"); while (list.Length > 0) - { Console.Write($"{list.Pop()} "); - } - Console.ReadKey(); + Console.WriteLine(); } } } diff --git a/C#/Program.cs b/C#/Program.cs index f7eb3ed..08b6fa5 100644 --- a/C#/Program.cs +++ b/C#/Program.cs @@ -8,11 +8,13 @@ static void Main(string[] args) { Console.Clear(); - var singleLinkedListExample = new SingleLinkedList.Example(); - var doubleLinkedListExample = new DoubleLinkedList.Example(); + Console.WriteLine("Linked list"); + new SingleLinkedList.Example().Run(); + Console.WriteLine(); - singleLinkedListExample.Run(); - doubleLinkedListExample.Run(); + Console.WriteLine("Double linked list"); + new DoubleLinkedList.Example().Run(); + Console.WriteLine(); } } } diff --git a/C#/SingleLinked.cs b/C#/SingleLinked.cs index 757449d..52f0118 100644 --- a/C#/SingleLinked.cs +++ b/C#/SingleLinked.cs @@ -44,7 +44,7 @@ public void Run() currentNode = currentNode.Previous; } - Console.ReadKey(); + Console.WriteLine(); } } } From 8a18608fd82815f299978c7e5dcb343971d8b83b Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Sat, 7 Jul 2018 01:05:36 +0300 Subject: [PATCH 10/13] use next instead prev --- C#/DoubleLinked.cs | 6 ++++-- C#/SingleLinked.cs | 24 ++++++++++++------------ F#/Program.fs | 4 +--- F#/SingleLinked.fs | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/C#/DoubleLinked.cs b/C#/DoubleLinked.cs index f6099a3..37e0b96 100644 --- a/C#/DoubleLinked.cs +++ b/C#/DoubleLinked.cs @@ -16,8 +16,10 @@ public Node Push(T data) var node = new Node(this, data); node.Previous = this.Last; - if (this.Length == 0) this.First = node; - else this.Last.Next = node; + if (this.Length == 0) + this.First = node; + else + this.Last.Next = node; this.Last = node; this.Length++; diff --git a/C#/SingleLinked.cs b/C#/SingleLinked.cs index 52f0118..5b6b5c8 100644 --- a/C#/SingleLinked.cs +++ b/C#/SingleLinked.cs @@ -9,9 +9,9 @@ public Node(T data) { } - public Node(Node previous, T data) + public Node(Node next, T data) { - Previous = previous; + Next = next; Data = data; } @@ -20,7 +20,7 @@ public Node() { } - public Node Previous { get; set; } + public Node Next { get; set; } public T Data { get; set; } } @@ -28,20 +28,20 @@ class Example { public void Run() { - var n0 = new Node("road"); - var n1 = new Node(n0, "the"); - var n2 = new Node(n1, "across"); - var n3 = new Node(n2, "running"); - var n4 = new Node(n3, "was"); - var n5 = new Node(n4, "cat"); - var n6 = new Node(n5, "Black"); + var n6 = new Node("road"); + var n5 = new Node(n6, "the"); + var n4 = new Node(n5, "across"); + var n3 = new Node(n4, "running"); + var n2 = new Node(n3, "was"); + var n1 = new Node(n2, "cat"); + var n0 = new Node(n1, "Black"); - var currentNode = n6; + var currentNode = n0; while (currentNode != null) { Console.Write($"{currentNode.Data} "); - currentNode = currentNode.Previous; + currentNode = currentNode.Next; } Console.WriteLine(); diff --git a/F#/Program.fs b/F#/Program.fs index 5dbc82c..28c0966 100644 --- a/F#/Program.fs +++ b/F#/Program.fs @@ -13,7 +13,5 @@ let main argv = printf "Double linked list: \n" HowProgrammingWorks.FS.DoubleLinked.Example printf "\n" - - - 0 // return an integer exit code + 0 // return an integer exit code \ No newline at end of file diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs index 36dad26..2285da4 100644 --- a/F#/SingleLinked.fs +++ b/F#/SingleLinked.fs @@ -3,14 +3,14 @@ module HowProgrammingWorks.FS.SingleLinked open System type Node<'T> = { - mutable prev : Node<'T> option; + mutable next : Node<'T> option; mutable data : 'T; } -let empty() = {prev = None; data = None; } +let empty() = {next = None; data = None; } let pust node data = - Some { prev = node; data = data } + Some { next = node; data = data } let Example = @@ -21,14 +21,14 @@ let Example = Console.WriteLine() | Some n -> printf "%s " n.data - write n.prev + write n.next - let n0 : Node = {prev = None; data = "road";} - let n1 : Node = {prev = Some n0; data = "the";} - let n2 : Node = {prev = Some n1; data = "across";} - let n3 : Node = {prev = Some n2; data = "running";} - let n4 : Node= {prev = Some n3; data = "was";} - let n5 : Node= {prev = Some n4; data = "cat";} - let n6 : Node= {prev = Some n5; data = "Black";} + let n6 : Node = {next = None; data = "road";} + let n5 : Node = {next = Some n6; data = "the";} + let n4 : Node = {next = Some n5; data = "across";} + let n3 : Node = {next = Some n4; data = "running";} + let n2 : Node= {next = Some n3; data = "was";} + let n1 : Node= {next = Some n2; data = "cat";} + let n0 : Node= {next = Some n1; data = "Black";} - write (Some n6) \ No newline at end of file + write (Some n0) \ No newline at end of file From 5b79374e4012dae7961c2abd17d8f6ec495516dd Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Sat, 7 Jul 2018 01:12:52 +0300 Subject: [PATCH 11/13] update F# DoubleLinked init --- F#/DoubleLinked.fs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs index b359581..15764cd 100644 --- a/F#/DoubleLinked.fs +++ b/F#/DoubleLinked.fs @@ -76,13 +76,8 @@ let Example = write(list) let list : LinkedList = {first = None; last = None; count = 0;} - - push (list, "Black") |> ignore - push (list, "cat") |> ignore - push (list, "was") |> ignore - push (list, "running") |> ignore - push (list, "across") |> ignore - push (list, "the") |> ignore - push (list, "road") |> ignore + + let words = [ "Black"; "cat"; "was"; "running"; "across"; "the"; "road"; ] + words |> List.iter (fun w -> push(list, w) |> ignore ) write list \ No newline at end of file From 122aa34bc6ebe79191969b224fe1434d3d526c62 Mon Sep 17 00:00:00 2001 From: Andrew Gubskiy Date: Sat, 7 Jul 2018 21:38:15 +0300 Subject: [PATCH 12/13] update js examples for 1 and 2 --- JavaScript/1-single-proto.js | 12 +++++++----- JavaScript/2-single-factory.js | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/JavaScript/1-single-proto.js b/JavaScript/1-single-proto.js index b9c350c..e839f0d 100644 --- a/JavaScript/1-single-proto.js +++ b/JavaScript/1-single-proto.js @@ -1,15 +1,17 @@ 'use strict'; -function Node(prev, data) { - this.prev = prev; +function Node(next, data) { + this.next = next; this.data = data; } // Usage -const n1 = new Node(null, { name: 'first' }); -const n2 = new Node(n1, { name: 'second' }); -const n3 = new Node(n2, { name: 'third' }); +const n3 = new Node(null, { name: 'third' }); +const n2 = new Node(n3, { name: 'second' }); +const n1 = new Node(n2, { name: 'first' }); + + console.dir(n1); console.dir(n2); diff --git a/JavaScript/2-single-factory.js b/JavaScript/2-single-factory.js index ffc4d01..4ff2144 100644 --- a/JavaScript/2-single-factory.js +++ b/JavaScript/2-single-factory.js @@ -1,12 +1,14 @@ 'use strict'; -const node = (prev, data) => ({ prev, data }); +const node = (next, data) => ({ next, data }); // Usage -const n1 = node(null, { name: 'first' }); -const n2 = node(n1, { name: 'second' }); -const n3 = node(n2, { name: 'third' }); +const n3 = node(null, { name: 'third' }); +const n2 = node(n3, { name: 'second' }); +const n1 = node(n2, { name: 'first' }); + + console.dir(n1); console.dir(n2); From 4f64ef4118e971d0fb4f47fbdd8b2de9fb9d82cd Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 30 Jan 2021 15:29:53 +0200 Subject: [PATCH 13/13] Update formating --- .gitignore | 332 +------------------------------ C#/HowProgrammingWorks.CS.csproj | 1 - F#/DoubleLinked.fs | 3 +- F#/Program.fs | 3 +- F#/SingleLinked.fs | 3 +- 5 files changed, 10 insertions(+), 332 deletions(-) diff --git a/.gitignore b/.gitignore index 84f94ae..0335b99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,328 +1,4 @@ -node_modules -*.log -.DS_Store - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ \ No newline at end of file +node_modules node_modules + *.log *.log + .DS_Store + \ No newline at end of file diff --git a/C#/HowProgrammingWorks.CS.csproj b/C#/HowProgrammingWorks.CS.csproj index 3baa15b..0c14923 100644 --- a/C#/HowProgrammingWorks.CS.csproj +++ b/C#/HowProgrammingWorks.CS.csproj @@ -7,4 +7,3 @@ - diff --git a/F#/DoubleLinked.fs b/F#/DoubleLinked.fs index 15764cd..5732bb7 100644 --- a/F#/DoubleLinked.fs +++ b/F#/DoubleLinked.fs @@ -80,4 +80,5 @@ let Example = let words = [ "Black"; "cat"; "was"; "running"; "across"; "the"; "road"; ] words |> List.iter (fun w -> push(list, w) |> ignore ) - write list \ No newline at end of file + write list + \ No newline at end of file diff --git a/F#/Program.fs b/F#/Program.fs index 28c0966..c4c0341 100644 --- a/F#/Program.fs +++ b/F#/Program.fs @@ -14,4 +14,5 @@ let main argv = HowProgrammingWorks.FS.DoubleLinked.Example printf "\n" - 0 // return an integer exit code \ No newline at end of file + 0 // return an integer exit code + \ No newline at end of file diff --git a/F#/SingleLinked.fs b/F#/SingleLinked.fs index 2285da4..f1095fb 100644 --- a/F#/SingleLinked.fs +++ b/F#/SingleLinked.fs @@ -31,4 +31,5 @@ let Example = let n1 : Node= {next = Some n2; data = "cat";} let n0 : Node= {next = Some n1; data = "Black";} - write (Some n0) \ No newline at end of file + write (Some n0) + \ No newline at end of file