Skip to content

Commit

Permalink
Merge pull request #31 from clojerl/15-date-hour-functions
Browse files Browse the repository at this point in the history
[#15] Date and hour functions
  • Loading branch information
jfacorro authored Dec 2, 2018
2 parents 7b32003 + 7a131ad commit d416520
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
18 changes: 8 additions & 10 deletions docs/quil.core.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- [ ] [`ambient-light`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L325) - "Adds an ambient light"
- [ ] [`apply-matrix`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L346) - "Multiplies the current matrix by the one specified through the parameters"
- [x] [`arc`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L372) - "Draws an arc in the display window"
- [ ] [`arc-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [x] [`asin`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L394) - "The inverse of sin, returns the arc sine of a value"
- [x] [`atan`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L408) - "The inverse of tan, returns the arc tangent of a value"
- [x] [`atan2`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L423) - "Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis"
Expand Down Expand Up @@ -52,7 +51,7 @@
- [x] [`current-frame-rate`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1693) - "Returns the current framerate"
- [ ] [`current-graphics`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L32) - "Graphics currently used for drawing"
- [x] [`current-stroke`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1158) - "Return the current stroke color"
- [ ] [`cursor`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1169) - "Sets the cursor to a predefined symbol or makes it visible if already hidden (after no-cursor was called)"
- [ ] [`cursor`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1169) - "Sets the cursor to a predefined symbol or makes it visible if already hidden (after no-cursor was called)"
- [ ] [`cursor-image`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1190) - "Set the cursor to a predefined image"
- [ ] [`cursor-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [ ] [`curve`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1203) - "Draws a curved line on the screen"
Expand All @@ -61,10 +60,10 @@
- [ ] [`curve-tangent`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1260) - "Calculates the tangent of a point on a curve"
- [ ] [`curve-tightness`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1272) - "Modifies the quality of forms created with curve and curve-vertex"
- [ ] [`curve-vertex`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1290) - "Specifies vertex coordinates for curves"
- [ ] [`day`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1309) - "Get the current day of the month (1 through 31)"
- [x] [`day`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1309) - "Get the current day of the month (1 through 31)"
- [ ] [`debug`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4745) - "Prints msg and then sleeps the current thread for delay-ms"
- [x] [`defsketch`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4557) - "Define and start a sketch and bind it to a var with the symbol app-name"
- [ ] [`degrees`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1321) - "Converts a radian measurement to its corresponding value in degrees"
- [x] [`degrees`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1321) - "Converts a radian measurement to its corresponding value in degrees"
- [ ] [`delay-frame`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1338) - "Forces the program to stop running for a specified time"
- [ ] [`directional-light`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1356) - "Adds a directional light"
- [ ] [`display-density`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1588) - "This function returns the number 2 if the screen is a high-density screen (called a Retina display on OS X or high-dpi on Windows and Linux) and a 1 if not"
Expand All @@ -73,7 +72,6 @@
- [ ] [`do-record`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1393) - "Macro for drawing on graphics which saves result in the file at the end"
- [x] [`ellipse`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1414) - "Draws an ellipse (oval) in the display window"
- [ ] [`ellipse-mode`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1427) - "Modifies the origin of the ellispse according to the specified mode: :center - specifies the location of the ellipse as the center of the shape"
- [ ] [`ellipse-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [ ] [`emissive`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1449) - "Sets the emissive color of the material used for drawing shapes drawn to the screen"
- [ ] [`end-camera`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1465) - "Unsets the matrix mode from the camera matrix"
- [ ] [`end-contour`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1476) - "Use the begin-contour and end-contour function to create negative shapes within shapes"
Expand All @@ -97,7 +95,7 @@
- [ ] [`hint`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1819) - "Set various hints and hacks for the renderer"
- [ ] [`hint-options`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [ ] [`horizontal-alignment-modes`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L51)
- [ ] [`hour`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1889) - "Returns the current hour as a value from 0 - 23"
- [x] [`hour`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1889) - "Returns the current hour as a value from 0 - 23"
- [ ] [`hue`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1901) - "Extracts the hue value from a color"
- [ ] [`image`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1912) - "Displays images to the screen"
- [ ] [`image-filter`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1941) - "Originally named filter in Processing Language"
Expand Down Expand Up @@ -125,11 +123,11 @@
- [ ] [`map-range`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2297) - "Re-maps a number from one range to another"
- [ ] [`mask-image`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2313) - "Masks part of an image from displaying by loading another image and using it as an alpha channel"
- [x] [`millis`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2335) - "Returns the number of milliseconds (thousandths of a second) since starting the sketch"
- [ ] [`minute`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2348) - "Returns the current minute as a value from 0 - 59"
- [x] [`minute`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2348) - "Returns the current minute as a value from 0 - 59"
- [ ] [`model-x`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2360) - "Returns the three-dimensional x, y, z position in model space"
- [ ] [`model-y`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2375) - "Returns the three-dimensional x, y, z position in model space"
- [ ] [`model-z`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2390) - "Returns the three-dimensional x, y, z position in model space"
- [ ] [`month`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2405) - "Returns the current month as a value from 1 - 12"
- [x] [`month`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2405) - "Returns the current month as a value from 1 - 12"
- [ ] [`mouse-button`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2417) - "The value of the system variable mouseButton is either :left, :right, or :center depending on which button is pressed"
- [ ] [`mouse-pressed?`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2442) - "Variable storing if a mouse button is pressed"
- [ ] [`mouse-x`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2456) - "Current horizontal coordinate of the mouse"
Expand Down Expand Up @@ -195,7 +193,7 @@
- [ ] [`screen-x`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3505) - "Takes a three-dimensional x, y, z position and returns the x value for where it will appear on a (two-dimensional) screen, once affected by translate, scale or any other transformations"
- [ ] [`screen-y`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3518) - "Takes a three-dimensional x, y, z position and returns the y value for where it will appear on a (two-dimensional) screen, once affected by translate, scale or any other transformations"
- [ ] [`screen-z`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3531) - "Given an x, y, z coordinate, returns its z value"
- [ ] [`seconds`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3547) - "Returns the current second as a value from 0 - 59"
- [x] [`seconds`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3547) - "Returns the current second as a value from 0 - 59"
- [ ] [`set-image`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3585) - "Writes an image directly into the display window"
- [ ] [`set-pixel`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L3559) - "Changes the color of any pixel in the display window"
- [ ] [`set-state!`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L248) - "Set sketch-specific state"
Expand Down Expand Up @@ -257,4 +255,4 @@
- [ ] [`with-rotation`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4502) - "Performs body with rotation, restores current transformation on exit"
- [ ] [`with-stroke`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4455) - "Temporarily set the stroke color for the body of this macro"
- [ ] [`with-translation`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4484) - "Performs body with translation, restores current transformation on exit"
- [ ] [`year`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4401) - "Returns the current year as an integer (2003, 2004, 2005, etc)"
- [x] [`year`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L4401) - "Returns the current year as an integer (2003, 2004, 2005, etc)"
36 changes: 36 additions & 0 deletions src/doodler/core.clje
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,42 @@
[degrees]
(* DEG-TO-RAD degrees))

(defn degrees
[radians]
(* RAD-TO-DEG radians))

;; Day & hour

(defn hour
[]
(let* [#erl[hour _ _] (erlang/time)]
hour))

(defn minute
[]
(let* [#erl[_ minute _] (erlang/time)]
minute))

(defn seconds
[]
(let* [#erl[_ _ seconds] (erlang/time)]
seconds))

(defn day
[]
(let* [#erl[_ _ day] (erlang/date)]
day))

(defn month
[]
(let* [#erl[_ month _] (erlang/date)]
month))

(defn year
[]
(let* [#erl[year _ _] (erlang/date)]
year))

;; Numbers

(defn abs
Expand Down

0 comments on commit d416520

Please sign in to comment.