conlang: add lang items, remove Empty, and shuffle typeck
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
//! Implements format string evaluation in weak Conlang
|
||||
|
||||
fn f(__fmt: str) -> str {
|
||||
|
||||
/// Formats a string
|
||||
fn f(__fmt: &str) -> &str {
|
||||
let __out = "";
|
||||
let __expr = "";
|
||||
let __label = "";
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
// These two functions shouldn't actually be polymorphic, but
|
||||
// the AST interpreter doesn't know about type annotations
|
||||
// or operator overloading.
|
||||
#[generic("T")]
|
||||
pub fn max(a: T, b: T) -> T {
|
||||
pub fn max<T>(a: T, b: T) -> T {
|
||||
(if a < b { b } else { a })
|
||||
}
|
||||
|
||||
#[generic("T")]
|
||||
pub fn min(a: T, b: T) -> T {
|
||||
pub fn min<T>(a: T, b: T) -> T {
|
||||
(if a > b { b } else { a })
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ pub fn lfsr_next() {
|
||||
}
|
||||
|
||||
/// Returns a pseudorandom byte
|
||||
pub fn rand() -> u8 {
|
||||
pub fn rand() -> u64 {
|
||||
for _ in 0..8 {
|
||||
lfsr_next()
|
||||
}
|
||||
state & 0xff
|
||||
};
|
||||
(state & 0xff) as u64
|
||||
}
|
||||
|
||||
// Prints a maze out of diagonal box drawing characters, ['╲', '╱']
|
||||
|
||||
Reference in New Issue
Block a user