This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT e.name, m.name FROM Employee e, Employee m WHERE e.Employee_id=m.Manager_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Retile { | |
| void walk(); | |
| } | |
| public class Turtle implements Reptile { | |
| @Override | |
| public void walk() { | |
| System.out.println("Turtle is walking!"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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: "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const filterMap = (checker, mapper, list) => | |
| list.reduce( | |
| (acc, current) => checker(current) ? acc.push(mapper(current)) && acc : acc, | |
| [] | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const add = a => b => a + b; | |
| const increaseCounter = counter => add(1)(counter); | |
| increaseCounter(5); // => 6 | |
| const pointFreeIncreaseCounter = add(1); | |
| pointFreeIncreaseCounter(5); // => 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const myFirstClassArrow = a => b => a + b; | |
| myFirstClassArrow(1)(2); // => 3 |