I recently watched Chris Houser's talk from Clojure/conj 2015 on condition systems in Clojure. I enjoyed the subject, so I decided to write up the talk as a way of encouraging me to really understand it, and in the hope that it might help others understand it.
The last time I heard about Common Lisp's condition system was at a talk by Didier Verna at ACCU in Bristol in 2013 (slides here). It sounded really interesting, but I didn't understand it well enough.
Chris Houser talks about different ways of handling errors in Clojure. Based on examples from Peter Seibel's book, Practical Common Lisp, he describes condition systems, which are also known as resumable exceptions, or restarts.
locals { | |
most_calories = reverse([for elf_calories in sort([for elf_calories in split(" ", replace(file("input1.txt"), "\n", " ")) : format("%08d", sum([for food_calories in split(" ", elf_calories) : food_calories == "" ? 0 : parseint(food_calories, 10)]))]) : tonumber(elf_calories)])[0] | |
} | |
output "answer" { | |
value = local.most_calories | |
} |
(require '[clojure.core.async :as async refer [<! go timeout]) | |
(defn sleepy-val | |
[v t] | |
(go (<! (timeout t)) v)) | |
;; Will this produce [1 2 3 1.5 2.5 3.5] or [1 1.5 2 2.5 3 3.5]? | |
(go | |
(prn (<! (async/into [] | |
(async/merge [(.async/merge [(sleepy-val 1 1000) |
This talk was given by Gregor Kiczales of Xerox PARC at OOPSLA ’94, 10/26/94. © 1994, University Video Communications. A transcript, with point- and-click retrieval of the slides, is available at http:/www.xerox.com/PARC/spl/eca/oi/gregor-invite/gregor- transcript.html
I think our field will go through a revolution. We will fundamentally change the way we think about and use abstraction in the engineering of software.
The goal of this talk is to summarize the need for and the basic nature of this abstraction framework.
The change is not new problems or new systems, but a new way of thinking about existing problems and existing systems.
;; Original example (in Javascript) at: http://code.shutterstock.com/rickshaw/examples/lines.html | |
(def graph-with-legend | |
(let [series-data (array (array) (array) (array)) | |
random (Rickshaw.Fixtures.RandomData. 150)] | |
(dotimes [i 150] | |
(.addData random series-data)) | |
(doto | |
(Rickshaw.Graph. (clj->js {:element (.getElementById js/document "chart") | |
:renderer "line" | |
:width 960 |
(ns cljsaudio.core | |
(:require [goog.net.XhrIo] | |
[cljs.core.async :as async :refer [<! >! chan close!]]) | |
(:require-macros [cljs.core.async.macros :refer [go]])) | |
(defn decode-audio-data | |
[context data] | |
(let [ch (chan)] | |
(.decodeAudioData context | |
data |
http://csunplugged.org/sorting-networks
communication
https://pwlconf.org/2018/roopsha-samanta/
Clarke and Emerson - Design and Synthesis of Sychnronization Skeletons using Branching-Time Temporal logic - Workshop on Logics of Programs (1981)
Processes are Finite-state synchronization skeletons - supress details about synchronization Communication model: Shared memory, interleaving based - one thread takes a step at a time Specification: Temporal logic Synchronization: Guarded commands
{-# LANGUAGE FlexibleContexts #-} | |
module Main where | |
import Java | |
import Java.Do | |
main :: IO () | |
main = putStrLn $ | |
mconcat $ | |
fmap (\x -> let _ = x :: JInteger in show x) $ |