Skip to main content

FutharkExpr

Enum FutharkExpr 

Source
pub enum FutharkExpr {
Show 34 variants IntLit(i64, FutharkType), FloatLit(f64, FutharkType), BoolLit(bool), Var(String), ArrayLit(Vec<FutharkExpr>), Index(Box<FutharkExpr>, Box<FutharkExpr>), Slice(Box<FutharkExpr>, Option<Box<FutharkExpr>>, Option<Box<FutharkExpr>>), Map(Box<FutharkExpr>, Box<FutharkExpr>), Map2(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Reduce(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Scan(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Filter(Box<FutharkExpr>, Box<FutharkExpr>), Zip(Box<FutharkExpr>, Box<FutharkExpr>), Unzip(Box<FutharkExpr>), Iota(Box<FutharkExpr>), Replicate(Box<FutharkExpr>, Box<FutharkExpr>), IfThenElse(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Lambda(Vec<(String, FutharkType)>, Box<FutharkExpr>), LetIn(String, Option<FutharkType>, Box<FutharkExpr>, Box<FutharkExpr>), Loop(String, Box<FutharkExpr>, String, Box<FutharkExpr>, Box<FutharkExpr>), BinOp(String, Box<FutharkExpr>, Box<FutharkExpr>), UnOp(String, Box<FutharkExpr>), Apply(Box<FutharkExpr>, Vec<FutharkExpr>), TupleLit(Vec<FutharkExpr>), RecordLit(Vec<(String, FutharkExpr)>), FieldAccess(Box<FutharkExpr>, String), Ascribe(Box<FutharkExpr>, FutharkType), Scatter(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Rotate(Box<FutharkExpr>, Box<FutharkExpr>), Transpose(Box<FutharkExpr>), Flatten(Box<FutharkExpr>), Unflatten(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>), Size(usize, Box<FutharkExpr>), With(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>),
}
Expand description

Futhark expression representation.

Variants§

§

IntLit(i64, FutharkType)

Integer literal: 42i32

§

FloatLit(f64, FutharkType)

Float literal: 3.14f64

§

BoolLit(bool)

Bool literal: true / false

§

Var(String)

Variable reference: x

§

ArrayLit(Vec<FutharkExpr>)

Array literal: [e1, e2, ...]

§

Index(Box<FutharkExpr>, Box<FutharkExpr>)

Array index: a[i]

§

Slice(Box<FutharkExpr>, Option<Box<FutharkExpr>>, Option<Box<FutharkExpr>>)

Array slice: a[lo:hi]

§

Map(Box<FutharkExpr>, Box<FutharkExpr>)

map f a

§

Map2(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

map2 f a b

§

Reduce(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

reduce op ne a

§

Scan(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

scan op ne a

§

Filter(Box<FutharkExpr>, Box<FutharkExpr>)

filter f a

§

Zip(Box<FutharkExpr>, Box<FutharkExpr>)

zip a b

§

Unzip(Box<FutharkExpr>)

unzip a

§

Iota(Box<FutharkExpr>)

iota n

§

Replicate(Box<FutharkExpr>, Box<FutharkExpr>)

replicate n x

§

IfThenElse(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

if cond then t else e

§

Lambda(Vec<(String, FutharkType)>, Box<FutharkExpr>)

Lambda: \\ x -> body

§

LetIn(String, Option<FutharkType>, Box<FutharkExpr>, Box<FutharkExpr>)

Let-in: let x = e in body

§

Loop(String, Box<FutharkExpr>, String, Box<FutharkExpr>, Box<FutharkExpr>)

Loop: loop (acc = init) for i < n do body

§

BinOp(String, Box<FutharkExpr>, Box<FutharkExpr>)

Binary operation: e1 op e2

§

UnOp(String, Box<FutharkExpr>)

Unary operation: op e

§

Apply(Box<FutharkExpr>, Vec<FutharkExpr>)

Function application: f a1 a2 ...

§

TupleLit(Vec<FutharkExpr>)

Tuple construction: (e1, e2, ...)

§

RecordLit(Vec<(String, FutharkExpr)>)

Record construction: {field = e, ...}

§

FieldAccess(Box<FutharkExpr>, String)

Field access: r.field

§

Ascribe(Box<FutharkExpr>, FutharkType)

Type ascription: e : t

§

Scatter(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

Scatter: scatter a is vs

§

Rotate(Box<FutharkExpr>, Box<FutharkExpr>)

rotate n a

§

Transpose(Box<FutharkExpr>)

transpose a

§

Flatten(Box<FutharkExpr>)

Flatten: flatten a

§

Unflatten(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

unflatten n m a

§

Size(usize, Box<FutharkExpr>)

Size expression: #(e)

§

With(Box<FutharkExpr>, Box<FutharkExpr>, Box<FutharkExpr>)

with update: a with [i] = v

Trait Implementations§

Source§

impl Clone for FutharkExpr

Source§

fn clone(&self) -> FutharkExpr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FutharkExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.