Skip to content

Instantly share code, notes, and snippets.

@CarlSmotricz
CarlSmotricz / my-pmap.rkt
Last active December 28, 2016 11:47
A pmap function in Racket (Scheme)
#lang racket/base
(require racket/list
racket/future
future-visualizer
future-visualizer/trace)
; Objective: Building an equivalent to Clojure's PMAP .
; PMAP is a lot like MAP. As a first step, let's build our own MAP .
@CarlSmotricz
CarlSmotricz / PlaneOnATreadmill.markdown
Last active October 18, 2016 19:15
A detailed analysis of the "airplane on a treadmill" physics thought experiment.

I've done some research on the "POAT" question.

First, from various related discussions, a summary of the question and what I think are reasonable assumptions:

  • There's no trickery going on, i.e. the pilot is not intentionally holding back to help prevent takeoff. One of the pages I'll be citing wastes a lot of words on this point.

  • The brakes aren't being applied.

  • The treadmill's reverse speed is based on the forward ground ("solid" ground, not treadmill ground) speed of the aircraft (including its wheels as seen from the wheel's centre), not on "the speed of the wheels" as very ambiguously stated in the question as we saw it on FB.

    To understand why this would be a problem, consider that so long as the wheels are not slipping, the velocity of the bottom of each wheel will be exactly equal to the velocity of the treadmill surface, while the velocity of the top of the wheel will be (plane's forward ground speed + treadmill's backward speed), in the "forward" direction. That way lies madness.

@CarlSmotricz
CarlSmotricz / DavidA.java
Created September 9, 2015 19:19
A simple Java program demonstrating math with integers.
class Ideone
{
public static void main (String[] args)
{
int A, B, C, D;
A = 1; B = 2; C = 3; D = 4;
if (A + C == D) D = D - 2;
if (2 * D + 4 * A < 10) A = A + 4;
if (A + D > 3 * B + C) B = C - A;
@CarlSmotricz
CarlSmotricz / countries.clj
Created August 30, 2015 13:10
Some Clojure code to calculate frequencies for names of countries and cities in a given text.
(ns countries.core
(:use [clojure.java.io :only [reader]]
[clojure.string :only [lower-case join]]
[clojure.set :only [union]]))
; Regexp for a word in a city or country name.
; A country name may contain multiple words (space separated).
; African names may contain "!",
; Arabic names have lots of apostrophes (also backquotes),
; French (and other) names have hyphens.
@CarlSmotricz
CarlSmotricz / nanocad.clj
Created July 22, 2015 00:51
A tiny CAD-like program in Clojure. Uses SeeSaw for the GUI.
; a tiny, simple CAD program prototype in Clojure.
; Carl Smotricz, 2015-07-22
(ns nanocad.core
(:use [seesaw core graphics])
(:require [seesaw.mouse :refer [location]])
(:import [javax.swing AbstractAction]))
(def CANVAS-WIDTH 400)