Racket (programming language): Difference between revisions

Content deleted Content added
http://racket-lang.org/new-name.html
Tag: Reverted
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(29 intermediate revisions by 23 users not shown)
Line 3:
| name = Racket
| logo = Racket-logo.svg
| logo size = 121px140px
| screenshot = Drracket.png
| screenshot size = 250px
| screenshot caption = DrRacket on [[Linux]]
| paradigm = [[multiMulti-paradigm programming language|Multi-paradigm]]: [[functionalFunctional programming|functional]], [[imperativeImperative programming|imperative]], [[logicLogic programming|logic]], [[metaprogrammingMetaprogramming|meta]], [[modularModular programming|modular]], [[objectObject-oriented programming|object-oriented]], [[reflectionReflective (computer science)programming|reflective]]
| family = [[Lisp (programming language)|Lisp]]
| year = {{Start date and age|20101995|01|28}}
| designer = PLT Inc.
| developer = PLT Inc.
| latest_release_versionlatest release version = {{Wikidata|property|reference|edit|Q28975406|P348}}
| latest_release_datelatest release date = {{start date and age|{{Wikidata|qualifier|Q28975406|P348|P577}}}}
| typing = [[dynamicDynamic typing|Dynamic]], [[staticStatic typing|static]], [[strongStrong and weak typing|strong]]
| implementations = [https://docs.racket-lang.org/reference/implementations.html Racket], [https://docs.racket-lang.org/racketscript/index.html RacketScript] Racket to JavaScript (ES6) compiler, [https://github.com/pycket/pycket Pycket] a Racket implementation using [https://pypi.org/project/rpython/ RPython].
| implementations =
| dialects = Typed Racket, FrTime, Lazy Racket, Scribble
| influenced by = [[Eiffel (programming language)|Eiffel]],<ref>{{cite web |url=http://www.ccs.neu.edu/racket/pubs/dls10-sf.pdf |title=DLS 2010: Contracts for First-Class Classes |last1=Strickland |first1=T.S. |last2=Fellesisen |first2=Matthias |year=2010}}</ref> [[Scheme (programming language)|Scheme]]
| influenced = [[Clojure]],<ref name="typed-clojure-thesis">{{cite thesis |last=Bonnaire-Sergeant |first=Ambrose |title=A Practical Optional Type System for Clojure|publisher=The University of Western Australia |year=2012}}</ref> [[Rust (programming language)|Rust]],<ref>{{cite web |url=https://mail.mozilla.org/pipermail/rust-dev/2013-May/003947.html |title=Planet2 questions}}</ref>{{Better source needed|date=November 2022|reason=This mailing list on the build system may not be relevant to the current Rust build system.}} <ref>{{cite web |url=https://github.com/rust-lang/rust/blob/0486e12ad0661adcfdbd926dea17d7edfda419c1/src/doc/book/bibliography.md |title=Rust Bibliography|website=[[GitHub]] |date=23 November 2022 }}</ref> [[Scheme (programming language)|Scheme (R6RS)]]<ref name="r6rs">{{cite web |url=http://www.r6rs.org |title=Revised<sup>6</sup> Report on the Algorithmic Language Scheme (R6RS) |last1=Sperber |first1=Michael |last2=Dybvig |first2=R. Kent |last3=Flatt |first3=Matthew |last4=Van Straaten |first4=Anton |date=August 2007 |publisher=Scheme Steering Committee |access-date=2011-09-13 |display-authors=etal}}</ref>
| platform = [[x86]], [[PowerPC]], [[SPARC]], [[MIPS architecture|MIPS]], [[ARM architecture|ARM]]
| operating system = [[Cross-platform]]
| license = [[MIT License|MIT]] or [[Apache License 2.0|Apache 2.0]]<ref>{{cite web|title=Completing Racket's relicensing effort|url=https://blog.racket-lang.org/2019/11/completing-racket-s-relicensing-effort.html|last1=Tobin-Hochstadt|first1=Sam|last2=Gerard|first2=Sage|last3=Dueck|first3=Joel|last4=Flatt|first4=Matthew|author-link4=Matthew Flatt|author5=Software Freedom Conservancy|author-link5=Software Freedom Conservancy|last6=Chestek|first6=Pamela|date=2019-11-15|access-date=2019-12-27}}</ref>
| file ext = .rkt<ref>{{cite web|title=DrRacket Files|quote=The standard file extension for a Racket program file is ".rkt". The extensions ".ss", ".scm", and ".sch" are also historically popular.|url=https://docs.racket-lang.org/drracket/drracket-files.html|access-date=21 July 2019}}</ref>
| website = {{URLurl|https://racket-lang.org/}}
| frequently updated = yes
| standard = [[R5RS]], [[R6RS]]
}}
 
'''Racket''' is a [[General-purpose programming language|general-purpose]], [[multi-paradigm programming language]]. The Racket language is a modern dialect of [[Lisp (programming language)|Lisp]] and a descendant of [[Scheme (programming language)|Scheme]]. It is designed as a platform for [[programming language theory|programming language design]] and implementation.<ref name="manifesto">{{cite journal |last1=Felleisen |first1=M. |last2=Findler |first2=R.B. |last3=Flatt |first3=M. |last4=Krishnamurthi |first4=S. |last5=Barzilay |first5=E. |last6=McCarthy |first6=J. |last7=Tobin-Hochstadt |first7=S. |title=The Racket Manifesto |journal=Proceedings of the First Summit on Advances in Programming Languages |date=2015 |pages=113–128 |url=https://www2.ccs.neu.edu/racket/pubs/manifesto.pdf}}</ref> In addition to the core Racket language, ''Racket'' is also used to refer to the family of programming languages<ref>{{cite web |title=Dialects of Racket and Scheme |url=http://docs.racket-lang.org/guide/dialects.html |access-date=2011-08-15}}</ref> and set of tools supporting development on and with Racket.<ref>{{cite web |title=Welcome to Racket |url=http://docs.racket-lang.org/guide/intro.html|access-date=2019-05-15}}</ref> Racket is also used for [[script (computing)|scripting]], [[computer science]] education, and research.
'''Racket''' is a [[General-purpose programming language|general-purpose]], [[multi-paradigm programming language]] and a multi-platform distribution that includes the Racket language, [[compiler]], large standard library, [[integrated development environment|IDE]], development tools, and a set of additional languages including Typed Racket (a sister language of Racket with a static type-checker), Swindle, FrTime, Lazy Racket, R5RS & R6RS [[Scheme (programming language)|Scheme]], Scribble, Datalog, Racklog, [[Algol 60]] and several teaching languages.
 
The Racket platform provides an implementation of the Racket language (including a [[runtime system]],<ref name="mred"/> libraries, and [[compiler]] supporting several compilation modes: machine code, machine-independent, interpreted, and JIT) along with the DrRacket [[integrated development environment]] (IDE) written in Racket.<ref name="drscheme"/> Racket is used by the [[ProgramByDesign]] outreach program, which aims to turn [[computer science]] into "an indispensable part of the [[liberal arts]] [[curriculum]]".<ref name="teachscheme">{{cite news| last1=Felleisen |last2=Findler |last3=Flatt |last4=Krishnamurthi |year=2004 |url=http://www.ccs.neu.edu/scheme/pubs/#cse2003-fffk |title=The TeachScheme! Project: Computing and Programming for Every Student|journal=Journal of Computer Science Education}}</ref><ref>{{cite web |url=http://programbydesign.org/overview |title=Overview |publisher=Program by Design |access-date=2011-08-17 |archive-date=2013-05-20 |archive-url=https://web.archive.org/web/20130520104718/http://www.programbydesign.org/overview |url-status=dead }}</ref>
The Racket language is a modern dialect of [[Lisp (programming language)|Lisp]] and a descendant of [[Scheme (programming language)|Scheme]]. It is designed as a platform for [[programming language theory|programming language design]] and implementation.<ref name="manifesto">{{cite journal |last1=Felleisen |first1=M. |last2=Findler |first2=R.B. |last3=Flatt |first3=M. |last4=Krishnamurthi |first4=S. |last5=Barzilay |first5=E. |last6=McCarthy |first6=J. |last7=Tobin-Hochstadt |first7=S. |title=The Racket Manifesto |journal=Proceedings of the First Summit on Advances in Programming Languages |date=2015 |pages=113–128 |url=https://www2.ccs.neu.edu/racket/pubs/manifesto.pdf}}</ref> In addition to the core Racket language, ''Racket'' is also used to refer to the family of programming languages<ref>{{cite web |title=Dialects of Racket and Scheme |url=http://docs.racket-lang.org/guide/dialects.html |access-date=2011-08-15}}</ref> and set of tools supporting development on and with Racket.<ref>{{cite web |title=Welcome to Racket |url=http://docs.racket-lang.org/guide/intro.html|access-date=2019-05-15}}</ref> Racket is also used for [[script (computing)|scripting]], [[computer science]] education, and research.
 
The Racket platform provides an implementation of the Racket language (including a [[runtime system]],<ref name="mred"/> libraries, and [[compiler]] supporting several compilation modes: machine code, machine-independent, interpreted, and JIT) along with the DrRacket [[integrated development environment]] (IDE) written in Racket.<ref name="drscheme"/> Racket is used by the [[ProgramByDesign]] outreach program, which aims to turn [[computer science]] into "an indispensable part of the [[liberal arts]] [[curriculum]]".<ref name="teachscheme">{{cite news| last1=Felleisen |last2=Findler |last3=Flatt |last4=Krishnamurthi |year=2004 |url=http://www.ccs.neu.edu/scheme/pubs/#cse2003-fffk |title=The TeachScheme! Project: Computing and Programming for Every Student|journal=Journal of Computer Science Education}}</ref><ref>{{cite web |url=http://programbydesign.org/overview |title=Overview |publisher=Program by Design |access-date=2011-08-17}}</ref>
 
The core Racket language is known for its extensive [[macro (computer science)|macro]] system which enables creating embedded and [[___domain-specific language]]s, language constructs such as [[class (computer programming)|classes]] or [[modular programming|modules]], and separate dialects of Racket with different [[semantics of programming languages|semantics]].<ref name="scheme-with-classes">{{cite conference
Line 58 ⟶ 55:
|year=2011
|url=http://www.ccs.neu.edu/scheme/pubs/pldi11-thacff.pdf}}
</ref><ref>{{Cite journal |doi=10.1145/3127323 |volume=61 |issue=3 |pages=62–71 |last1=Felleisen |first1=Matthias |last2=Findler |first2=Robert Bruce |last3=Flatt |first3=Matthew |last4=Krishnamurthi |first4=Shriram |last5=Barzilay |first5=Eli |last6=McCarthy |first6=Jay |last7=Tobin-Hochstadt |first7=Sam |title=A Programmable Programming Language |journal=Communications of the ACM |date=2018 |s2cid=3887010 |url=https://cacm.acm.org/magazines/2018/3/225475-a-programmable-programming-language/fulltext|url-access=subscription }}</ref>
 
The platform distribution is [[free and open-source software]] distributed under the [[Apache License|Apache 2.0]] and [[MIT license]]s.<ref name="racket-lgpl-license">{{cite web |title=Racket: Software License |url=http://download.racket-lang.org/license.html |access-date=2015-10-20}}</ref> Extensions and packages written by the community may be uploaded to Racket's [[package manager|package catalog]].
Line 65 ⟶ 62:
 
===Development===
[[Matthias Felleisen]] founded PLT Inc. in the mid 1990s, first as a research group, soon after as a project dedicated to producing [[pedagogic]] materials for novice programmers (lectures, exercises/projects, software). In January 1995, the group decided to develop a pedagogic programming environment based on [[Scheme (programming language)|Scheme]]. [[Matthew Flatt]] cobbled together MrEd, the original [[virtual machine]] for Racket, from libscheme,<ref name="libscheme">{{cite conference |url=https://www.usenix.org/legacy/publications/library/proceedings/vhll/benson.html |title=libscheme: Scheme as a C Library |last=Benson |first=Brent W. Jr. |date=26–28 October 1994 |publisher=USENIX Association |publication-place=Berkeley, CA |book-title=Proceedings of the USENIX Symposium on Very High Level Languages |pages=7–19 |___location=Santa Fe, NM |isbn=978-1880446652 |access-date=7 July 2013}}</ref> [[wxWidgets]], and a few other free systems.<ref name="gui-rebuild">{{cite web |title=Rebuilding Racket's Graphics Layer |access-date=2017-12-11|date=2010-12-08 |url=http://blog.racket-lang.org/2010/12/rebuilding-rackets-graphics-layer.html}}</ref> In the years that followed, a team including Flatt, [[Robert Bruce Findler|Robby Findler]], [[Shriram Krishnamurthi]], Cormac Flanagan, and many others produced DrScheme, a programming environment for novice Scheme programmers and a research environment for [[type system#Combining static and dynamic type checking|softgradual typing]].<ref name="drscheme">{{cite journal |title=DrScheme: A Programming Environment for Scheme|journal=Journal of Functional Programming |last1=Findler |last2=Clements |last3=Flanagan |last4=Flatt |last5=Krishnamurthi |last6=Steckler |last7=Felleisen |url=http://www.ccs.neu.edu/racket/pubs/jfp01-fcffksf.pdf |year=2001}}</ref> The main development language that DrScheme supported was named PLT Scheme.
 
In parallel, the team began conducting workshops for high school teachers, training them in program design and functional programming. Field tests with these teachers and their students provided essential clues for directing the development.
Line 113 ⟶ 110:
{{See also|Racket features#Language Extensions|l1=Racket language extensions}}
 
The features that most clearly distinguish Racket from other languages in the Lisp family are its integrated language [[Extensible programming|extensibility]] features that support building new [[Domain-specific languages|___domain-specific]] and [[General-purpose programming language|general-purpose]] languages. Racket's extensibility features are built into the module system to allow context-sensitive and module-level control over syntax.<ref name='"languages-as-libraries'"/> For example, the <code>#%app</code> syntactic form can be overridden to change the semantics of [[function application]]. Similarly, the <code>#%module-begin</code> form allows arbitrary static analysis of the entire module.<ref name='"languages-as-libraries'"/> Since any module can be used as a language, via the <code>#lang</code> notation, this effectively means that virtually any aspect of the language can be programmed and controlled.
 
The module-level extensibility features are combined with a [[Scheme (programming language)|Scheme]]-like hygienic macro system, which provides more features than [[Lisp (programming language)|Lisp's]] s-expression manipulation system,<ref name='"you-want-it-when'">{{cite conference |last=Flatt |first=Matthew |url=http://www.cs.utah.edu/plt/publications/macromod.pdf |title=Composable and Compilable Macros, You Want it When? |book-title=International Conference on Functional Programming |year=2002}}</ref><ref>Flatt, Culpepper, Darais, Findler, [http://www.cs.utah.edu/plt/publications/jfp12-draft-fcdf.pdf Macros that Work Together; Compile-Time Bindings, Partial Expansion, and Definition Contexts]</ref> Scheme 84's [[Hygienic macro|hygienic]] extend-syntax macros, or [[R5RS]]'s [[syntax-rules]]. Indeed, it is fair to say that the macro system is a carefully tuned [[application programming interface]] (API) for [[compiler]] extensions. Using this compiler API, programmers can add features and entire [[___domain-specific language]]s in a manner that makes them completely indistinguishable from built-in language constructs.
 
The ''macro'' system in Racket has been used to construct entire language [[dialect (computing)|dialects]]. This includes Typed Racket, which is a gradually typed dialect of Racket that eases the migration from [[dynamically typed|untyped]] to typed code,<ref>{{cite conference |last1=Tobin-Hochstadt |first1=S. |last2=Felleisen |first2=M. |title=The Design and Implementation of Typed Scheme |book-title=Principles of Programming Languages |year=2008}}</ref> Lazy Racket—a dialect with [[lazy evaluation]],<ref>{{cite conference |last1=Barzilay |first1=E. |last2=Clements |first2=J. |title=Laziness Without All the Hard Work: Combining Lazy and Strict Languages for Teaching |book-title=Functional and Declarative Programming in Education |year=2005}}</ref> and Hackett, which combines Haskell and Racket.<ref name="Alexis Kings Blog">{{cite web | title=The Hackett Programming Language | website=Alexis King's Blog | url=https://lexi-lambda.github.io/hackett/ | access-date=16 June 2019}}</ref> The pedagogical programming language [[Pyret]] was originally implemented in Racket.<ref name="The Pyret Crew 2011">{{cite web | author=The Pyret Crew | title=The Pyret Code; or A Rationale for the Pyret Programming Language | website=Pyret | date=24 May 2011 | url=http://pyret.org/pyret-code/index.html | access-date=16 June 2019}}</ref><ref name="Index of / 2017">{{cite web | title=Programming and Programming Languages | website=Index of / | date=20 September 2017 | url=https://papl.cs.brown.edu/2017/ | access-date=16 June 2019}}</ref>
Line 121 ⟶ 118:
Other dialects include FrTime ([[functional reactive programming]]), Scribble (documentation language),<ref>{{cite conference |last1=Flatt |first1=M. |last2=Barzilay |first2=E. |last3=Findler |first3=R. B. |title=Scribble: Closing the Book on Ad Hoc Documentation Tools |book-title=International Conference on Functional Programming |year=2009}}</ref> Slideshow ([[slide show|presentation]] language),<ref>{{cite conference |last1=Findler |first1=R. B. |last2=Flatt |first2=M. |title=Slideshow: Functional Presentations |book-title=International Conference on Functional Programming |year=2004}}</ref> and several languages for education.<ref name="functional-io">{{cite conference |last1=Felleisen |last2=Findler |last3=Flatt |last4=Krishnamurthi |first1=M. |first2=R. B. |first3=M. |first4=S. |title=A Functional I/O System (or Fun for Freshman Kids) |url=http://www.ccs.neu.edu/scheme/pubs/icfp09-fffk.pdf |book-title=International Conference on Functional Programming |year=2009}}</ref><ref>{{cite journal |title=The Structure and Interpretation of the Computer Science Curriculum |last1=Felleisen |last2=Findler |last3=Flatt |last4=Krishnamurthi |first1=M. |first2=R. B. |first3=M. |first4=S.|journal=Journal of Functional Programming |volume=14 |issue=4 |pages=365–378 |url=http://www.ccs.neu.edu/scheme/pubs/fdpe2002-fffk.pdf |year=2004|doi=10.1017/S0956796804005076 }}</ref>
 
Racket's core distribution provides libraries to aid the development of programming languages.<ref name="languages-as-libraries"/> Such languages are not restricted to [[s-expression]] based syntax. In addition to conventional readtable-based syntax extensions, the directive <code>#lang</code> enables the invocation of arbitrary parsers, which can be implemented using the parser tools library.<ref name="parsers">{{cite web |title=Parser Tools: lex and yacc-style Parsing |url=http://docs.racket-lang.org/parser-tools/ |access-date=2011-08-16}}</ref> See [[Racket features#Logic Programmingprogramming|Racket logic programming]] for an example of such a language.
 
==Programming environment==
The language platform provides a [[Self-hosting (compilers)|self-hosted]] [[integrated development environment|IDE]]<ref name="drscheme"/> named DrRacket, a continuation-based [[web server]],<ref name="web-server"/> a [[graphical user interface]],<ref name="gui-rebuild"/> and other tools. As a viable scripting tool with libraries like common [[scripting language]]s, it can be used for scripting the Unix shell. It can parse [[command -line argumentsargument]]s and execute external tools.
 
===DrRacket IDE===
Line 134 ⟶ 131:
 
== Code examples ==
Here is a trivial [[hello"Hello, world]]World!" program]]:
<syntaxhighlight lang="Racket">
#lang racket
Line 164 ⟶ 161:
(if (zero? n) 1 (* n (fact (- n 1)))))
</syntaxhighlight>
 
== Implementations ==
Racket currently has two implementations. Both support Linux, Windows and MacOS on a variety of architectures and are supported as at version 8.8 (2023). The default implementation uses the [[Chez Scheme]] incremental compiler and runtime. The alternate implementation generates platform-independent bytecode and uses [[Just-in-time compilation]] to generate machine code as it is loaded.<ref>[https://docs.racket-lang.org/reference/implementations.html Implementations]</ref>
 
In addition, there are experimental implementations:
* RacketScript is an experimental Racket to JavaScript (ES6) compiler. It allows programmers to use both JavaScript’s and Racket’s ecosystem and aims to make this interoperability as smooth as possible.<ref>[https://docs.racket-lang.org/racketscript/index.html RacketScript]</ref>
* Pycket is a Racket implementation generated using the RPython framework.<ref>[https://github.com/pycket/pycket Pycket]</ref>
 
== Applications and practical use ==
Line 171 ⟶ 175:
Racket has several features useful for a commercial language, among them an ability to compile standalone executables under Windows, macOS, and Unix, a [[Profiling (computer programming)|profiler]] and [[debugger]] included in the [[integrated development environment]] (IDE), and a [[unit testing]] framework.
 
Racket has been used for commercial projects and web applications. A notable example is the [[Hacker News]] website, which runs on [[Arc (programming language)|Arc]], which is developed in Racket. [[Naughty Dog]] has used it as a scripting language in several of their video games.<ref>{{cite web |url=http://cufp.org/conference/sessions/2011/functional-mzscheme-dsls-game-development |title=Functional mzScheme DSLs in Game Development |access-date=2012-05-08}}</ref>
 
Racket is used to teach students algebra through game design in the [[Bootstrap curriculum|Bootstrap program]].<ref>{{cite web |url=http://www.bootstrapworld.org/materials/fall2015/index.shtml |website=bootstrapworld.org |access-date=2015-08-11 |title=Bootstrap}}</ref>
Line 210 ⟶ 214:
[[Category:Pedagogic integrated development environments]]
[[Category:Cross-platform free software]]
[[Category:Free compilers and interpretersopen source compilers]]
[[Category:Programming languages created in 1995]]
[[Category:Pattern matching programming languages]]