Skip to content

Instantly share code, notes, and snippets.

View essic's full-sized avatar

Aly-Bocar Cissé essic

  • Paris
View GitHub Profile
@essic
essic / Small sum type example.hs
Created April 3, 2017 23:49
Small sum type example created by essic - https://repl.it/Grs6/27
data ComplexNumber =
Polar { theta:: Float, radius:: Float } -- r * theta * i
| Algebraic { real :: Float, imaginary :: Float } -- a +bi
deriving(Show)
add:: ComplexNumber -> ComplexNumber -> ComplexNumber
add cn1 cn2 =
Algebraic (a1 + a2) (b1 + b2)
where
@essic
essic / LinkedList in Haskell.hs
Last active April 6, 2017 16:59
LinkedList in Haskell created by essic - https://repl.it/GuFF/49
data LinkedList a =
Cons a (LinkedList a) | Nil
deriving (Show)
push :: a -> LinkedList a -> LinkedList a
push x y =
Cons x y
push_back :: a -> LinkedList a -> LinkedList a
push_back a Nil =
@essic
essic / Simple abstract data type exemple 1.hs
Created April 9, 2017 19:08
Simple abstract data type exemple 1 created by essic - https://repl.it/GEaw/39
accumulate :: (a -> b) -> [a] -> [b]
accumulate _ [] = []
accumulate f (x:xs) = f x : accumulate f xs
data Planet = Mercury
| Venus
| Earth
| Mars
| Jupiter
@essic
essic / Another dumb example of ADT.hs
Last active April 9, 2017 22:02
Another dumb example of ADT created by essic - https://repl.it/HCZ4/16
data Race = White | Black | Asian | Indian | Unknown
deriving (Show)
data HumanInformations = HumanInformations
{
name :: String , age :: Int , weight :: Int, race :: Race
} deriving(Show)
data Human = Male HumanInformations | Female HumanInformations
deriving(Show)
@essic
essic / spacemacs-keybindings
Created September 27, 2017 22:04 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@essic
essic / spacemacs-cheatsheet.md
Created September 30, 2017 21:04 — forked from davoclavo/spacemacs-cheatsheet.md
Spacemacs cheatsheet

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@essic
essic / Haskell playground.hs
Last active October 11, 2017 14:44
Haskell playground created by essic - https://repl.it/J0S6/16
race :: Int -> Int -> Int -> Maybe (Int, Int, Int)
race v1 v2 g
| v1 >= v2 = Nothing
| otherwise =
let ts = convertToSecondsThenFloorIt $ calculateTimeToCatchUpInHours v1 v2 g
h = getHours ts
m = getMinutes ts
s = getSeconds ts
in Just (h, m, s)
where
@essic
essic / Haskell playground.hs
Created January 4, 2018 16:55
Haskell playground created by essic - https://repl.it/@essic/Haskell-playground
{-# LANGUAGE NoImplicitPrelude #-}
import Data.List (find)
import Data.Monoid ((<>))
import Data.Either (Either(..))
import Data.Int (Int)
import System.IO (IO,putStrLn)
import Data.String (String)
import Text.Show (show,Show)
import Data.Maybe (maybe)
import Data.Function ( (.), ($))
using System;
using System.Linq;
using System.Collections.Generic;
public enum State {
Invalid = 0,
Ok = 1,
Ignored = 2,
NOk = 3,
NN = 3
// In here we want to show informations about collaborators in some consulting organization.
module BasicDemo
//Basic import, useful to access "String" by example"
open System
//This is type alias
type Age = int
type FirstName = string
type LastName = string