Java:
class Person {
private String firstName;
private String lastName;
public String getDisplayName() {
return firstName + " " + lastName;
}
import java.util.concurrent.Executors | |
import scala.concurrent.{ExecutionContext, Future} | |
object Main extends App { | |
val executorService = Executors.newFixedThreadPool(5) | |
implicit val executionContext: ExecutionContext = ExecutionContext.fromExecutorService(executorService) |
{-# LANGUAGE Haskell2010 | |
, FlexibleContexts | |
#-} | |
{-# OPTIONS -Wall #-} | |
module Main where | |
import Control.Monad | |
import Control.Monad.ST | |
import Data.List |
package aufgabe1; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.Callable; | |
public class MinMax<T extends Comparable<T>> { |
package com.simplaex.gist | |
import java.util.Objects | |
object ToString { | |
trait Formattable { | |
override def toString: String = { | |
val sb = new StringBuilder | |
for (field <- getClass.getDeclaredFields if !field.isSynthetic) { |
Java:
class Person {
private String firstName;
private String lastName;
public String getDisplayName() {
return firstName + " " + lastName;
}
<dev one> [7:20 PM]
yes!
go code immediately injects into the brain, no need to even read it 🙂
what a lovely language
[7:20 PM]
# tested on macOS, required GNU Parallel (`brew install parallel`) | |
src/test/test_unite --list_content 2>&1 | \ | |
grep -v -F ' ' | \ | |
awk '{ print "src/test/test_unite --run_test=" $0 " > /dev/null 2>&1 && echo - [x] " $0 " || echo - [ ] " $0 }' | \ | |
parallel -j 0 bash -c 2> /dev/null | \ | |
sort |
### Keybase proof | |
I hereby claim: | |
* I am scravy on github. | |
* I am scravy (https://keybase.io/scravy) on keybase. | |
* I have a public key ASDeIpZp4Noqd8mYAEpKe4FGE0opfrjJK1SoWGZsGE_xrAo | |
To claim this, I am signing this object: |
import Data.List (replicate) | |
main = getContents >>= (\x -> putStr (proc 0 x)) | |
space = ' ' | |
newline = '\n' | |
isOpening = \c -> case c of | |
'[' -> True | |
'{' -> True |
The C++ Core Guidelines recommend using lambda initialization for complex initialization: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-lambda-init
It gives the following reason:
Reason It nicely encapsulates local initialization, including cleaning up scratch variables needed only for the initialization, without needing to create a needless nonlocal yet nonreusable function. It also works for variables that should be const but only after some initialization work.
These examples use GCC 9.1 on x86-64
using -O2
.