Skip to content

Instantly share code, notes, and snippets.

Jeff Belgum JeffBelgum

Block or report user

Report or block JeffBelgum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
JeffBelgum /
Created Sep 26, 2014
Python list comprehensions in Rust
/// MIT license etc. etc.
/// Experimenting with Python-like list comprehensions.
/// An attempt to explore the possibility space for ergonomic improvements
/// in Rust that can come post v1.0. Notice that there are not type declerations.
/// Aside from the "c!" macro invocation, Rust allows for an exact copy of the
/// Python comprehension syntax.
View gist:7034013
#[deriving(Clone, Eq)]
struct Node<T> {
v: T,
next: @mut Option<Node<T>>
#[deriving(Clone, Eq)]
struct List<T> {
priv head: @mut Option<Node<T>>
JeffBelgum / list_push_fn
Last active Dec 25, 2015
Linked List push function
View list_push_fn
#[deriving(ToStr, Clone, Eq)]
enum List<T> {
Cons(T, @mut List<T>),
* from brson: it could be more efficient by avoiding that clone,
* since the cost of cloning a T could be arbitrary.
You can’t perform that action at this time.