Saturday, February 21, 2015

Keeping track of notes - notepad on steroids

You may like Zimwiki .

It's a wiki based program that's bare bones, but has the basics: font format, headers, bullet lists, number lists, to do boxes.

Friday, February 13, 2015

Sunday, October 26, 2014

Haskell Introducere, Liste, uplu, functii, tipuri polimorfice, supraincarcare.

Tipurile de baza:

·        Bool – valori logice
Contine valorile logice False si True.
·        Char – caractere
Contine toate caracterele disponibile de la tastatura precum ‘a’, ‘_’, ‘V’, precum si un numar de caractere de control precum ‘\n’, ‘\t’.
·        String – siruri de caractere
Acest tip contine toate secventele de caractectere, precum “abc”, “1+2=3” si sirul vid “”.
·        Int – numere intregi intre -231 si 231 -1
·        Integer – numere intregi cu precizie infinita
·        Float - single-precision floating-point numbers

Thursday, October 23, 2014

Haskell - Defining custom data types

  • allows us to add structure to the values in our programs
  • defining our own types also imrpoves the safety of our code
  • haskell will not allow us to accidentally mix values of two values that are structurally similar but have different names.

-- file: ch03/BookStore.hs
data BookInfo = Book Int String [String]
                deriving (Show)
 
  1. The BookInfo after the data keyword is the name of our new type. We call BookInfo a type constructor
  2. The Book that follows is the name of the value constructor (sometimes called a data constructor)
  3. After Book, the Int, String, and [String] that follow are the components of the type.

Tuesday, October 21, 2014

Haskell Evaluation

Conditional evaluation

-- file: ch02/myDrop.hs
myDrop n xs = if n <= 0 || null xs
              then xs
              else myDrop (n - 1) (tail xs)  
The if keyword introduces an expression that has three components.
  • An expression of type Bool, immediately following the if. We refer to this as a predicate.
  • A then keyword, followed by another expression. This expression will be used as the value of the if expression if the predicate evaluates to True.
  • An else keyword, followed by another expression. This expression will be used as the value of the if expression if the predicate evaluates to False.
  • The null function indicates whether a list is empty, while the (||) operator performs a logical “or” of its Bool-typed arguments. 
ghci> :type null
null :: [a] -> Bool
ghci> :type (||)
(||) :: Bool -> Bool -> Bool


Monday, October 20, 2014

Haskell - Functions, Overloading, Pattern Matching, Variables

III. Functions

Function application is left associative
The expression a b c d is equivalent to (((a b) c) d)

If we want to use one expression as an argument to another, we have to use explicit parentheses to tell the parser what we really mean

Defining and calling functions is simple
add a b = a + b
add 1 2


Sunday, October 19, 2014

Haskell - Expressions, Basic Types, Composite Data Types


Every expression and function in Haskell has a type.
Types in Haskell are:
  1. Strong
  2. Static
  3. Can be automatically inferred.
  • True has the type Bool
  • 'foo' is of type String
  • 1 has type Num
Type are important for abstraction. To add meaning to some bytes. The meaning cannot change after the type has been defined. 
The benefit is that you can ignore or forget about the low level details.