This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: configure.proto | |
| =================================================================== | |
| --- configure.proto (revision 35456) | |
| +++ configure.proto (working copy) | |
| @@ -2847,89 +2847,6 @@ | |
| fi | |
| dnl check for opengl libs. | |
| - AC_MSG_CHECKING(whether we can use the GL library) | |
| - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::marker::PhantomData; | |
| use std::cell::Cell; | |
| struct Scope<'s> { | |
| num: Cell<usize>, | |
| phantom: PhantomData<Cell<&'s mut ()>>, | |
| //ms: Vec<&'s mut i32>, <-- useful trick for understanding lifetimes | |
| } | |
| impl<'s> Scope<'s> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALU | |
| Sequence: name=ALUSeq | |
| SetInteger: name=SI00 | |
| Sequence: name=Seq.1 | |
| SetInteger: name=SI01 | |
| Sequence: name=Seq1. | |
| SetInteger: name=SI10 | |
| Sequence: name=Seq.1-2 | |
| SetInteger: name=SI11 | |
| Sequence: name=Decoder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::any::TypeId; | |
| use std::any::Any; | |
| fn wrap<F: Fn()+Any>(closure: F) -> extern "C" fn() { | |
| extern "C" fn wrapped<F: Any>() -> () { | |
| println!("Haven't written this yet! TypeId: {:?}", TypeId::of::<F>()); | |
| } | |
| println!("Storing closure {:?}", TypeId::of::<F>()); | |
| wrapped::<F> | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(type_macros)] | |
| struct Zero; | |
| struct Succ<T>(T); | |
| macro_rules! newtype { | |
| ($name_:ident) => { | |
| get_and_inc!($name_, Zero); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(specialization)] | |
| #![allow(dead_code)] | |
| struct Nil; | |
| struct Cons<H, T>(H, T); | |
| trait MayContain<T> { | |
| fn get(&self) -> Option<&T>; | |
| fn get_mut(&mut self) -> Option<&mut T>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(specialization)] | |
| #![allow(dead_code)] | |
| struct Nil; | |
| struct Cons<H, T>(H, T); | |
| struct Zero; | |
| struct Succ<T>(T); | |
| trait At<L> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(specialization)] | |
| #![allow(dead_code)] | |
| struct Here; | |
| struct There<T>(T); | |
| struct Nil; | |
| struct Cons<Head, Index, Tail>(Head, Index, Tail); | |
| trait ContainsAt<T, I> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![feature(specialization)] | |
| struct Foo; | |
| struct No; | |
| struct Yes; | |
| trait Bar { | |
| type Result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Demonstration that any Elixir "lens" (function compatible with get_in and get_and_update_in) is equivalent to a lens represented in get/set style | |
| # Modulo the fact that an Elixir lens cannot be written if there is no valid "get" operation | |
| defmodule Optics do | |
| defp id, do: fn x -> x end | |
| defp old_and_new(new), do: fn old -> {old, new} end | |
| def decompose(lens) do | |
| [get: fn(obj) -> lens.(:get, obj, id) end, | |
| set: fn(obj, new) -> lens.(:get_and_update, obj, old_and_new(new)) |> elem(1) end] |