We move the effort into designing the type, so that writing the algorithm is simpler.
There is a relationship between monads and Hoare Logic. Can I solve the 9-jigsaw puzzle with Monads? https://en.wikipedia.org/wiki/Hoare_logic
We move the effort into designing the type, so that writing the algorithm is simpler.
There is a relationship between monads and Hoare Logic. Can I solve the 9-jigsaw puzzle with Monads? https://en.wikipedia.org/wiki/Hoare_logic
#!/bin/sh | |
############################################################ | |
# Create a simple working program. | |
############################################################ | |
cat <<EOF > Foo.elm | |
module Foo exposing (..) | |
type alias Foo = Int | |
EOF |
module Main exposing (..) | |
import Html exposing (..) | |
import Html.App exposing (beginnerProgram) | |
import Html.Events exposing (onClick, on, targetChecked) | |
type View | |
= Ascending | |
| Descending |
module Main exposing (..) | |
import Html exposing (..) | |
import Html.App exposing (beginnerProgram) | |
import Html.Events exposing (onClick, on, targetChecked) | |
type View | |
= Ascending | |
| Descending |
module Main (..) where | |
intersectingMagnitude : Line -> Position -> Angle -> List Length | |
intersectingMagnitude ( ( sx, sy ), ( sa, sm ) ) ( rx, ry ) ra = | |
let | |
sdx = | |
cos (degrees sa) | |
rdx = |
-- Both of these functions do the same thing: return some that, if given a DB connection, will return a list of records. | |
-- No type-checking, but obvious equivalence to SQL. | |
getPerson :: UUID -> SqlPersistM [Entity Person] | |
getPerson uuid = rawSql | |
rawSql "SELECT ?? FROM person WHERE person_id = ?" [uuid] | |
-- More DSL-ish, but more compile-time guarantees. | |
getPerson2 :: UUID -> SqlPersistM [Entity Person] | |
getPerson2 uuid = |
(defn stateful-view [] | |
(let [!form (reagent/atom {:name nil})] | |
(fn [ui-channel view-arg-1 view-arg-2] | |
[:form | |
[:input {:defaultValue (-> !form deref :name) | |
:onChange #(swap! !form assoc :name (.. % target value))}]]))) | |
(defn regular-view | |
[ui-channel app] | |
[:div |
var youtubeRegexp = /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube(?:-nocookie)?\.com\S*[^\w\s-])([\w-]{11})(?=[^\w-]|$)(?![?=&+%\w.-]*(?:['][^<>]*>|<\/a>))[?=&+%\w.-]*/gi; | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
console.log(youtubeRegexp.test("https://www.youtube.com/watch?v=o4nCcgWFEwU")); | |
// Prints true, false, true, false... |
(require 'cl-lib) | |
(require 'thingatpt) | |
(defun haskell-process-completions-at-point () | |
"A company-mode-compatible complete-at-point function." | |
(-when-let (process (haskell-process)) | |
(-when-let (symbol (symbol-at-point)) | |
(destructuring-bind (start . end) (bounds-of-thing-at-point 'symbol) | |
(let ((completions (haskell-process-get-repl-completions (haskell-process) | |
(symbol-name symbol)))) |
(ns schemaspeed.core | |
(require [schema.core :as s])) | |
(def S {:name s/Str | |
:age s/Int | |
:things [s/Int]}) | |
(def xs | |
(doall (repeat 100000 | |
{:name "somename" |