Created
May 1, 2018 14:00
-
-
Save Sophia-Gold/b838ee9e2b2da5d11700ba7d3fec0fa2 to your computer and use it in GitHub Desktop.
Disassembling with Continuations
This file contains 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 core.clj | |
(:require [clojure.string :as str] | |
[fipp.edn :refer [pprint] :rename {pprint fipp}] | |
[com.positronic-solutions.pulley.cps :refer :all] | |
[no.disassemble :refer :all])) | |
(defn stacks [] | |
(->> disassemble | |
call-cc | |
str/split-lines | |
(filter #(re-find #"Stack" %)) | |
(map (comp (fn [s] (map #(Long/parseLong (re-find #"\d+" %)) s)) | |
#(str/split % #","))) | |
(map #(zipmap [:stack :locals] %)) | |
(sort-by :stack) | |
fipp)) | |
(defn get-cc [] | |
(call-cc | |
(fn [cc] | |
#(cc (conj [] %))))) | |
(defn read-cc [] | |
(-> (get-cc) | |
disassemble-data | |
fipp)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment