What I want is
enum Animal { Rabbit, Lizard }
fn do_rabbit(r: Animal::Rabbit) {}
fn do_lizard(l: Animal::Lizard) {}
fn chem(*reacs) $= | |
until @@complete { do lab: | |
lab.reflux ..reacs | |
} | |
chem &cc |
fn cost(points: &[[f64; 2]], center: &[f64; 2]) -> f64 { | |
points.iter().fold(0., |net, point| { | |
let cost = ( | |
(center[0] - point[0]).powi(2) // `x` coordinates | |
+ (center[1] - point[1]).powi(2) // `y` coordinates | |
).sqrt(); | |
net + cost | |
}) | |
} |
struct Delta { | |
x: [i8; 4], | |
y: [i8; 4], | |
} | |
fn geometric_center(points: &[[f64; 2]]) -> [f64; 2] { | |
const DELTA: Delta = Delta { | |
x: [-1, 0, 1, 0], // movement in `x` direction | |
y: [0, 1, 0, -1], // movement in `y` direction | |
}; |
#include <cmath> | |
#include <iostream> | |
#include <roth> | |
size_t class(roth::EffortMatrix difficulty, double time) | |
{ | |
double score = std::exp(difficulty.cost) / time; | |
return roth::linearizeCurve(score); | |
} |
fn hello(name: String) -> String { | |
format!("Hello, {}!", name) | |
} |
extern crate libc; | |
use std::ffi::{CStr, CString}; | |
use std::str; | |
use libc::c_char; | |
#[no_mangle] | |
pub extern "C" fn hello(raw_name: *const c_char) -> *const c_char { | |
// convert to Rust String | |
let name = str::from_utf8( |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
namespace: spark | |
name: my-notebook-deployment | |
labels: | |
app: my-notebook | |
spec: | |
replicas: 1 | |
selector: |
use rustc_lexer::{tokenize, Token, TokenKind}; | |
use std::io::{self, Read}; | |
enum Cmd { | |
Print(usize), | |
Space, | |
Skip(usize), | |
} | |
fn layout(toks: impl Iterator<Item = Token>) -> impl Iterator<Item = Cmd> { |
As evidenced in the discussions on Zulip (1, 2, 3) there are some cases where open and closed tags behave in a way that goes against people's intuition.
The main problem seems to be that people expect produced values to compose, but the "default" syntax (without *
) prohibits this. People understand the openness to mean whether all possible values are listed, not whether more values can be added "later". For example: Roc infers myValue = if True then One else Two
to be an open tag unio