Clojure error reporting is a problem. This gist contains examples of missed opportunities for a clear error message. Let's discuss how common scenarios can be improved, and get some "patch welcome" tickets out there with clearly defined expectations.
This file contains hidden or 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
;; Mike Erickson | |
(def cards (ref nil)) | |
(defn build-test-deck | |
[] | |
[[8 \S] [2 \C] [6 \C] [8 \D] [6 \H] [\A \H] [8 \C] [7 \H] [\A | |
\C] [2 \D] [\K \H] [10 \D] [4 \H] [6 \S] [2 \H] [\Q \H] [3 \D] [10 \S] | |
[3 \S] [1 \S] [\A \D] [9 \H] [\J \S] [4 \D] [1 \C] [\K \D] [2 \S] [1 | |
\H] [5 \C] [\K \C] [10 \H] [9 \D] [9 \C] [\J \D] [\Q \C] [7 \S] [7 \D] |
This file contains hidden or 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 is intended to be entered interactively one part at a time | |
;; Try to keep state manipulation separate from logic functions | |
;; deal can just take a current game and return a new game. | |
;; thanks to persistent data structures, we aren't penalized for doing so. | |
(defn deal | |
[game n hand] | |
(update-in | |
(update-in game [hand] concat (take n (:deck game))) | |
[:deck] |
This file contains hidden or 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
/** | |
* Polyhedrons which support subdivision. | |
* | |
* Vertices have 'smooth' normals, | |
* to make a sharp edge choose a material that uses face normals instead. | |
* | |
* @author [email protected] | |
* @author [email protected] | |
* @param radius | |
* @param detail Final number of triangles = 4^detail * X |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using DigitalIdeaSolutions.Collections.Generic; | |
using Newtonsoft.Json; | |
using ExitGames.Client.Photon.Lite; | |
using ExitGames.Client.Photon; | |
using System.Collections; | |
using System.Threading; |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Photon.SocketServer; | |
using PhotonHostRuntimeInterfaces; | |
using System.ComponentModel; | |
namespace PhotonGraphServer |
This file contains hidden or 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
; starting with the example you had https://gist.github.com/Engelberg/8141352 | |
(def rows 3) | |
(def cols 4) | |
(def cells (for [row (range rows), col (range cols)] [row col])) | |
(defn select-cells-by-row [row] | |
(filter (fn [[r c]] (= row r)) cells)) |
canvas: html
Hi!
Today we will build a rogue like game...
First we need to draw something on the "screen".
We do this by calling html
.
This file contains hidden or 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
;; load this example in a browser from this link: | |
;; http://app.klipse.tech/?container=1&cljs_in.gist=timothypratley/f55596fa4c39e9e8326b2cfec0ec4551 | |
(ns constrained.core | |
(:require [reagent.core :as reagent] | |
[goog.dom :as dom])) | |
(set! *warn-on-infer* true) | |
(defn collision? [x y w h other-rectangles] | |
(some |
This file contains hidden or 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
(ns scicloj.kindly-render.nrepl.cursive-kindly-render-middleware | |
(:require [nrepl.middleware :as middleware] | |
[nrepl.transport :as t] | |
[nrepl.middleware.interruptible-eval :as eval] | |
[nrepl.middleware.print :as print]) | |
(:import (nrepl.transport Transport))) | |
(defn eval* | |
"Returns a wrapping map with metadata information" | |
[form] |