Skip to content

Instantly share code, notes, and snippets.

View vijayanant's full-sized avatar

Vijay Anant vijayanant

View GitHub Profile
@vijayanant
vijayanant / complexity.md
Created September 14, 2017 09:09
What makes our softwares complex?

What makes our softwares complex?

Some of the complexity in softwares are inherent in the problem domain, like complex rules of business. But others are just man-made.

State

A state is a collection of information held (at any time) by a part of the system that is accessible by other parts of the system. When different parts of the system can access and update program state, it becomes harder to coordinate between them and keep the system in a consistent state. This  makes system hard to understand, modify, extend and to test comprehensively.

Control Flow

@vijayanant
vijayanant / DesignPrinciples.md
Created September 17, 2017 04:23
Rant about OO Design Principles (WIP)

Design Principles

There are many people who will say there are 5 design principles. Well, I believed that too for some time. There are a lot more design principles that you will be considering while designing an application/framework. But these are the few principles that you MUST adhere to in any application/framework class design.

These are the Principles of Object Oriented Class Design popularly known as the SOLID Principles.

  • The Single Responsibility Principle [SRP]
  • The Open/Closed Principle [OCP]
  • The Liskov Substitution Principle [LSP]
  • The Interface Segregation Principle [ISP]
@vijayanant
vijayanant / Lambda.md
Last active June 13, 2024 06:06
Lambda Calculus - Church Numerals and Basic Operations

My notes on Lambda Calculus.

Introduction

The syntax of the lambda-calculus comprises just three sorts of terms.

  • A variable x by itself is a term;
  • The abstraction of a variable x from a term t1, written λx.t1, is a term;
  • And the application of a term t1 to another term t2, written t1 t2, is a term.

These ways of forming terms are summarized in the following grammar.

@vijayanant
vijayanant / TensorFlow-basics.md
Last active February 25, 2018 11:47
Notes and code samples for TensorFlow

TensorFlow

TensorFlow is Google's open source library for numerical computation. All computations are represented as Data Flow Graphs. The Nodes in the graph represent operations and Edges represent the data-communication between nodes.

Basics

Every computation is a graph. That is, we first create a graph that represent our computation. Then we run/evaluate that graph. The evaluation always happen within a Session

import tensorflow as tf
x = tf.random_uniform([10])
print(x)
@vijayanant
vijayanant / learning resources.md
Created July 17, 2018 14:04 — forked from rdbuf/learning resources.md
the list is known to be approximate and incomplete
@vijayanant
vijayanant / Tree.hs
Last active November 4, 2018 14:40
Binary Tree type and traversal in Haskell, Python, and Java
data Tree a = Empty | Node (Tree a) a (Tree a)
deriving (Show)
fromList :: [a] -> Tree a
fromList xs
| null xs = Empty
| otherwise = Node (fromList x1) x (fromList x2)
where (x1, x:x2) = splitAt (length xs `div` 2) xs
inorder :: Tree a -> [a]
@vijayanant
vijayanant / Applicatives.hs
Last active January 17, 2020 13:54
Choose Wisely
-- 1 + 2
-- (+) 1 2
-- + (Just 1) (Just 2)
-- Monadic desugared
(Just 1) >>= (\x -> (Just 2) >>= \y -> return (x+y))
-- Monadic sugar

Keybase proof

I hereby claim:

  • I am vijayanant on github.
  • I am vijayanant (https://keybase.io/vijayanant) on keybase.
  • I have a public key ASATAASxUzx1ZqEy4JGeIrlA1oyzEk6jSPdtXtZPglZs_Qo

To claim this, I am signing this object:

@vijayanant
vijayanant / HigherRankedTypes.hs
Last active July 4, 2024 08:03
Rank N Types in Haskell
{-# LANGUAGE RankNTypes #-}
module RankN where
-- Rank 0:
-- add1 is momomorphic
add1 :: Int -> Int
add1 x = x + 1
-- Rank 1
@vijayanant
vijayanant / README.md
Created November 27, 2018 03:17 — forked from m-ammar/README.md
haskell-resources