Юрий Сыровецкий
type Respond = Response -> IO()
type Application = Request -> Respond -> IO()
myBaseApp(request)(respond) = do
foo(request)
if bar(request) then
respond(baz)
else do
respond(qux_part1)
respond(qux_part2)
type Middleware = Application -> Application
myApp = authenticator(logger(myBaseApp))
main = runServer(80, myApp)
const words = [
'spray', 'limit', 'elite', 'exuberant',
'destruction', 'present'
];
const result = words.filter(word => word.length > 6);
console.log(result);
// expected output:
// Array ["exuberant", "destruction", "present"]
db.withTransaction(tx -> {
tx.select(...);
tx.update(...);
});
const, constexpr, final, let, val
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = [x for x in fruits if "a" in x]
(SETL, 1969)
enum WebEvent {
PageLoad,
KeyPress(char),
Click { x: i64, y: i64 },
}
match event {
PageLoad => println!("page loaded"),
KeyPress(c) => println!("pressed '{}'.", c),
Click { x, y } => {
println!("clicked at x={}, y={}.", x, y);
},
}
struct Person {
string name;
int age;
};
struct Person {
BOOST_HANA_DEFINE_STRUCT(Person,
(string, name),
(int, age)
);
};
#define BOOST_HANA_PP_CONCAT(x, y) \
BOOST_HANA_PP_CONCAT_PRIMITIVE(x, y)
#define BOOST_HANA_PP_CONCAT_PRIMITIVE(x, y) \
x ## y
println!(
"{0}, this is {1}. {1}, this is {0}",
"Alice",
"Bob"
);
парсинг и специализация во время компиляции
|
|
|
|