Skip to content

Instantly share code, notes, and snippets.

SELECT e.name, m.name FROM Employee e, Employee m WHERE e.Employee_id=m.Manager_id;
public interface Retile {
void walk();
}
public class Turtle implements Reptile {
@Override
public void walk() {
System.out.println("Turtle is walking!");
}
}
#include <stdio.h>
int main()
{
int num1, num2, num3;
int *p1, *p2, *p3;
//taking input from user
printf("Enter First Number: ");
scanf("%d",&num1);
printf("Enter Second Number: ");
import {filterMap, includes, upperCaseOf, replace, map} from '@7urtle/lambda';
const itsATortoise = replace('TORTOISE')('TURTLE');
const composedMapper = compose(itsATortoise, upperCaseOf);
// the same as const mapper = a => itsATortoise(upperCaseOf(a));
const animals = ['Russian Turtle', 'Greek Turtle', 'House Cat'];
const onlyTurtles = includes('Turtle');
import {filterMap, includes, upperCaseOf} from '@7urtle/lambda';
const animals = ['Russian Turtle', 'Greek Turtle', 'House Cat'];
const onlyTurtles = includes('Turtle');
filterMap(onlyTurtles, upperCaseOf, animals);
// => ['RUSSIAN TURTLE', 'GREEK TURTLE']
filterMap(onlyTurtles)(upperCaseOf)(animals); // curried
// => ['RUSSIAN TURTLE', 'GREEK TURTLE']
const myList = [1, 2, 3];
const myChecker = a => a > 1; // filter only numbers larger than 1
const myMapper = a => a + 1; // make all numbers + 1
filterMap(myChecker, myMapper, myList); // => [3, 4]
const filterMap = (checker, mapper, list) =>
list.reduce(
(acc, current) => checker(current) ? acc.push(mapper(current)) && acc : acc,
[]
);
import {trim, upperCaseOf, lengthOf, lastLetterOf, includes, compose} from '@7urtle/lambda';
const endsWithPunctuation = input =>
includes(lastLetterOf(input))('.?,!');
const replacePunctuationWithExclamation = input =>
substr(lengthOf(input) - 1)(0)(input) + '!';
const addExclamationMark = input =>
endsWithPunctuation(input)
const add = a => b => a + b;
const increaseCounter = counter => add(1)(counter);
increaseCounter(5); // => 6
const pointFreeIncreaseCounter = add(1);
pointFreeIncreaseCounter(5); // => 6
const myFirstClassArrow = a => b => a + b;
myFirstClassArrow(1)(2); // => 3