Convert a long phrase to its acronym
import java.util.function.Supplier;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Collectors; | let | |
| Source = fxRandomNumbers(12) | |
| in | |
| Source |
Convert a long phrase to its acronym
import java.util.function.Supplier;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Collectors; | (message as text) as text => | |
| let | |
| yelling = Text.Upper(phrase) = phrase and Text.Lower(phrase) <> phrase, | |
| question = Text.EndsWith(phrase, "?"), | |
| phrase = Text.Trim(message) | |
| in if phrase = "" then | |
| "Fine. Be that way!" | |
| else if yelling and question then | |
| "Calm down, I know what I'm doing!" | |
| else if yelling then |
| IntStream ints = rangeClosed(1, 20); | |
| IntPredicate fizz = i->i%3==0; | |
| IntPredicate buzz = i->i%5==0; | |
| IntPredicate fizzBuzz =... | |
| assertThat(ints.filter(fizzBuzz)) | |
| .containsExactly(4,7,8,9,13,14,19); |
| #!/usr/bin/env bash | |
| # | |
| # Copyright (c) 2023 Jegors Čemisovs | |
| # License: MIT | |
| # Repository: https://github.com/rabestro/gpt4-session-to-markdown | |
| # | |
| # Converts GPT-4 chat session JSON data to markdown format and | |
| # adds YAML front matter to the top of the file to prepare it | |
| # for publishing on the Jekyll site. | |
| # |
| func Hey(remark string) string { | |
| remark = strings.TrimSpace(remark) | |
| if remark == "" { | |
| return "Fine. Be that way!" | |
| } | |
| isQuestion := strings.HasSuffix(remark, "?") | |
| isYelling := strings.ToUpper(remark) == remark && strings.ToLower(remark) != remark |
| // Package bob implements a solution for the bob exercise from the Exercism Go track. | |
| package bob | |
| // Hey takes a message as input, and returns Bob's response to that remark. | |
| func Hey(message string) string { | |
| remark := newRemark(message) | |
| switch { | |
| case remark.isSilence(): | |
| return "Fine. Be that way!" |
| package bob | |
| import ( | |
| "strings" | |
| "unicode" | |
| ) | |
| type Remark string | |
| func newRemark(remark string) Remark { |
| // Package romannumerals provides methods for manipulating numbers into roman numerals | |
| package romannumerals | |
| import "errors" | |
| type RomanNumeral struct { | |
| Value int | |
| Symbol string | |
| } |
| package com.epam.flipflop; | |
| import org.junit.jupiter.api.Test; | |
| import static org.junit.jupiter.api.Assertions.assertFalse; | |
| import static org.junit.jupiter.api.Assertions.assertTrue; | |
| import java.util.function.Predicate; | |
| class CopilotTest { | |
| @Test |