A list of all the region names and locations for Azure
You can recreate the list anytime using this command:
az account list-locations -o table| // The code below is a stub. Just enough to satisfy the compiler. | |
| // In order to pass the tests you can add-to or change any of this code. | |
| //My first naive solution to https://exercism.org/tracks/rust/exercises/space-age | |
| #[derive(Debug)] | |
| pub struct Duration { | |
| seconds: u64, | |
| } |
| import { findMatchingAndMoveToFirst } from "./findMatchingAndMoveToFirst" | |
| interface Product{ | |
| name: string | |
| description: string | |
| price: number | |
| } | |
| function compareProducts(self: Product, other: Product): boolean { | |
| return self.name === other.name && self.description === other.description && self.price === other.price |
| import { findMatchingAndMoveToFirst } from "./findMatchingAndMoveToFirst" | |
| interface User { | |
| firstName: string | |
| lastName: string | |
| } | |
| function compareUsers(self: User, other: User): boolean { | |
| return self.firstName === other.firstName && self.lastName === other.lastName | |
| } |
| export interface Compare<T, U> { | |
| compare: (t: T, u: U) => boolean | |
| } | |
| export function findMatchingAndMoveToFirst<T, U extends Compare<T, U>>( | |
| list: readonly T[], | |
| shouldbeFirst: U | |
| ): T[] { | |
| return list.reduce( | |
| (accumulator: T[], current: T) => |
| interface User { | |
| firstName: string | |
| lastName: string | |
| } | |
| function findMatchingAndMoveToFirst( | |
| users: readonly User[], | |
| shouldBeFirst: User | |
| ) { | |
| return users.reduce( |
| const users = [ | |
| { firstName: 'Jane', lastName: 'Foo' }, | |
| { firstName: 'John', lastName: 'Bar' }, | |
| { firstName: 'Jill', lastName: 'Err' } | |
| ] | |
| function findMatchingAndMoveToFirst (users, shouldBeFirst) { | |
| return users.reduce( | |
| (accumulator, current) => | |
| current.firstName === shouldBeFirst.firstName && |
| const users = [ | |
| { firstName: 'Jane', lastName: 'Foo' }, | |
| { firstName: 'John', lastName: 'Bar' }, | |
| { firstName: 'Jill', lastName: 'Err' } | |
| ] | |
| function findMatchingAndMoveToFirst (users, shouldBeFirst) { | |
| return users.reduce((accumulator, current) => { | |
| return current.firstName === shouldBeFirst.firstName && | |
| current.lastName === shouldBeFirst.lastName |
| const users = [ | |
| { firstName: 'Jane', lastName: 'Foo' }, | |
| { firstName: 'John', lastName: 'Bar' }, | |
| { firstName: 'Jill', lastName: 'Err' } | |
| ] | |
| function findMatchingAndMoveToFirst (users, shouldBeFirst) { | |
| return users.reduce((accumulator, current) => { | |
| if ( | |
| current.firstName === shouldBeFirst.firstName && |
| const users = [ | |
| { firstName: 'Jane', lastName: 'Foo' }, | |
| { firstName: 'John', lastName: 'Bar' }, | |
| { firstName: 'Jill', lastName: 'Err' } | |
| ] | |
| function findMatchingAndMoveToFirst (users, shouldBeFirst) { | |
| const reArrangedUsers = [] | |
| users.forEach(user => { |