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.Linq; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
static class TypeExtensions | |
{ | |
public static Boolean IsAnonymous(this Type type) | |
{ | |
if (!type.GetCustomAttributes(typeof(CompilerGeneratedAttribute), false).Any()) { |
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
// requires: | |
// dotnet add package Castle.Core --version 4.4.0 | |
// output: | |
// IAdder::Sum invoked | |
// 3 | |
using System.Runtime.CompilerServices; | |
using System; | |
using Castle.DynamicProxy; |
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
// "generic" function to find an array item | |
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
ints := make([]int, 5) |
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.Threading.Tasks; | |
using AngleSharp; | |
using AngleSharp.Html.Dom; | |
using AngleSharp.Dom; | |
class Program | |
{ | |
static async Task Main(string[] args) | |
{ |
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
(* | |
Demonstrates the use of PickAll with Standford NLP POS Tagger | |
PickAll: | |
- https://github.com/gsscoder/pickall | |
Derived from: | |
- http://sergey-tihon.github.io/Stanford.NLP.NET/samples/POSTagger.Sample.html | |
TargetFramework: | |
- net452 | |
References: | |
- netstandard |
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
"Copy and paste to LFE REPL to get: 3628800" | |
(defun factorial | |
((0) 1) | |
((n) (* n (factorial (- n 1))))) | |
(factorial 10) |
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
// $ dotnet fsi factorial.fsx 10 | |
// 3628800 | |
let rec factorial n : int64 = | |
match n with | |
| 0L -> 1L | |
| n -> n * factorial(n - 1L) | |
printfn "%d" (factorial (fsi.CommandLineArgs.[1] |> int64)) |
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
// $ sbt | |
// sbt:factorial> ~run 10 | |
// [info] running sample.Sample 10 | |
// 3628800 | |
package sample | |
object Sample extends App { | |
println(factorial(args(0).toLong).toString) | |
def factorial (num: Long) : Long = { |
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
-- $ ./factorial 10 | |
-- 3628800 | |
import System.Environment | |
main = do | |
args <- getArgs | |
let n = args !! 0 | |
putStrLn (show (factorial (read n))) | |
factorial :: (Integral a) => a -> a |
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
// $ dotnet script factorial.csx 10 | |
// 3628800 | |
var n = long.Parse(Args.ElementAt(0)); | |
Console.WriteLine($"{factorial(n)}"); | |
long factorial(long n) | |
{ | |
if (n == 0) { |