Mediascripting on the Web (CSC 195 2014F) : Readings

An Introduction to psaifr


We consider the basics of using psaifr, a small Racket library for exploring aspects of problem solving, abstract images, and functions. psaifr is a small experiment to ground a broader research project in math over images (currently planned for summer 2014).

Introduction

A Short Example

#lang racket
(require psaifr)
(define f1 '(+ x y))
(define f2 '(* x y))
(define f3 `(sign ,f2))
(define f1-small (psaifr-greyscale-image (makefun f1) 100 100))
(define f2-large (psaifr-greyscale-image (makefun f2) 400 400))
(define f3-wide (psaifr-greyscale-image (makefun f3) 200 100))

Reference

Primary Racket Procedures

Image Functions

Nullary (Zero-Parameter) Functions

A number (-1, 1/2, 0, 0.56, 1, ...)
An image that is just in that color.
x
An image that ranges from black (-1) at the left to white (1) at the right.
y
An image that ranges from black (-1) at the top to white (1) at the bottom.
second
-1 at the start of the current minute; 1 at the end of the current minute. (Currently recomputed with ...)
mouseX [unimplemented]
The x coordinate of the mouse (converted to the range [-1 .. 1]).
mouseY [unimplemented]
The y coordinate of the mouse (converted to the range [-1 .. 1]).
clickX [unimplemented]
The x coordinate of the last position the mouse was clicked (converted to the range [-1 .. 1]).
clickY [unimplemented]
The y coordinate of the last position the mouse was clicked (converted to the range [-1 .. 1]).

Unary Functions

sign
The sign of its input value. Negative numbers go to -1 (black). Positive numbers go to 1 (white). Zero says 0 (middle grey).

Binary Functions

*
The product of its parameters.
add
The sum of its parameters (restricted to [-1 .. 1]).
rotate
The first parameter rotated by the second parameter (effectively addition that wraps around from 1 to -1 or vice versa).

Copyright (c) 2014 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.