From 985d23a52b76593a120adff5381c2df3a80fe298 Mon Sep 17 00:00:00 2001 From: HairyFotr Date: Wed, 23 Aug 2017 10:14:39 +0200 Subject: Fix a bunch of typos --- edn.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'edn.html.markdown') diff --git a/edn.html.markdown b/edn.html.markdown index ca04df89..79107269 100644 --- a/edn.html.markdown +++ b/edn.html.markdown @@ -32,7 +32,7 @@ false "hungarian breakfast" "farmer's cheesy omelette" -; Characters are preceeded by backslashes +; Characters are preceded by backslashes \g \r \a \c \e ; Keywords start with a colon. They behave like enums. Kind of @@ -42,7 +42,7 @@ false :olives ; Symbols are used to represent identifiers. They start with #. -; You can namespace symbols by using /. Whatever preceeds / is +; You can namespace symbols by using /. Whatever precedes / is ; the namespace of the name. #spoon #kitchen/spoon ; not the same as #spoon -- cgit v1.2.3 From 25eca3c52781c7be94b088fa6edaad8d7815aa6d Mon Sep 17 00:00:00 2001 From: Jonathan D Johnston Date: Thu, 7 Sep 2017 19:34:29 -0400 Subject: [edn,en] Improve initial description of EDN --- edn.html.markdown | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'edn.html.markdown') diff --git a/edn.html.markdown b/edn.html.markdown index 79107269..04346eb8 100644 --- a/edn.html.markdown +++ b/edn.html.markdown @@ -3,13 +3,16 @@ language: edn filename: learnedn.edn contributors: - ["Jason Yeo", "https://github.com/jsyeo"] + - ["Jonathan D Johnston", "https://github.com/jdjohnston"] --- Extensible Data Notation (EDN) is a format for serializing data. -The notation is used internally by Clojure to represent programs. It is also -used as a data transfer format like JSON. Though it is more commonly used in -Clojure, there are implementations of EDN for many other languages. +EDN is a subset of the syntax used by Clojure. Reading data defined by EDN is +safer than that defined by the full Clojure syntax, especially from untrusted +sources. EDN is restricted to data, no code. It is similar in intent to JSON. +Though it is more commonly used in Clojure, there are implementations of EDN +for many other languages. The main benefit of EDN over JSON and YAML is that it is extensible. We will see how it is extended later on. -- cgit v1.2.3 From 1e97fa343304c7b1f6ff0bbe6f79ed521b33ad92 Mon Sep 17 00:00:00 2001 From: Adam Frey Date: Fri, 20 Oct 2017 14:50:20 -0400 Subject: [edn] Fix incorrect format for EDN symbols EDN symbols do not start with a # character --- edn.html.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'edn.html.markdown') diff --git a/edn.html.markdown b/edn.html.markdown index 04346eb8..9ecfb24f 100644 --- a/edn.html.markdown +++ b/edn.html.markdown @@ -44,13 +44,13 @@ false :cheese :olives -; Symbols are used to represent identifiers. They start with #. +; Symbols are used to represent identifiers. ; You can namespace symbols by using /. Whatever precedes / is -; the namespace of the name. -#spoon -#kitchen/spoon ; not the same as #spoon -#kitchen/fork -#github/fork ; you can't eat with this +; the namespace of the symbol. +spoon +kitchen/spoon ; not the same as spoon +kitchen/fork +github/fork ; you can't eat with this ; Integers and floats 42 -- cgit v1.2.3 From d86597d4991b907f3d1940daf9ce97ca0ecf68dd Mon Sep 17 00:00:00 2001 From: Jonathan D Johnston Date: Sat, 21 Oct 2017 20:33:14 -0400 Subject: Improve the "Tagged Elements" section of EDN doc - Change Clojure code to eliminate errors and to match commented output > Change edn/read-string to clojure.edn/read-string (no _require_ in text) > Change map->menu-item to map->MenuItem to match defrecord and output - Modify the text to make it easier to understand the given example --- edn.html.markdown | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'edn.html.markdown') diff --git a/edn.html.markdown b/edn.html.markdown index 9ecfb24f..f47853f0 100644 --- a/edn.html.markdown +++ b/edn.html.markdown @@ -84,22 +84,26 @@ github/fork ; you can't eat with this #MyYelpClone/MenuItem {:name "eggs-benedict" :rating 10} -; Let me explain this with a clojure example. Suppose I want to transform that +; Let me explain this with a Clojure example. Suppose I want to transform that ; piece of EDN into a MenuItem record. (defrecord MenuItem [name rating]) -; To transform EDN to clojure values, I will need to use the built in EDN -; reader, edn/read-string +; defrecord defined, among other things, map->MenuItem which will take a map +; of field names (as keywords) to values and generate a user.MenuItem record -(edn/read-string "{:eggs 2 :butter 1 :flour 5}") +; To transform EDN to Clojure values, I will need to use the built-in EDN +; reader, clojure.edn/read-string + +(clojure.edn/read-string "{:eggs 2 :butter 1 :flour 5}") ; -> {:eggs 2 :butter 1 :flour 5} -; To transform tagged elements, define the reader function and pass a map -; that maps tags to reader functions to edn/read-string like so +; To transform tagged elements, pass to clojure.edn/read-string an option map +; with a :readers map that maps tag symbols to data-reader functions, like so -(edn/read-string {:readers {'MyYelpClone/MenuItem map->menu-item}} - "#MyYelpClone/MenuItem {:name \"eggs-benedict\" :rating 10}") +(clojure.edn/read-string + {:readers {'MyYelpClone/MenuItem map->MenuItem}} + "#MyYelpClone/MenuItem {:name \"eggs-benedict\" :rating 10}") ; -> #user.MenuItem{:name "eggs-benedict", :rating 10} ``` -- cgit v1.2.3