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
pub struct AStruct { | |
x : uint | |
} | |
pub enum HasAStruct { | |
A(~AStruct) | |
} | |
pub fn getAStruct(a: </HasAStruct) -> </AStruct { | |
match *a { |
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
pub trait HasGet { | |
fn get(&self) -> int; | |
} | |
pub type struct_inr = @StructInr; | |
pub struct StructInr { | |
x : int | |
} | |
pub impl StructInr : HasGet { |
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
let maybe_it = match expanded { | |
mr_item(it) => fld.fold_item(it), | |
mr_expr(_) => cx.span_fatal(pth.span, | |
~"expr macro in item position: " | |
+ *extname), | |
mr_any(_, item_maker, _) => | |
option::chain(item_maker(), |i| {fld.fold_item(i)}), | |
MacroDef(ref mdef) => { | |
exts.insert((*mdef).name, (*mdef).ext); | |
None |
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
let maybe_it = match expanded { | |
mr_item(it) => fld.fold_item(it), | |
mr_expr(_) => cx.span_fatal(pth.span, | |
~"expr macro in item position: " | |
+ *extname), | |
mr_any(_, item_maker, _) => | |
option::chain(item_maker(), |i| {fld.fold_item(i)}), | |
MacroDef(ref mdef) => { | |
exts.insert((*mdef).name, (*mdef).ext); | |
None |
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
#lang racket | |
(require profile | |
(prefix-in gv: profile/render-graphviz)) | |
(define (f) | |
(sleep 0.5) | |
(+ (g) (h))) | |
(define (g) (sleep 0.5) 13) |
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
#lang racket | |
(require 2htdp/image | |
(only-in mred make-bitmap bitmap-dc% color% bitmap%) | |
(only-in 2htdp/private/image-more render-image) | |
rackunit) | |
;; return a portion of the alpha map for the image | |
(define (image->alpha/cropped image x y w h) | |
(define bm (make-object bitmap% w h #f #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
#lang racket | |
(require 2htdp/image | |
(only-in mred make-bitmap bitmap-dc% color%) | |
(only-in 2htdp/private/image-more render-image) | |
rackunit) | |
;; return a portion of the alpha map for the image | |
(define (image->alpha/cropped image x y w h) | |
(define bm (make-bitmap w h)) |
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
#lang racket | |
(require 2htdp/image | |
(only-in mred make-bitmap bitmap-dc%) | |
(only-in 2htdp/private/image-more render-image) | |
rackunit) | |
(define star1 (star-polygon 40 5 2 "solid" "seagreen")) | |
(define star2 (rotate 20 (star-polygon 40 5 2 "solid" "seagreen"))) |
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
#lang racket | |
(require (planet clements/rsound:4:4)) | |
(require (planet clements/rsound:4:4/single-cycle)) | |
(require (planet clements/rsound:4:4/network)) | |
(require (planet clements/rsound:4:4/reverb-typed)) | |
(require racket/flonum) | |
(define hi-tones | |
(for/list ([i 16]) |
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
#lang typed/racket | |
(require racket/flonum) | |
(require/typed (planet clements/rsound:4/network) | |
[#:struct network/s ([ins : Index] | |
[outs : Index] | |
[maker : Procedure])]) | |
;; this file provides the "reverb" network | |
(provide reverb) |