16 ms·
Racket: Lisp for Learning
- jimbob45 7y agoCarmack is a huge fan of Racket. He was going to use it as the scripting language for VR until the Oculus execs made him use JavaScript instead (boooooo) https://twitter.com/id_aa_carmack/status/807797812700348416 https://twitter.com/id_aa_carmack/status/807797812700348416
- 6thaccount2 7y agoI think I heard that even his wife didn't want him to teach their son Racket and wanted him to learn Java. Not sure if true.
- yantrams 7y agoI believe you're referring to this thread. https://groups.google.com/forum/?hl=en#!topic/racket-users/yjRuIxypUQc https://groups.google.com/forum/?hl=en#!topic/racket-users/y...
- 6thaccount2 7y agoThat's the one, thanks!
- AlexeyBrin 7y agoGiven the Racket2 possible massive syntax changes it seems that using JavaScript was a better choice for a commercial project. That being said I very much prefer Racket to JavaScript for personal/hobby projects.
- aswanson 7y agoYeah. But Racket seems so much cooler.
- AlexeyBrin 7y agoRacket really is a nice language, we'll see if/how the situation changes once the Racket2 situation is clarified.
- wtetzner 7y agoI think it would have been fine based on https://groups.google.com/forum/m/#!msg/racket-users/HiC7z3A5O-k/XPR2wbSJCQAJ https://groups.google.com/forum/m/#!msg/racket-users/HiC7z3A... > No matter how Racket evolves, the community is committed > to preserving what we have achieved: today's `#lang racket` > programs will run in the future, and today's > `#lang racket` modules can be used in future Racket programs.
- deleted 7y ago[deleted]
- JoelMcCracken 7y agoVery much an overreaction. The whole point of Racket is to support multiple syntaxes. The idea that a future Racket would NOT support the current syntax seems absurd. But really there are lots of other, better reasons to use JS over Racket for a major commercial project, which may or may not be actually a good call, but a new proposed syntax is not one of them.
- traderjane 7y agoBut where will the culture of Racket go? How will the educational texts, documentation, and general conversations go?
- dmix 7y agoThey could do an Elixir style fork instead? Although a pure syntax change isn’t as significant as what Elixir changed.
- JoelMcCracken 7y agoWhy does the same conversation not come up when discussing typed racket? Is the introduction of a static type system really less culture-shaking than surface syntax?
- sdegutis 7y agoLast week I tried writing a new Love2d mode for Emacs in Emacs Lisp, but it was on Windows so my muscle memory for Paredit wasn't helpful. Editing s-expressions is a nightmare without some kind of automatic help. Last night I wrote the same plugin for VS Code which used JavaScript, and naturally it was effortless. It got me thinking about how s-expressions are inherently hostile to non-customized setups, whereas JavaScript just uses arrow keys. A former employer was led by huge Clojure fans, who requested that the backend be Clojure, and highly encouraged me to use ClojureScript and something like Reagent for the front-end, which I recently noticed that they finished after my departure. But the more I think about it, the more I can't think of a single feature of ClojureScript that's inherently better than JavaScript, whereas s-expressions are inherently hostile and also have no real-world benefits. JavaScript has destructuring, closures, a flexible module system, object/array spread, basically every syntactical feature Clojure has, but without the s-expressions. The commonly touted benefit of s-expressions is homoiconicity (code is data), which lets the developer customize the language via macros without needing to wait on the compiler/interpreter authors. But we have this exact same benefit in JavaScript with compilers like Babel. Maybe it's pushed onto another layer of development, but it's in no way less legitimate or useful. The slight benefit you get by being able to do this transformation at runtime is negated by the inconvenience of s-expressions. (Although at first glance, it seems like we could use a better Babel API that lets us transform our code more conveniently. But I think they're working on that?) The main other benefit I commonly see from people using Clojure or ClojureScript is live development. I saw technomancy made some blog posts about how he used Fennel (a Lisp that compiles to Lua) to do live-coding stuff in Love2d. I was impressed, until I realized that none of these features were specific to Lisp. So I borrowed the same underlying concept he utilized, and started to make a really cool Love2d live development thing just like he had, but in pure Lua. Now I have the ability to press Cmd-E in VS Code while editing some Lua file, and if I have any code selected, it'll be sent to the live Lovd2d game that's running, to be eval'd, and if there's no selection, the whole current file will be sent. It's the coolest setup ever, almost identical to the awesome setup I had with CIDER + Clojure + Emacs, but without Emacs or s-expressions.
- nudpiedo 7y agoThe UI of an S-Expeession and a compiler transformation parse time transformation is just out of any comparison. Most of projects wouldn’t even consider writing a loader for a compiler or using a syntax parser. Yet to add which method is more prone to errors.
- nudpiedo 7y agoAny evidence about any oculus exec (CEO? CFO? GTO?) trying to change the most famous CTO of the company switch an implementation detail. (The comment about the wife spoiling him to use java seemed more credible)
- sheenobu 7y agoProof might be this twitter thread, exec could have been implied, because who else can boss the CTO around? https://mobile.twitter.com/ID_AA_Carmack/status/807797812700348416 https://mobile.twitter.com/ID_AA_Carmack/status/807797812700...
- layoutIfNeeded 7y agoAh, again! The first version of JS could have been a Lisp variant but the paper-pushers at Netscape had to ruin it. This was the original sin to which all the suffering of web development can be traced back.
- deleted 7y ago[deleted]
- yogthos 7y agoGood news is that we'll be able to do VR with ClojureScript though.
- AlexeyBrin 7y agoI really like Racket, but the potential breaking massive syntax change in Racket2 makes me really uncomfortable in using or recommending Racket to other people, at least until the situation is clarified.
- chessturk 7y agoI keep hearing about this, where is something I can read / listen to about the announcement?
- gekkonier 7y ago#lang racket is here to stay parallel to #lang racket2 Racket is a lot of languages, not only one. You can mix in Racket as you like. You can mix #lang racket and #lang typed/racket with #lang datalog in one application if you like. With racket2 those options will not fade away I guess.
- memling 7y agoOne of the barriers for my adoption might be addressed here: > * Make the language constructs more generic > In many ways, the current Racket language and libraries encourage the use of concrete data structures instead of abstract datatypes. Matt Flatt goes on to mention that map only works with list types, for example (you need to use hash-map to work with hash tables, vector-map for vectors, et c.). This makes refactoring a bit of a pain and feels like a legacy holdover that shouldn't exist in a modern programming language.
- neilv 7y agoI'm pretty confident that `#lang racket` will not only keep working (as already said, from the start), but also remain a first-class citizen. There's even more community support for parentheses than I would've guessed. For various objective and subjective reasons I won't regurgitate here. Some of the work in non-parens syntaxes (especially the Honu paper) are very interesting, and deserve more prominent exposure, and to be well-supported, so that people can try and adopt them with confidence. I'll be interested to see how people use them. But there's no need to alienate half the community by declaring any of the non-parens approaches the default or normative, especially when Racket already famously has all the meta to support all of them, well. I suppose it might even turn out that `#lang racket2` ends up looking almost exactly like `#lang racket`, just with tweaks to names and semantics, and that any non-parens syntaxes are separate and layered. And they all interoperate. Which Racket supports well. My guess is, probably after everyone gets back from well-deserved vacations, this will to start to clarify, probably in September.
- tombert 7y agoDoes Racket support "real" multithreading yet? I remember looking at their documentation a few years ago and it only had support for a green-threading thing, which (along with the first-class hashmaps) steered me towards Clojure.
- mruts 7y agoYou can use futures, which have access to underlying OS threads. They don’t share a memory space though. There’s also an Actor library called Goblins which is nice, but I’m not sure if can use multiple cores.
- gus_massa 7y agoFutures are difficult to use, because if you allocate or you call any of the "forbidden" primitives the thread will block and resume automatically when it is safe to do the operation. They are good for numerical work, but you have to pay a lot of attention writing code with futures. It's more easy to use places, you can run whatever you want in places, but the communication between places is restricted and they have a big startup time (something like a quarter of a second) so if you create one, ensure that you are going to use it for a long time.
- deleted 7y ago[deleted]
- masukomi 7y agoi _believe_ it does not CURRENTLY _but_ it's pretty far along with moving its lower layers to Chez Scheme which _does_ have native threading.
- samth 7y agoYes, Racket support using multiple cores/OS threads. There are two mechanisms -- shared memory parallelism that is limited in what operations the threads can execute in parallel (called futures in Racket) and shared-nothing parallelism with message passing, more like Erlang (called places in Racket). Most real work using parallelism in Racket uses places.
- gaze 7y agoWho are the current major users of Racket? Are there any large commercial codebases written in it?
- baristaGeek 7y agoI have no official data, but I don't think it's used beyond the academic and hobbyist level. However, I must say that understanding the functional paradigm (learning Racket is a really good exercise) can help developers write really professional software with Scala, Elixir, Clojure, etc.
- neilv 7y agoIt's mostly used in various education projects, and various commercial and research projects that are largely done by a single strong programmer (e.g., Carmack-ish people). There's at least one large-codebase complex Web-based production system in it, which incidentally accomplished a first on AWS, but you've never heard of it, since it's internal-ish. It was a happy accident of history, that grew out of a lone super-productive programmer starting a complex data science infrastructure that I'd say few teams could've pulled off in a non-Lisp. I've been waiting for another startup to decide they're going to do their first version in Racket, to do something non-cookiecutter. (It turned out neither myself nor my own startup co-founder had any interest in doing the CEO side of things, or I would've launched such a startup already.) But anything Scheme-related has a terrible curse for perception: students associate it with academic oddities in first-year classes, and then they focus on whatever "real" tools they hear employers or other companies are using.
- jcadam 7y agoNext time I get an idea for a side project, I'm thinking of giving Racket a go. I've used Clojure on past personal projects (and currently at work), but I'm starting to grow weary of the JVM. If the next idea that comes to me happens to be/involve a web app, perhaps a Racket backend with a cljs frontend might be fun.
- dorian-graph 7y ago> .. that I'd say few teams could've pulled off in a non-Lisp. Would you mind expanding on this? (I’m not asking facetiously either)
- baristaGeek 7y agoI got into 'purely' functional programming with Racket. It's really fun to use, and you can truly understand the functional paradigm if you dig deep into it. Along with it, I would recommend reading Structure and Interpretation of Computer Programs.
- alexbanks 7y agoSICP is an awesome book.
- uxp100 7y agoRacket is a mixed bag for me. I've found a little quirks in the standard library, with simple fixes, but annoying. Stuff like decimal->string (?) producing odd output. (It was a tiny fix on my end, but it's a little subjective, maybe the behavior was intended) Not a big deal, but maybe a little impediment for learners compared to python. The article mentions Scribble, which I use as a static site generator for a a page with a leader board for EDH games (and maybe adding 9 ball lol). Some small CSS changes made it OK for cell phones (basic changes to make it responsive so it's ugly but readable), but as is it sucks, and the maintainers have no interest in changing that. Dr. Racket is unfortunate. If I remember correctly it has a tabbed interface, but right clicking on the tabs does not bring up a menu, and the tabs might not have close buttons either? It's not bad, but inferior to any dedicated editor. OTOH, I keep using it for little tasks, I like the language, and I seem to be one of the few people who are excited about the Racket2 syntax, so I think I will stick with it. I had been considering switching my lisp use to clojure.
- soegaard 7y agoThe modern way of converting numbers to strings is ~v. Unlike `number->string` (which is compatible with Scheme), ~v has all the features one would expect (min-width, padding rounding etc.).
- soegaard 7y agoAlso check racket-mode for Emacs.
- samth 7y agoCan you say more about the issue with number->string (probably that's the function you used)? Also, I think we'd be happy to take patches to improve the Scribble CSS for mobile.
- uxp100 7y agoJust looked at my code. It was "real->decimal-string" It includes the decimal point, even when the "digits" parameter is 0. Minor, but when throwing a tiny page together I probably spent 10% of my time just figuring out where that function lived and that there wasn't some other routine I should be using (though it sounds like there actually is). So I changed the format string to "~a~a~a~a" from "~a~a.~a" and did (if (zero? digits) "" "."). Potentially the existing behavior is correct for scheme compatibility? I'm not web guy, my changes are pretty haphazard, but I'm not the first person to notice this. https://github.com/racket/scribble/pull/62 https://github.com/racket/scribble/pull/62 is a rejected pull request (with you as a reviewer, so I'm sure you know that it doesn't work well currently, on my iPhone SE at least, maybe larger form factor phones do better)
- acbart 7y agoWell, I'm pretty sure this is going to go badly for me in the end, but I might as well leave this here: https://ihateracket.com https://ihateracket.com
- acbart 7y agoAnd before any says it, yes, I do love the idea of students EVENTUALLY learning a Lisp/Racket kind of language before they graduate. I would even be happy with an entire course dedicated to it. But I don't want that to be the CS1. I've just seen it go so wrong for so long now.
- snazz 7y agoI think this is extremely fair. It's really hard to understand why anyone might want metaprogramming until you've tried programming without it (on something larger than the average intro-to-CS assignment). Having more libraries and resources is extremely useful from teaching to working in the real world. Most of the points in the article are valid, and I especially agree that Racket or another Scheme should be taught at some point later on. Maybe even implementing a Scheme as a final course project or something like that (although that might not make sense outside a compilers class...)
- abhiyerra 7y agoI actually really enjoyed 61A with Scheme at Berkeley. I think the benefit of learning Scheme to start is the flexibility of learning how more complex features like OOP, can be built off a simpler language. > Pascal is for building pyramids imposing, breathtaking, static structures built by armies pushing heavy blocks into place. Lisp is for building organisms--imposing, breathtaking, dynamic structures built by squads fitting fluctuating myriads of simpler organisms into place. - Structure and Interpretations of Computer Programs
- badsavage 7y agoI had a beautiful beginning with a lisp like programming language when I was 8 or something. Every other languages have been disappointments until I found Clojure a few years ago. I hope you will get it some day.
- ballpark 7y agoAny good article recommendations that explain the reasoning to the switch to Chez Scheme as a platform for Racket?
- samth 7y agohttps://blog.racket-lang.org/2019/01/racket-on-chez-status.html https://blog.racket-lang.org/2019/01/racket-on-chez-status.h... and the links at the top should provide the explanation. This paper: https://www.cs.utah.edu/plt/publications/icfp19-rddkmstz.pdf https://www.cs.utah.edu/plt/publications/icfp19-rddkmstz.pdf has more details. Basically, Chez is a now-open-source runtime that's very close to what Racket needs, while also being written mostly in Scheme instead of in C (as the original Racket runtime & compiler is). Building on Chez allows us to cut the amount of C by a factor of ~10 while getting a better architecture.
- ballpark 7y agoPerfect, thanks!
- dreamcompiler 7y agoChez is AOT compiled down to the metal; it's not an interpreted VM or a JIT compiler. My initial reaction was "Oh good. This means Racket will run much faster!" But that's not really true. Some things are faster; some aren't. The real reason is that because Chez compiles to the metal, it makes maintainability easier because less C code is needed.
- salusbury 7y agoI'm glad that the Lisp language has so many derivatives.