Author Archives: ratn

Scala without covariance

Without covariance  (In presence of Invarinace )  class Test[T]    var x:Test[Any] = new Test[Nothing] //error doom ,what you see   Nothing <: Any, but class Test is invariant in type T.   Verbose : Nothing is subclass of Any but … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

DSL with Groovy

Creating dsl in groovy is easy .For example below dsl is for adding roles and permissions i DSL : And this is code for this dsl to work :

Posted in Uncategorized | Leave a comment

Groovy recursive List flattening

Posted in Uncategorized | Leave a comment

Composition and partially implemented functions with groovy

A bit of functional composition and partially implemented function with groovy :

Posted in Uncategorized | Leave a comment

Groovy Partial functions

In groovy we could model somewhat similar to Partial functions like in functional languages : First an example with just variable binding in closures With Curry : modelling a partial function :

Posted in Uncategorized | Leave a comment

Haskell DList

Append operation in haskell might be costlier ,if done this way let x = “hello” ++ ” haskell” let y = x ++ ” well done ” to append this way have to traverse whole list each time ,a better … Continue reading

Posted in Uncategorized | Leave a comment

Haskell foldr in terms of foldl

This explains foldl in terms of foldr : https://ratndeo.wordpress.com/2013/01/11/haskell-foldl-as-foldr/ Now its time to whisper foldr in terms of foldl : foldr :: (a -> b -> b) -> b -> [a] -> b foldr f init (x:xs) = foldl f’ … Continue reading

Posted in Uncategorized | Leave a comment