I have seen the light of Lisp. There is no code but and is its earthly consummation.

Between DrRacket and Scribble, I am quite transfigured. The yak is clean shaved. This is everything I’ve ever wanted in a programming language but never known. It’s a little like love. 💕

Thanks, @emacsomancer

Then, the program


'(1 "five.rkt"234567 8)
is equivalent to


'(1 ("23456") 7 8)

This is too nifty. Racket is nearly ‘pataphorical in its lack of syntactic limitations. Syntax itself is more a convention when it can be expanded or altered on the fly with read and read-syntax.

@Shufei is pretty cool. I use clojure for my hobby projects.

@notptr I’m heaps excited about it, especially using DrRacket and Scribble. I grok this so much better than any language context I’ve seen yet.

Why do you prefer clojure? How is clojure special as a lisp? So far I’ve only been reading about Racket and dialects.

@Shufei I started using it because of the access to the Java libraries. I wanted to use something different from my work. At work we use perl and their is a plan to go to javascript and/or python. I tried to use Common Lisp but I didn't get very far but I found clojure to be really nice.

@notptr I like very much the graphical and mouse shortcuts that DrRacket allows, so I’m starting off with Racket as seemingly the most newb friendly of Lisps. But I’ll give clojure a look later on. I like Scribble for the idea of running code within text, which I have some ideas to use, so shall probably start there.

Lisp is like an alternate reality where code is lovely and seamless and more friendly. New dialects. I wish I’d read of this long ago.

@Shufei I wish I took it more seriously while I was in my programming languages class in University. I met someone at my University where her first programming language was Lisp.

@notptr I’m getting the sense, from that manifesto, that the popular languages have conditioned people to really expect languages to look or feel a certain way, and that if one is accustomed to that, going Lisp is very disorienting. Did you feel that?

That’s no issue for me, of course, as I’ve only written very simple virtual robots before. But even I was a bit shocked by the “no states” thing. I liked to flip states to do things. So that will take unlearning.

@Shufei I believe so. Like I only programmed in popular languages. I was little disoriented with using lisp because I had to think of more of a recursive way of handling problems instead of just going through with steps. Then when I read through the Land of Lisp I saw that what I was writing isn't set in stone like the popular languages.

@notptr Recursion! Right! That is very lovely, that recursive list expression. I can foresee a bit of difficulty in figuring out how to do steps in this framework. But looking at these reader macros, I think the way I used to think of states can be more powerful with a bunch of rkt files doing things anyway. Yes, very fluid, Lisp. More like the ocean than the land, haha.

Thanks for your opinions. I shall play with this and see if it really works with my muddled brain.

@notptr Haha, this is grand! Wow, and the NES only has 2Kb of ram... I didn’t know that. I suppose it doesn’t matter much for the games, but goodness.

I keep forgetting that NES uses the 6502. One thing I wanted to do is build my music project on Linux with that old SID library and then see about porting it properly for C64. Has anyone done a Lisp for C64 that you like?

@Shufei I don't know of any good lisp. Though I haven't seeked out a C64 lisp. NES games also packaged ram on the carts too.

Programming languages for the Commodore 64

@notptr Looks like some people did a Lisp interpreter for C64 twice. LIMP and Micro-LISP. Fun! That’s very good to note, especially for 6581 dev.

@Shufei @emacsomancer What are the features of Racket (and Lisp in general) that you find this compelling?

I've used Lisps and I generally find they're fun, but it takes a lot of thinking to use, and reading lisp can be extremely challenging.

Moreover, of the lisps I've used, Clojure (for all its problem) is the easiest to read, not Racket.

@emacsen @emacsomancer The elegance appeals to me. That “everything is a list”, and everything works as expression. It just fits my cognitive style better, as a dilettante writer rather than “a coder”. I like the fluidity. I’m visually oriented so like the idea of DrRacket allowing pictures. And nesting everything including conditionals with brackets rather than opening and closing. I get distracted by the “yak shaving” of other langs. I’m just looking at this now, but liking it heaps.

@emacsen @emacsomancer I think I see what you mean about “reading being challenging”, though. I would not collapse so much into one line like many of these examples. But then, I’m also not going to be debugging anyone else’s code, likely, nor doing the fancy things you all do, so I’m free to format the code how I like. That is nice, too, that it’s more idiosyncratic friendly.

@Shufei @emacsomancer These are great answers. Thank you.

There are debates around even the question of "What is a lisp?" - it's a topic that @cwebber and I may do a show on in the future (we started planning it then things got pretty crazy for both of us).

I agree with you regarding DrRacket.

I agree with you that Lisps are the purest form of languages and have an incredible beauty and elegance to them.

Now I'm going to knock Lisp...

@Shufei @emacsomancer @cwebber

Lisps are incredibly hard to read.

Look at the analysis done by ArneBab, and his resulting project Wisp:

SO much easier to read...

And "everything is a list" is, in practice, not such a great idea.

Compare a Racket define with a Clojure one:

(define (hi name)
(print (string-append "Hello " name)))


(defn hi [name]
(print (str "Hello" name)))

It's not just superficial, having vectors on the reader matters for other reasons

@emacsen @emacsomancer @cwebber Ohhhh, yes, I see what you mean, now. The examples I’ve been reading prefer terse one liner nesting, whereas the white space formatting allows for clearer line by line organization. That’s fair. And when I saw that, I said to myself that I would likely format with spaces anyway for clarity.

The Clojure example, thanks heaps, I see how that is clear. I think DrRacket can do clojure too, so shall give both a go and report later if and how I like them.

@Shufei @emacsomancer @cwebber Let me be very clear- I don't like Clojure. It's not possible to write GPLed software in Clojure- and that's *by design*.

Also there's a statement by language author Rich Hickey which turned me off to Clojure as well.

But I still think that having vectors as [] and hash table/dictionaries {} in the reader makes a big difference. Not everything should be a list.

There are other ways I prefer the Clojure syntax, but not trying to take over your feed.

@emacsen @emacsomancer @cwebber Haha, that’s jake. I appreciate your criticism of it after getting starry eyed from the boosters. So far Lisps still appeal to me for personal reasons of style. And the list primacy is certainly one of them. The Clojure brackets are clear to read, but also create more conceptual overhead if that makes sense.

The real test is if I can run it on my creaky old noodle, though, so shall read more on both and try to make a GTK bouncing ball or something.

@emacsen @Shufei @emacsomancer @cwebber good thing you have lisps like #fennel which get you the best of both worlds!

(slick brackety syntax without the GPL-incompatibility, community-hostile maintainers, or oracle-controlled VM)

@Shufei sorry, didn't mean to get too fanboy on you. Racket is a great choice too with a lot to like about it and a solid community. it's such a good time to be a language enthusiast when wonderful choices abound.

@technomancy No, I appreciate it. And I share your enthusiasm. It does daunt me though, and my completist streak, to think of all the research needed just for this one niche of languages. Like, I feel like something has been hidden from me until now about programming that Lisp makes clear. It’s ineffable, rather. So the notion that I’ve yet more languages that might be even *better* than what I’m learning overwhelms. Alls I really know right now is that, for me, JS sucks.

@Shufei If you learn one of these (Racket, Common Lisp, Emacs Lisp, Clojure, Fennel, ....), a lot will transfer if you want to learn/use one of the others. There are, of course, important differences between these 'different lisps', but I think they often involve similar underlying mindsets. So I think picking one and working with it for a while is a good strategy, even if you end up switching to another later on, it won't be wasted.

@emacsen I think one could write LGPL software in Clojure though, no? The inability to write GPL software in Clojure is very off-putting in any event.

Though I'll admit that I'm dubious of non-licence-related things in Clojure related to low-level things like handling of 'cons' in any case. If, for some reason, I wanted to write lisp that ran on the JVM, I think I'd be tempted to use Armed Bear Common Lisp ( ).

Clojure is mostly interesting to me as a lisp with a fairly wide adoption.

@Shufei @cwebber
@grainloom @emacsen @Shufei @cwebber

Janet looks cool, but I haven't done much more than play with the in-browser implementation. Have you tried it?

@emacsomancer @emacsen @Shufei @cwebber not yet, I just skimmed through the reference docs and some of the source code.

@emacsomancer @emacsen @Shufei @cwebber (well, i probably ran a few lines of code in the online repl, but that doesn't really count. i haven't even touched the threading library.)

Hi, @emacsen - thanks for providing some counterbalance (I did reference some links to 'why lisp failed' earlier in the thread as well).

I will maintain that the readability issue is rather subjective. I honestly find the straight lisp versions more readable than the wisp versions. I can unfocus the parentheses most of the time, but being able to focus on them when desired I find crucial.

Though the Python whitespace-as-syntax sounds initially appealling, in practice I find I prefer whitespace as formatting for humans, and not as computer-meaningful syntax.

The parentheses/bracketing issue is an interesting one. I pretty strongly disagree with Hickey on his notion that ()s get semantically-overloaded in Lisp. There is disambiguating context which usually balances this.

Also, in Racket your example can also be expressed as:

(define [greet name]
(print {string-append "Hello " name}))

In Racket (and I think in R6RS Schemes?) []s and {}s are alternatives to ()s, and so can be used where desired.

@Shufei @cwebber

@emacsomancer @emacsen @Shufei Although, Wisp is a lot harder, at present, to write :)

I've been a big proponent of Wisp, because I think an alternative simple syntax that maintains Lisp's beauty to be a big feature, but admittedly when I load lisp code and wisp code in my editor, I find lisp a *little bit* easier to read, but a *lot* easier to write. Wisp needs tooling to be made manageable.

@cwebber @emacsen @Shufei

I think it's tricky to simplify basic lisp syntax since using some overt markers of sexp boundaries like ()s makes the code wear its structure on its sleeve, at the small cost of Lots of Irritating Superfluous Parentheses for those who aren't used to looking at lisp syntax. Removing a clear, consistent marker in favour of a combination of meaningful whitespace and other boundary markers (:, .) at least for me doesn't feel like a cognitive win for the writer.

I also feel obligated to repost...

@emacsomancer @emacsen @Shufei The real litmus test of "is lisp syntax good": if you remove the ability to define macros, would you still prefer a parenthetical syntax?

And for myself, I would say "yes":
- Clarity of code flow
- Better editing tools (smartparens/paredit/rainbow delimeters)
- Unbeatable transition from "experimental code at the repl" right into your main codebase.

@cwebber @emacsomancer @emacsen @Shufei me too. Honestly I barely use macros, they're not easy to test or for other folks to read.

@cwebber @emacsomancer @emacsen @Shufei

I like this take a lot and I love lisp syntax but I'll always be biased as it was the first language I wrote substantial programs in.

When you say clarify of code flow though, I feel like that speaks more to the simplicity of the evaluation model than anything else. (I.e. SICP chapter 1 stuff, no operator precedence, etc) Am I missing something or is that more a semantic than syntactic issue?

@kingcons @emacsomancer @emacsen @Shufei Infix operators are very, *very* hard to figure out the order of, for instance.

Flow is possible to reason about in general because it's clear where it is delimited. This allows for such things as putting a conditional during the argument list of a function call and have it be very natural:

(call-me (if (evening? cur-time)

Python can't handle that kind of thing and doesn't even try.

@kingcons @emacsomancer @emacsen @Shufei And yes it doesn't look as readable as it would be if you aren't using a monospace font ;P

@cwebber @kingcons @emacsomancer @emacsen @Shufei that example has little to do with syntax; you can do that in Ruby and probably Smalltalk too. it's more a consequence of Python having statements instead of making everything an expression. (it's just that nearly every language that makes the mistake of having statements coincidentally has an algol-like syntax.)

@technomancy @kingcons @emacsomancer @emacsen @Shufei That's true, though I'd also say that in many languages that do support it, support is ugly / hard to read due to if having a very "different" syntax in many algol'ish languages

@cwebber This seems to be honing in on it to me. "Everything is an expression" + parens as primary syntactic construct leads to the boundaries of an expression being obvious.

This in turn makes refactoring more obvious. You can get used to seeing "expression boundaries" in other langs too, but it feels exceptionally crisp in Lisp due to the "exposed plumbing" of the representation.

@kingcons @cwebber "everything is an expression" is something that makes its way into almost any modern language these days (even Java! switch expression is coming, Javascript too where each declaration is an expression, even class). Examples are Kotlin & Rust at least (is it a "statement"? It returns Unit!) because it makes everything *much* more smooth.
Actually it's almost always conditions which are the problem and "ternary operator" is available almost everywhere.

@technomancy @cwebber @kingcons @emacsomancer @Shufei

Dirty secret is that I find Ruby to be a better Python in terms of syntax because it's more consistent. Sadly it brings with it a whole ton of other stuff I find less appealing.

@cwebber @kingcons @emacsomancer @emacsen @Shufei `callme({True: eveningNumber, False: dayNumber}[isEvening(time.time())]` is one possible Python impl...

@apg @cwebber @kingcons @emacsomancer @emacsen @Shufei callme(evening_number if is_evening(time.time()) else day_number)

It's postfix, not infix. Means you need more parens if there's more than one argument

@cwebber @emacsomancer @emacsen @Shufei

To me, a syntax must answer "yes" to one of two questions:

1. (For DSLs) Does it express specialized solutions that humans can understand?
2. (For multi-paradigm langs) Is it homoiconic?

If the answer is "no" to both questions, then I'd probably feel too limited in the host language over time. If the answer to #2 is "yes", then the syntax is probably going to look like Lisp or Rebol anyway. Once you know the benefits, it's easy to appreciate their form!

@emacsomancer @emacsen @cwebber Haha, this cartoon speaks to my mind, very much.

Some white space is helpful for organizational clarity. But every time I hunt through some JS and the nested tabs go plumb off the screen I just wanna growl. They should be mere formatting, housekeeping, not syntax for my preference. I like parentheticalism because, as you said, I can focus on them. I’m drawing lil pics in WeScheme right now and visualize parentheses better, have more code on screen at once.

@Shufei Whitespace is definitely important for human beings, but I'm dubious of using whitespace as syntax for computers.

You should be able to configure your editor to use nice things like rainbox parens, paren highlighting, &c. which make quickly processing the structure easier.


@emacsen @cwebber

@emacsomancer Oh, wow! Wow, that is pretty! I know colours for editors, natch, but that is perfect! Just make the parentheses rainbows. Oh, that is a lovely idea, thanks.

@cwebber A slightly customised version of Iosevka Slab Serif. It replaced DejaVu Sans Mono as my default mono font after many years.

@emacsen @Shufei

@cwebber @emacsomancer @emacsen @Shufei Sweet expressions (aka t-exprs, SRFI110) is a cool alternative to Wisp and have been available to Racketeers for a long time:
Without parenthesis to balance the standard character/word based editing tools in Vim and Emacs are usually considered enough. What packages did you miss while editing Wisp code? something like paredit?

@trobador @emacsomancer @emacsen @Shufei While *writing* wisp code, it's very hard for me to remember where an expression begins and ends. When reading it, it's much easier to tell.

I don't know of any other syntax that has this property, heh...

@emacsen @Shufei @emacsomancer

> What are the features of Racket (and Lisp in general) that you find this compelling?

Re: just Racket. Say you use Python, JS, and Rust. You have at least three different package control tools (e.g. pipenv, npm, cargo), at least three test libraries, and so on. Changing languages means changing ecosystems.

In Racket, you can change languages without leaving the ecosystem. Going from a markup lang to a typed lang preserves the base toolchain.

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko