News for hackers. Stuff that matters.
Re:Writing HTML with Racket and X-Expressions (2019) by didibus on Wednesday April 01, 2020 @01:08PM (#22751001)
Can someone explain the difference between an S-expression and an X-expression? Even after reading the blog post I'm not following, seem like the same thing to me.
Re:Writing HTML with Racket and X-Expressions (2019) by tartoran on Wednesday April 01, 2020 @02:35PM (#22752074)
Started dabling recently so Im not an expert on the subject, but from my understanding, Racket represents XML data as an X-expression. On the other hand symbolic expressions aka s-expressions are the syntactic elements of the Lisp programming language. Both programs and data are represented as s-expressions: an s-expression may be either an atom or a list. So x-expressions relate to XML
Re:Writing HTML with Racket and X-Expressions (2019) by soegaard on Thursday April 02, 2020 @05:44AM (#22757473)
Generating HTML is a common task. Over the years we have seen multiple approaches in the Racket community. Representing HTML as S-expressions is common. There is even two approaches in use `xexprs` and `sxml`.

There are other solutions, such as representing HTML as structures (often called records in other languages). This is what I prefer - this allows a little static checking. (See `scribble/html` or `urlang/html`).

Others prefer to work with `templates`.

My point got lost: There is more than one "Racket way" of working with html.

Re:Writing HTML with Racket and X-Expressions (2019) by soegaard on Thursday April 02, 2020 @05:37AM (#22757453)
X-expressions (as [1]) is simply a subset of S-expressions.

[1] https://docs.racket-lang.org/teachpack/2htdpbatch-io.html?q=...