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
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var gems = new[] { 1, 4, 1, 4, 2, 1, 3 }; | |
var pattern = "eagcdfbe".Select(x => x - 'a').ToArray(); |
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
class TupleComparer<T1, T2, T3, T4> : EqualityComparer<Tuple<T1, T2, T3, T4>> | |
{ | |
private static readonly IEqualityComparer<T1> comparer1 | |
= EqualityComparer<T1>.Default; | |
private static readonly IEqualityComparer<T2> comparer2 | |
= EqualityComparer<T2>.Default; | |
private static readonly IEqualityComparer<T3> comparer3 | |
= EqualityComparer<T3>.Default; | |
private static readonly IEqualityComparer<T4> comparer4 | |
= EqualityComparer<T4>.Default; |
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
Imports System.Collections.ObjectModel | |
Module Module1 | |
Sub Main() | |
Dim c As New Collection(Of Integer) From {1} | |
Foo(Of Integer)(c) | |
End Sub | |
Sub Foo(Of T)(ByVal o As Object) |
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
Option Strict Off | |
Imports System.Text | |
Module Module1 | |
Sub Main() | |
Dim table As New Dictionary(Of String, Object)() | |
table("test") = New List(Of Integer) From {1, 2, 3} | |
Console.WriteLine(DictionaryToString(table)) |
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
If TypeOf .Value Is List(Of Integer) Then | |
sb.Append(CType(.Value, List(Of Integer))) | |
ElseIf TypeOf .Value Is List(Of String) Then | |
sb.Append(CType(.Value, List(Of String))) | |
ElseIf TypeOf .Value Is List(Of Object) Then | |
sb.Append(CType(.Value, List(Of Object))) | |
End If |
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
Option Strict On | |
Imports System.Text | |
Imports System.Reflection | |
Module Module1 | |
Sub Main() | |
Dim table As New Dictionary(Of String, Object)() | |
table("test") = New List(Of Integer) From {1, 2, 3} |
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
Option Strict On | |
Imports System.Text | |
Module Module1 | |
Sub Main() | |
Dim table As New Dictionary(Of String, Object)() | |
table("test") = New List(Of Integer) From {1, 2, 3} | |
Console.WriteLine(DictionaryToString(table)) |
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
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
[TestClass] | |
public class GrepUtilTest | |
{ |
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 example; | |
import java.util.function.*; | |
public class Program { | |
public static void main(String[] args) { | |
Function<Integer, Integer> fib | |
= Y(f -> n -> n > 1 ? f.apply(n - 1) + f.apply(n - 2) : n); |
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
using System; | |
using System.Collections.Generic; | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Value<Maybe, int> m1 = Maybe.Instance.Unit(12); | |
Value<Maybe, int> m2 = Maybe.Instance.Unit(34); | |
Value<Maybe, int> m3 = |
OlderNewer