Received: by 10.140.161.21 with HTTP; Fri, 22 Feb 2008 06:35:48 -0800 (PST)
Message-ID: <[email protected]>
Date: Fri, 22 Feb 2008 09:35:48 -0500
From: "Antony Courtney" <[email protected]>
To: "Conal Elliott" <[email protected]>
Subject: Re: Fruit
Cc: Yampa-Users <[email protected]>
In-Reply-To: <[email protected]>
MIME-Version: 1.0
This file contains 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
-- This should all work with the DuckDb shell CLI, available from https://duckdb.org/docs/installation/index | |
-- (Select the CLI tab) | |
-- first create a view on the Parquet file: | |
CREATE VIEW books AS SELECT * from './goodreads_books.parquet'; | |
-- take a look at the schema: | |
PRAGMA table_info(books); | |
-- Fix up one of the columns (book_id), converting it from VARCHAR to INTEGER (int32): |
This file contains 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
/* @flow */ | |
/* Paste this into https://flow.org/try/ to see the bug: */ | |
const f = (lut: ?{[key: string]: number}): number => { | |
// This correctly notices that we're doing a null check on lut: | |
const testKey = 'fizz' | |
const y = (lut != null) ? lut[testKey] : 0 | |
This file contains 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
/* @flow */ | |
import * as Immutable from 'immutable' | |
/** | |
* A timer object for use in OneRef-based immutable state | |
* | |
*/ | |
export type TimerUpdater = (f: (ts: Timer) => Timer) => void |
This file contains 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
A really simple interpreter to use while learning about monads. Based on | |
the paper "Monads for Functional Programming" by Phil Wadler. | |
the type of terms: | |
> data Term = Con Int | |
> | Div Term Term | |
> deriving Show |
This file contains 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
-- | |
-- Some experiments with a Picture type based on an attribute-grammar | |
-- model of Layout | |
module FunPic where | |
import Haven | |
-- A type for representing the dimensions of a rectangle, as (width,height) | |
type Dimension = (Double,Double) |
Consider the following user interface (inspired by Strava) for looking at time-series charts of network data:
Notes on this interface and my Rx implementation of it:
- Each chart (stacked vertically) charts a different metric (latency, packet loss and throughput) but over the same time period.
- As the user moves the mouse left and right on any chart, the vertical line (called the tracker) moves to track the mouse position on all charts. The number displayed in the gray box on the right is the value underneath the tracker for that metric.
This file contains 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
import Color exposing (..) | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
import List exposing (..) | |
import Signal exposing (..) | |
import Time exposing (..) | |
import Array | |
-- a square of the given width and color: | |
square : Float -> Color -> Form |
This file contains 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
function invokeLater(f) { | |
window.setTimeout(f, 0); | |
} |
This file contains 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
export function scroll(scrollAmount,updater) { | |
updater((prevState) => { | |
const {nextState, oldRequests} = prevState.scrollAdjust(scrollAmount); | |
oldRequests.forEach((req) => req.abort()); // cancel old requests | |
// Need invokeLater since we're within updater | |
invokeLater(() => fillView(nextState,updater)); | |
return nextState; | |
}); | |
} |
NewerOlder