Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
hodzanassredin / words.hs
Created April 6, 2011 17:03
words generator via list comprehensions
let words numOfChars alphabet = []:[ b++[c] | numOfChars > 0, b <-words (numOfChars-1) alphabet, c <- alphabet ]
words 3 "ab"
@hodzanassredin
hodzanassredin / naive-solver.hs
Created April 6, 2011 18:26
naive solver for socrat problem just to check
--human "socrat" = True
--human "platon" = True
--human "a" = True
--human _ = False
--mortal x = human x
--wordsgen numOfChars alphabet = []:[ b++[c] | numOfChars > 0, b <-wordsgen (numOfChars-1) alphabet, c <- alphabet ]
--alphabet = "abcdefghijklmnopqrstuvwxyz"
@hodzanassredin
hodzanassredin / prototype-based.py
Created April 9, 2011 19:38
implementation of internal DSL for Prototype-based programming in Python
import copy
# Имплементация прототип ориентированного internal DSL для Python по мотивам Io Language http://habrahabr.ru/blogs/crazydev/28041/
# Implementation of prototype oriented internal DSL for python based on article about Io Language http://habrahabr.ru/blogs/crazydev/28041/
class IoObject(dict):
def __init__(self):
self.clone = copy.copy
def __getattr__(self, attr):
if 'get_slot' in self:
val = self["get_slot"](attr)#может вызвать бесконечность / infinite loop can occur
@hodzanassredin
hodzanassredin / ackermann.cs
Created April 20, 2011 14:09
Ackerman without stack overflow
using System;
using System.Collections.Generic;
namespace Trampoline
{
class Program
{
static void Main()
{
for (long m = 0; m <= 3; ++m)
@hodzanassredin
hodzanassredin / Makefile
Created May 6, 2011 15:46
minimal Makefile for manual projects
objects = test.o
edit : $(objects)
cc -o edit $(objects)
$(objects) :
.PHONY : clean
clean :
-rm edit $(objects)
@hodzanassredin
hodzanassredin / demo.cs
Created June 28, 2011 09:01
List Extensins Demo
using System.Collections.Generic;
using System;
using System.Linq;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
@hodzanassredin
hodzanassredin / fpcs.cs
Created July 4, 2011 12:46
Вариант для реализации других видов ооп в C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FpCs
{
class Program
{
static void Main(string[] args)
@hodzanassredin
hodzanassredin / reactive.cs
Created July 7, 2011 11:20
Using RX for object level CQRS, method proxy and logging.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reactive.Subjects;
using System.Reactive.Linq;
namespace FpCs
{
class Program
@hodzanassredin
hodzanassredin / typeProvider.fs
Created September 18, 2011 09:44
TypeProvider demo from @dsyme presentation
// Learn more about F# at http://fsharp.net
namespace ExampleTypeProvider.DesignTime
open System
open System.Collections.Generic
open System.Linq.Expressions
open System.Globalization
open System.Reflection
open System.Diagnostics
open Microsoft.FSharp.Core.CompilerServices
@hodzanassredin
hodzanassredin / FileSystemTypeProvider.fs
Created September 25, 2011 19:57
Sample of file system TypeProvider
namespace FilesTypeProvider
open System.Reflection
open Microsoft.FSharp.Core.CompilerServices
open Samples.FSharpPreviewRelease2011.ProvidedTypes
open System.Text.RegularExpressions
[<TypeProvider>]
type public CheckedFilesProvider() as this =