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
// See https://aka.ms/new-console-template for more information | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
public class Demo | |
{ | |
private static Dictionary<string, List<string>> _classWisePropMap | |
= new Dictionary<string, List<string>>(); |
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
//A very basic but smart code comparer for C# | |
//Written using Microsoft.CodeAnalysis.CSharp and LINQ | |
public class SmartComparer | |
{ | |
public static string Code1 { get; set; } | |
public static string Code2 { get; set; } | |
public static IEnumerable<ClassDeclarationSyntax> Classes1 { get; set; } | |
public static IEnumerable<ClassDeclarationSyntax> Classes2 { get; set; } |
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
void Main() | |
{ | |
string csvFile = @"C:\MLDOTNET\iris.csv"; | |
var columns = File.ReadLines(csvFile) | |
.Take(1) | |
.First() | |
.Split(new char[] { ',' }); | |
var firstLine = File.ReadLines(csvFile) | |
.Skip(1) | |
.Take(1) |
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
//Avoid Boxing | |
var code = @"public void fun(){int x = 32; | |
object o = x;}"; | |
var tree = CSharpSyntaxTree.ParseText(code); | |
//x - Int |
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
open System.Text.RegularExpressions | |
type SentiWordNetEntry = {POS:string; ID:string; PositiveScore:string; NegativeScore:string; Words:string} | |
let sentiWordList = System.IO.File.ReadAllLines(@"SentiWordNet_3.0.0_20130122.txt") | |
|> Array.filter (fun line -> not (line.StartsWith("#"))) | |
|> Array.map (fun line -> line.Split '\t') | |
|> Array.map (fun lineTokens -> {POS = lineTokens.[0]; | |
ID = lineTokens.[1]; | |
PositiveScore = lineTokens.[2].Trim(); |
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
package hello | |
fun main() { | |
var x = 11 | |
var y = if (x > 10) { println("Hey!"); ":Kotlin"} else | |
{ | |
println("NO!") | |
"OUCH!" | |
} | |
println(y) |
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
package hello | |
fun main() { | |
var xs = listOf(listOf(1,2,3), | |
listOf(1,5,6,2), | |
listOf(7,8,2,11,1)) | |
var result = xs[0] | |
for(i in 1 .. xs.size - 1) | |
{ | |
result = result.intersect(xs[i]).toList() |
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
// Learn more about F# at http://fsharp.org | |
// See the 'F# Tutorial' project for more help. | |
//Comprehensive coverage of Collaborative Filtering Techniques | |
//http://www.hindawi.com/journals/aai/2009/421425/ | |
module confusion = | |
let TP (matches : int [] []) = | |
matches |> Array.mapi( fun i j -> matches.[i].[i]) |> Array.sum |
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
void Main() | |
{ | |
Cartesian<string>(new List<List<string>>() | |
{ | |
new List<string>() { "A", "B" }, | |
new List<string>() { "C", "D", "E" } | |
}).Dump(); | |
} | |
public static List<List<T>> Cartesian<T>(List<List<T>> sets) |
NewerOlder