greg
2018-4-23 14:17:35

Fun fact: Anything between a pair of \| is a valid identifier. For instance the following is a valid program that prints 42: (define \| () [] {} `'," \ \| 42) \| () [] {} `'," \ \|


greg
2018-4-23 14:18:22

Not that I recommend doing this.


greg
2018-4-23 14:19:46

I also don’t recommend submitting bug reports about any possible syntax-highlighting weirdness in racket-mode. :grin:


slack1
2018-4-23 17:31:17

ah I see


slack1
2018-4-23 17:35:46

Perhaps this is just syntax salad, but is an atom a value?


lexi.lambda
2018-4-23 17:44:57

an “atom” isn’t a term of art in Racket.


slack1
2018-4-23 17:48:12

Does Racket just say “values” and “types”?


lexi.lambda
2018-4-23 17:49:26

“type” isn’t really a term of art, either (unless you’re talking about Typed Racket or something like that), though it is used (unlike “atom”), so people would know what you mean.


slack1
2018-4-23 17:53:43

how about,


slack1
2018-4-23 17:53:53

Racket has values that can be categorized into datatypes


slack1
2018-4-23 17:54:03

and Racket evaluation involves “expressions”


slack1
2018-4-23 17:55:59

which are lists of either values, or more expressions


dedbox
2018-4-23 18:10:18

@slack1 An atom is just an “indivisible” s-expression component. For a language with s-expression syntax, the parser decides exactly what that means.


slack1
2018-4-23 18:10:53

Yeah I decided to discard that term since Racket doesn’t use it, I was looking at some wrong slides I guess


slack1
2018-4-23 18:11:05

I know it’s a bit pedantic, but I wanted to get my phrasing right


dedbox
2018-4-23 18:12:53

It’s perfectly fine to use the word “atom” when speaking in the abstract.


lexi.lambda
2018-4-23 18:13:51

I don’t think Racketeers have a precise definition of the term, so I don’t think it’s a good term to use (there are plenty of better ones to use)


dedbox
2018-4-23 18:18:03

Would you say the same about the term “s-expression”?


slack1
2018-4-23 18:18:59

Is that the same thing as an expression?


slack1
2018-4-23 18:19:59

(with nested lists?)


samth
2018-4-23 18:20:07

@dedbox “indivisible” is a bit weird, though — does it include hash tables or prefab structs?


slack1
2018-4-23 18:21:07

I understood it to mean that when I have an expression like (foo bar), then the reader doesn’t separate f o o, but considers it “one thing”


slack1
2018-4-23 18:21:20

(for atom)


dedbox
2018-4-23 18:22:47

ok, an s-expresion can defined recursively as an atom or any pair of s-expressions.


dedbox
2018-4-23 18:23:12

so an atom is any non-pair bit of syntax


lexi.lambda
2018-4-23 18:23:22

is a vector an atom?


dedbox
2018-4-23 18:25:18

@samth “indivisible” would not include hash tables or prefab structs because those are Racket constructs and not bits of syntax. Their s-expression representations are certainly not atoms.


lexi.lambda
2018-4-23 18:25:35

You can absolutely have hash tables or prefab structs in syntax.


samth
2018-4-23 18:25:48

I think this is why @lexi.lambda said that it’s not as clear a term as you’d want


lexi.lambda
2018-4-23 18:26:08

I think Racketeers have a well-agreed upon definition of what an s-expression is, and the technical definition is essentially anything that can be marshalled to bytecode (which happens to include vectors, hash tables, prefab structs, regexes, and paths, by the way). I don’t think Racketeers agree on what an atom is, so I would recommend avoiding it.


dedbox
2018-4-23 18:27:07

I think we’re conflating the concept of an s-expression with how Racket implements them.


lexi.lambda
2018-4-23 18:27:37

I don’t think an s-expression is well-defined outside of a particular context. I’m only giving recommendations about using terms within the Racket community if you want people to understand you.


slack1
2018-4-23 18:28:03

yes, I’m trying to figure out canonical language as well


lexi.lambda
2018-4-23 18:29:08

You can certainly always prefix a comment by saying something like “I want to recognize atomic values, which in my case are strings, symbols, numbers, and booleans…” and then go onto describe some problem by using “atom” as an abbreviation. But people don’t agree on such a standard, so using the word “atom” on its own without any such clarification will almost certainly lead to multiple interpretations of your statement, which I generally consider an unwanted outcome.


slack1
2018-4-23 18:33:01

How about Racket is a language of expressions, which are lists of values or more expressions


slack1
2018-4-23 18:33:12

If there are more expressions inside, then those can ultimately be reduced to values


slack1
2018-4-23 18:33:52

Values can be categorized into datatypes, such as numbers, booleans, etc.


lexi.lambda
2018-4-23 18:36:53

Given that lists are themselves values, I don’t think that makes too much sense. I think it makes sense to distinguish between programs and their runtimes. A program is made out of expressions and syntactic forms, and expressions are evaluated to produce values. There are names that describe certain values, like “number”, “string”, “boolean”, “list”, “vector”, and many more. Racket expressions are themselves made out of syntax objects, which in turn happen to also be made out of Racket values, but ignoring quote, this correspondence is largely irrelevant to the process of evaluation.


lexi.lambda
2018-4-23 18:39:35

Syntax objects can contain a certain set of Racket values. The full list is large, but I think a syntax object is essentially either a boolean, number, character, string, regexp, path, symbol, keyword, pair of syntax objects, vector of syntax objects, hash table of syntax objects to syntax objects, box containing a syntax object, or prefab structure with syntax object values.


lexi.lambda
2018-4-23 18:40:39

There is no commonly-used term to refer to the class of values that encompasses booleans, numbers, characters, strings, regexps, paths, symbols, and keywords.


slack1
2018-4-23 18:41:21

Ah I see, I thought that those set of objects were called “Datatypes” based on https://docs.racket-lang.org/guide/datatypes.html


lexi.lambda
2018-4-23 18:41:52

Yes, I think “datatypes” refers to the different classes of values Racket provides, but I meant there is no term like “atom” that refers to exclusively that set.


slack1
2018-4-23 18:42:08

I’m definitely dropping the atom term, it was from some university’s slide


slack1
2018-4-23 18:43:16

But it sounds like you’re saying I need to be nuanced on program vs evaluation


lexi.lambda
2018-4-23 18:43:48

I do think it is important to distinguish those things, yes.



slack1
2018-4-23 18:44:27

Is this the best place to read to get my language and description of Racket down?


slack1
2018-4-23 18:44:52

I wouldn’t want to continue pinging you people for small details


lexi.lambda
2018-4-23 18:45:45

I think it depends on what sort of information you want to know. The Racket Guide is generally more useful if you just want to learn. The Racket Reference is the authoritative source for when you want to know the precise definitions of things.


dedbox
2018-4-23 19:08:37

I’m going to give this one more try.


dedbox
2018-4-23 19:08:43

An s-expression is an abstract concept defined mathematically by John McCarthy in the original LISP paper (http://www-formal.stanford.edu/jmc/recursive/node3.html). Many languages have adopted the parenthesized notation used in that paper because it is so easy to understand and reason about.


dedbox
2018-4-23 19:08:52

Each language has to decide what goes into its “set of distinguishable atomic symbols.” This is a matter of implementation, not of design. Without clarifying context, the term “atom” refers to symbolic expressions which cannot be divided into sub-expressions, regardless of how expressions are actually divided.


dedbox
2018-4-23 19:10:04

Thoughts?


slack1
2018-4-23 19:17:54

That’s a coherent concept to my head


slack1
2018-4-23 19:18:11

but since I didn’t 100% follow all the discussion here, I defer to a little bit of caution until I meditate on it


slack1
2018-4-23 19:18:42

To me, being able to succinctly state a small body of definitions is a self-proof of clarity


slack1
2018-4-23 19:18:51

and I am trying to find that nice small body of concepts


lexi.lambda
2018-4-23 19:25:15

I think your definition of an atom is a logical one, and I don’t actually disagree with it. I just don’t think it is a term that is commonly used within the Racket community, so I don’t think that definition is universally accepted or universally understood.


lexi.lambda
2018-4-23 19:26:19

There are many terms with precise definitions that are nonetheless unclear because they are simply not within a particular community’s lexicon. So it’s important to define such terms when speaking to that community if you want to ensure you are not misunderstood.


lexi.lambda
2018-4-23 19:27:14

It’s especially tricky in programming, since so many terms are so overloaded. Even the term “symbol” will mean very different things to a Common Lisp programmer and a Scheme or Racket programmer, despite essentially referring to the same concept at the syntax level.


lexi.lambda
2018-4-23 19:27:43

(And because precision is often so important to programming.)


dedbox
2018-4-23 19:57:45

Racket helps you avoid much hacking at the reader level, where the concept is most useful. But I think it goes too far to say it isn’t commonly used for its purpose. It’s a legitimate PL design abstraction with a bad reputation.


dedbox
2018-4-23 19:59:33

Perhaps the atom is in a similar situation as the monad? Unbelievably simple abstraction that eludes concrete definition with a reputation for confusing beginners.


lexi.lambda
2018-4-23 20:01:23

I think we are talking past each other. I am making no argument for or against the concept of an atom. I am making a observational statement about the Racket community and the likelihood (or lack thereof) that an average Racket programmer will understand what you mean when you use the term. I am not saying the term or concept does not have merits, merely that you cannot use it and expect people to know exactly what you’re talking about.


lexi.lambda
2018-4-23 20:03:15

If you think the notion of an atom is a useful one that should become a part of the Racket lexicon, make a pull request that adds its definition to the Racket Reference in the appropriate section and refer people to it. Otherwise, it is not a term with a precise, universally-known definition, so you will have to explain yourself when you use it in conversation.


dedbox
2018-4-23 20:08:38

You recommended against using a word and I disagreed with that recommendation. I thought we were hashing out our difference in opinions, as I’m genuinely interested in your advice.


dedbox
2018-4-23 20:09:15

I came to Racket as a PL designer and have had zero issues discussing atoms with others.


dedbox
2018-4-23 20:09:32

So debate seemed appropriate.


lexi.lambda
2018-4-23 20:11:46

I don’t really have any strong opinion for or against the term “atom”. I don’t personally find it very useful, since I don’t think I spend very much time manipulating s-expressions in Racket (that is, I don’t think I spend any time doing so), so I don’t have any reason for using the term. I do spend a lot of time manipulating syntax objects, but there isn’t really any time when I care about distinguishing booleans, numbers, characters, strings, regexps, paths, symbols, and keywords from everything else.


lexi.lambda
2018-4-23 20:14:26

Racket’s syntax language is not extensible. That is to say it is not possible to define new “atoms”. I am sure the term would be significantly more useful if that were different.


dedbox
2018-4-23 20:25:52

Thanks for clarifying. Have you done serious PL work in other languages?


lexi.lambda
2018-4-23 20:27:56

I suppose that depends on your definition of “PL work”.


dedbox
2018-4-23 20:29:36

Designing or implementing programming language interpreters or compilers?


lexi.lambda
2018-4-23 20:33:30

I’ve implemented toy languages in other languages, but that was still quite serious for some definitions of serious.


dedbox
2018-4-23 20:43:05

Ok. Do you ever model PL designs before coding, like on paper?


lexi.lambda
2018-4-23 20:45:10

Sure. I spent a lot of time writing things down on paper when I designed my first programming language, which was before I even discovered Racket (I implemented an interpreter in C). Nowadays I don’t usually design on paper, but I do work through reductions of certain things or typing judgements or things like that.


dedbox
2018-4-23 20:50:11

Interesting. Then I should probably be focusing more on expansion and less on reading.


lexi.lambda
2018-4-23 20:53:50

I personally find practicing to be considerably more productive/useful than studying (since the things I need to read will be clearly motivated by what I’m doing at the time), but that’s just me.