Numbers

Numbers are stored as integers or ratios (numerator and denominator) when possible, using an internal BigNumber library. This allows it to perserve fractions when possible.

  • rand : random numbers. ()->[0,1], (max)->[0,max], (min,max)->[min,max]
  • sin , cos , tan : the usual trig functions, in radians or degrees.
  • add , mul , etc. function implementations of the standard math operations.
  • as , converts number to specified unit.
  • pow , power. 5^2 = pow(5,2)
  • exp , e^n
  • sqrt , square root
  • max , min , max and min of the arguments. Works with scalars and lists and lambda to pull out sub-part to compare
  • random_integer(max) : returns a random number between 0 and the max
  • randomreal or randomfloat ?
  • is_prime return true if number is prime
  • sign sign of the argument. returns -1, 0, or 1
  • still needed: absolute value, round, floor and ceiling, natural log, log base 10, more trig functions. truncate? fract to get the fractional part of a number? convert between radians and degrees.
  • Lists

  • range : generate a list of numbers: (max), (min,max), (min,max,step)
  • map : convert every element in a list using a lambda function: (list, lam)
  • for : loops over every element in a list with a lambda, but returns the original list: (list, lam)
  • sort : sort list returning a new list, by: property to use for sorting sort(data by:"date") (should we use order instead?)
  • take : take the first N elements from a list to make a new list take([1,2,3], 2) = [1,2]
  • drop : return list with the number of elements removed from the start. drop([1,2,3],1) = [2,3]
  • pick : take random elements from list pick(data,5) get five random elements
  • reverse : return a list with the order reversed reverse(data)
  • select : select items from list using where: lambda function returning false. select(data, where=(t)=>t.amount>0)
  • join : concatenate two lists, returning a new list.
  • length : returns the length of the list
  • sum : adds all data points together
  • charts

  • plot : lot a list of numbers as a scatter plot. x is the index in the list. y is the value of each number. can also plot equations as lambdas. __type__: `point | line | number` point: draw each datum as a point line: draw lines connecting all of the points number: draw points on a number line
  • chart :
  • type : bar, pie, stacked?
  • histogram : draws a histogram of the data
  • Strings

    Unlike in the Wolfram language, you don't need separate functions for strings. They will act as lists of characters so take , length , join , etc will work just fine.

  • string , make a string literal. same as doing "some words here" . Maybe it should be text instead?
  • length : works on strings too
  • to_upper_case , to_lower_case , capitalize transform between cases. returns new strings.
  • characters : splits into a list of single char strings
  • Graphics

    Standard 2D graphics using the PDF / Canvas / SVG imaging model. Lengths and points may be specified with units, like rect(width=2cm, height=1ft) . If no units are supplied then it is assumed to be pixels.

  • point : a two component vector point(25,50) === [25,50]
  • anywhere an xy pair can be used, a point can be used as well.
  • draw : draws lists/nested lists of shapes. optionally set size of the canvas area
  • circle : a circle shape with center, radius, and fill
  • rect : a rect shape with width, height, position and fill rect(width=100, height=50)
  • regular_polygon : an N-gon. ex: regular_polygon(5) = pentagon. accepts fill and center position.
  • pack_row : packs shapes in a row, centered vertically
  • pack_col : packs shapes in a column, centered horizontally. works on shapes, scalars and other elements.
  • pack_grid : packs shapes in grid of the specified size.
  • draw_geomap : draws a geo map
  • address_to_geo : converts a street address to a geo coordinate (US addresses only)
  • color : make a color. accept strings, hex RGB triplets, and keywords for red,green,blue, hue,saturation,value, or hue, saturation, lightness. supports abbreviations too. and all CSS named strings. Maybe split into RGB and HSV color functions?
  • line_path : a polyline, may or may not be closed. may or may not be filled. only lines (no curves). specify a list of xy pairs as points.
  • curve_path : a path made of bezier curves
  • Images

  • CameraImage : takes an image from the camera, if available.
  • Image : get an image from a url
  • ColorNegate: invert the colors in the RGB colorspace
  • grayscale: convert to grayscale using RGB colorspace and standard grayscale conversion function
  • Blur make a blurred version of the image. optionally give box size
  • histogram: make a histogram of the colors in the image
  • posterize: reduce the number of colors in the image
  • edge detect: sokal edge detection kernel
  • blend: combine two images using standard blend modes
  • Dates and Time

    For the most part dates and time are just scalars with units. You can create a datetime, do simple arithmetic with it, and convert between timezones. There are three types: Dates, Times, and DateTimes.

  • Now : DateTime representing right now.
  • Today , Tomorrow , Yesterday : dates representing these days.
  • Date : create a new date from a string. optionally specify a format
  • Time : create a new time from a string. optionally specify a format.
  • DateTime : create a new date-time from a string. optionally specify a format.
  • Maybe

  • DayName, DayRange, MoonPhase, Sunset, Sunrise, LocalTime, AirTempperatureData,
  • sound

    Deferring for now.

    Tables or lists of lists or multi-dimensional arrays

    I need to do more work on this. Follow APL's lead here about shape and rank. examples:

  • make a times table from 1 to 12
  • make a 16x16 grayscale image from random numbers
  • the same with random colors instead of grayscale
  • GeoData

    Calculate geographical locations and draw maps. The basics are easy but this requires more thought about how this would actually be used, and where the map data comes from. Could we actually do something like show the 30 nearest volcanos?

  • GeoPositon: a lat lon
  • GeoMap: draws list of GeoPositions on a map. automatically scales to show all
  • GeoDistance: distance between two positions using great circle math
  • GeoPath, circle paths between lat lons, draw on the map.
  • GeoCircle: radius around a geo point.
  • GeoHere: attempts to detect your current location.
  • GeoNearest: find points of interest nearest to a location? This needs a lot more thought.
  • Constants

  • Pi
  • GoldenRatio / Phi
  • e, eulers number
  • square root of 2?
  • square root of 1/2?
  • i, imaginary unit, sqrt(-1)?
  • natural logarihm of 2?
  • g: force of gravity on earth?
  • data access

  • Wikipedia() returns wikipediat article as text (what kind of text? HTML? markdown? JSON?)
  • Dictionary() returns definition of word as text or json or other?
  • Weather() returns current and historical weather for a location
  • Silly(") datasets from silly.io, including: US states w/ dates, flags, abbreviations, capital cities, etc. lat/lon center, border, Countries of the world including: english name, local name, population, ISO code, primary language, flags, etc. planets and moons in the solar system including: mass, radius, orbital period, rotational period, albedo, photos, and more. cities: major US cities buildings: tallest buildings in the world
  • Questionable

  • IntegerDigits : split number into list of single digits. IntegerDigits(4200) = [4,2,0,0]
  • count : number of times element appears in the list. count(list,'foo') . Is this useful?
  • first , last : return the first or last elements of the list. can't we use take(data,n) .
  • rest return the list minus the first element
  • part : wolfram uses part for array element selection. is this easier than data[n] indexing?
  • ColorNegate wolfram uses this to find a complientary color, but I think it's only using the hue.
  • wolfram: Blend mixes colors. Couldn't we do it with math?
  • wolfram: RandomColor vs making colors with random values in the constructor
  • wolfram: Style to style the output with colors and font sizes. Not clear what the 'output' is in these cases, since it could be anything. Really it's styling the output panel in the interface. I'm unsure about this.
  • wolfram: filled versions of shapes, like Disc vs Circle .
  • 3d graphics like sphere, cone, cylinder, and 3d plots.
  • ImageCollage: group multiple images together. I feel like there must be a better way to do this.
  • DominantColors: to return list of dominant colors in the image. It feels like this should be part of generating a full color histogram.
  • TextWords returns list the english words in the string. ignores punctuation.
  • TextSentences returns list of sentences in the string.
  • WordCloud. I've never needed to use one of these.
  • RomanNumeral: convert number to roman numerals. why?
  • IntegerName, the number as english text. 42 = 'forty-two'. why?
  • Alphabet: list of every letter. maybe useful?
  • LetterNumber, index in the alphabet of the letter.
  • FromLetterNumber, alphabet number to letter
  • WordFrequency calculations
  • Rasterize: turns text into an image using a particular style (font, size, color?)
  • Rotate: to rotate graphics. I need to think more about how this will work.
  • AnglePath: a way to do LOGO style turtle graphics.
  • currency conversion. Do people really care about this without having a date context?
  • Graphs. I'm not sure working with directed and undirected and weighted graphs is needed right now.
  • Machine Learning: definitely not ready for this yet.
  • how to do complex numbers?
  • polar plotting?
  • apply functions repeatedly through iteration and recursion as Wolfram does. Good for fractals?