-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
print-debugging-in-over-300-languages.scroll
208 lines (193 loc) · 17.3 KB
/
print-debugging-in-over-300-languages.scroll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
author https://github.com/breck7 Breck Yunits
date 2022.07.15
groups All
title "print() debugging" in over 300 languages
import postHeader.scroll
printTitle
wideColumns 1
printAuthor
image print-debugging.png
* Paul Graham—creator of Arc and Bel—started an interesting thread last month about "print() debugging".
https://twitter.com/paulg/status/1532448988766650385 interesting thread
link BASE_URL/concepts/arc.html Arc
link BASE_URL/concepts/bel.html Bel
dateline
endSnippet
* Both experts and beginners frequently use "print() debugging".
* Support for "print() debugging" is near-universal in high level programming languages. Implementations vary.
* Different languages use different commands. There are a few popular patterns. Many languages have a simple global keyword like `print` or `echo` or `puts`. Many others don't use the global namespace and you "print() debug" via a call like `console.log`. Many provide multiple keywords, such as `print` and `println`—the latter a shortcut for printing a string followed by a `\n`.
* There is also a long tail distribution of how languages let you do it. Some have special syntactic sugar, such as the code golf esolang 05AB1E (`"hello world`).
link BASE_URL/concepts/05AB1E.html 05AB1E
* Below is a table of over 100 keyword(s) used to "print() debug" in over 300 languages.
* You may notice there is a lack of representation of assembly languages in this list. It is often _much_ harder to "print() debug" in low level languages than simply writing `print`.
commaTable
Keyword,Languages,Count
print,<a href='truebase/python.html'>Python</a> <a href='truebase/r.html'>R</a> <a href='truebase/perl.html'>Perl</a> <a href='truebase/swift.html'>Swift</a> <a href='truebase/fortran.html'>Fortran</a> <a href='truebase/lua.html'>Lua</a> <a href='truebase/dart.html'>Dart</a> <a href='truebase/awk.html'>awk</a> <a href='truebase/postscript.html'>PostScript</a> <a href='truebase/spss.html'>SPSS</a> <a href='truebase/emacs-lisp.html'>Emacs Lisp</a> <a href='truebase/standard-ml.html'>Standard ML</a> <a href='truebase/rebol.html'>REBOL</a> <a href='truebase/logo.html'>Logo</a> <a href='truebase/boo.html'>Boo</a> <a href='truebase/io.html'>Io</a> <a href='truebase/idl.html'>IDL</a> <a href='truebase/hy.html'>Hy</a> <a href='truebase/newlisp.html'>NewLisp</a> <a href='truebase/squirrel.html'>Squirrel</a> <a href='truebase/ceylon.html'>Ceylon</a> <a href='truebase/factor.html'>Factor</a> <a href='truebase/moonscript.html'>MoonScript</a> <a href='truebase/maxima.html'>Maxima</a> <a href='truebase/setl.html'>SETL</a> <a href='truebase/dafny.html'>Dafny</a> <a href='truebase/coconut.html'>Coconut</a> <a href='truebase/terra.html'>Terra</a> <a href='truebase/genie.html'>Genie</a> <a href='truebase/algol-68.html'>ALGOL 68</a> <a href='truebase/ratfor.html'>RATFOR</a> <a href='truebase/gosu.html'>Gosu</a> <a href='truebase/ante.html'>Ante</a> <a href='truebase/jython.html'>Jython</a> <a href='truebase/swift-il.html'>SIL</a> <a href='truebase/cobra.html'>Cobra</a> <a href='truebase/yorick.html'>Yorick</a> <a href='truebase/beanshell.html'>BeanShell</a> <a href='truebase/nit.html'>Nit</a> <a href='truebase/starlark.html'>starlark</a> <a href='truebase/fennel.html'>Fennel</a> <a href='truebase/angelscript.html'>Angelscript</a> <a href='truebase/f.html'>F</a> <a href='truebase/maxscript.html'>MAXScript</a> <a href='truebase/pyret.html'>pyret</a> <a href='truebase/gdscript.html'>GDScript</a> <a href='truebase/arkscript.html'>ArkScript</a> <a href='truebase/dyvil.html'>dyvil</a> <a href='truebase/providex.html'>ProvideX</a> <a href='truebase/macsyma.html'>Project MAC’s SYmbolic MAnipulator</a> <a href='truebase/locomotive-basic.html'>Locomotive BASIC</a> <a href='truebase/bython.html'>Bython</a> <a href='truebase/zenscript.html'>zenscript</a> <a href='truebase/owen-lang.html'>owen-lang</a> <a href='truebase/aplusplus.html'>A++</a> <a href='truebase/toy-lang.html'>toy-lang</a> <a href='truebase/pawn-scripting-language.html'>Pawn</a> <a href='truebase/sdlbasic.html'>SdlBasic</a> <a href='truebase/action-code-script.html'>Action Code Script</a> <a href='truebase/qcl.html'>QCL</a> <a href='truebase/battlestar.html'>Battlestar</a> <a href='truebase/claro.html'>Claro</a> <a href='truebase/verve.html'>verve</a>,63
println,<a href='truebase/scala.html'>Scala</a> <a href='truebase/clojure.html'>Clojure</a> <a href='truebase/julia.html'>Julia</a> <a href='truebase/kotlin.html'>Kotlin</a> <a href='truebase/groovy.html'>Groovy</a> <a href='truebase/v.html'>V</a> <a href='truebase/clojurescript.html'>ClojureScript</a> <a href='truebase/ioke.html'>Ioke</a> <a href='truebase/e.html'>E</a> <a href='truebase/koka.html'>Koka</a> <a href='truebase/scala-js.html'>Scala.js</a> <a href='truebase/carp.html'>carp</a> <a href='truebase/ooc.html'>ooc</a> <a href='truebase/fancy.html'>Fancy</a> <a href='truebase/felix.html'>Felix</a> <a href='truebase/golo.html'>Golo</a> <a href='truebase/frink.html'>Frink</a> <a href='truebase/clay.html'>clay</a> <a href='truebase/jakt.html'>Jakt</a> <a href='truebase/nice.html'>Nice</a> <a href='truebase/vale.html'>Vale</a> <a href='truebase/picat.html'>Picat</a> <a href='truebase/cache-basic.html'>Caché Basic</a> <a href='truebase/afnix.html'>Afnix</a>,24
printf,<a href='truebase/c.html'>C</a> <a href='truebase/objective-c.html'>Objective-C</a> <a href='truebase/d.html'>D</a> <a href='truebase/maple.html'>Maple</a> <a href='truebase/octave.html'>GNU Octave</a> <a href='truebase/cuda.html'>CUDA</a> <a href='truebase/cyclone.html'>Cyclone</a> <a href='truebase/dtrace.html'>DTrace</a> <a href='truebase/volt.html'>Volt</a> <a href='truebase/zz.html'>zz</a> <a href='truebase/ici.html'>Interactive C Interpreter</a> <a href='truebase/muon.html'>muon</a> <a href='truebase/qore.html'>Qore</a> <a href='truebase/yoix.html'>Yoix</a> <a href='truebase/algae.html'>Algae</a> <a href='truebase/y.html'>Y</a> <a href='truebase/nymph.html'>Nymph</a> <a href='truebase/silk.html'>silk</a> <a href='truebase/promela.html'>Promela</a>,19
echo,<a href='truebase/php.html'>PHP</a> <a href='truebase/powershell.html'>PowerShell</a> <a href='truebase/bash.html'>Bash</a> <a href='truebase/nim.html'>Nim</a> <a href='truebase/fish.html'>fish</a> <a href='truebase/j.html'>J</a> <a href='truebase/hack.html'>Hack</a> <a href='truebase/fantom.html'>Fantom</a> <a href='truebase/batch.html'>Batchfile</a> <a href='truebase/korn-shell.html'>Korn shell</a> <a href='truebase/z-shell.html'>Z shell</a> <a href='truebase/tea.html'>Tea</a> <a href='truebase/tcsh.html'>tcsh</a> <a href='truebase/vim-script.html'>Vim script</a> <a href='truebase/c-shell.html'>C shell</a> <a href='truebase/mirc.html'>MIRC scripting language</a>,16
PRINT,<a href='truebase/lisp.html'>Lisp</a> <a href='truebase/basic.html'>BASIC</a> <a href='truebase/common-lisp.html'>Common Lisp</a> <a href='truebase/qbasic.html'>QBasic</a> <a href='truebase/gfa-basic.html'>GFA BASIC</a> <a href='truebase/bbc-basic.html'>BBC BASIC</a> <a href='truebase/applesoft-basic.html'>Applesoft BASIC</a> <a href='truebase/bloop.html'>BlooP</a> <a href='truebase/xbasic.html'>Xbasic</a> <a href='truebase/baysick.html'>baysick</a> <a href='truebase/algo.html'>ALGO</a> <a href='truebase/cesil.html'>Cesil</a>,12
write,<a href='truebase/prolog.html'>Prolog</a> <a href='truebase/vhdl.html'>VHDL</a> <a href='truebase/icon.html'>Icon</a> <a href='truebase/pike.html'>Pike</a> <a href='truebase/unicon.html'>Unicon</a> <a href='truebase/jade.html'>JADE</a> <a href='truebase/nial.html'>Nial</a> <a href='truebase/algol-w.html'>ALGOL W</a> <a href='truebase/s-algol.html'>S-algol</a> <a href='truebase/logtalk.html'>Logtalk</a> <a href='truebase/gaml.html'>GAML</a>,11
Print,<a href='truebase/mathematica.html'>Mathematica</a> <a href='truebase/xojo.html'>Xojo</a> <a href='truebase/wolfram.html'>Wolfram Language</a> <a href='truebase/iswim.html'>ISWIM</a> <a href='truebase/lotusscript.html'>LotusScript</a> <a href='truebase/jai.html'>JAI</a> <a href='truebase/amos.html'>AMOS</a> <a href='truebase/basic-256.html'>Basic-256</a> <a href='truebase/blitz3d.html'>Blitz3D</a> <a href='truebase/holyc.html'>holyc</a>,10
console.log,<a href='truebase/javascript.html'>JavaScript</a> <a href='truebase/typescript.html'>TypeScript</a> <a href='truebase/coffeescript.html'>CoffeeScript</a> <a href='truebase/nodejs.html'>Node.js</a> <a href='truebase/deno.html'>Deno</a> <a href='truebase/livescript.html'>LiveScript</a> <a href='truebase/roy.html'>roy</a> <a href='truebase/cor.html'>cor</a>,8
puts,<a href='truebase/ruby.html'>Ruby</a> <a href='truebase/tcl.html'>Tcl</a> <a href='truebase/crystal.html'>Crystal</a> <a href='truebase/monkey.html'>Monkey</a> <a href='truebase/euphoria.html'>Euphoria</a> <a href='truebase/nu.html'>Nu</a> <a href='truebase/xotcl.html'>XOTcl</a>,7
writeln,<a href='truebase/pascal.html'>Pascal</a> <a href='truebase/chapel.html'>Chapel</a> <a href='truebase/seed7.html'>Seed7</a> <a href='truebase/xl-lang.html'>XL</a> <a href='truebase/zonnon.html'>Zonnon</a> <a href='truebase/draco-programming-language.html'>Draco</a>,6
System.out.println,<a href='truebase/java.html'>Java</a> <a href='truebase/aspectj.html'>AspectJ</a> <a href='truebase/pizza.html'>Pizza</a> <a href='truebase/concurnas.html'>concurnas</a>,4
Console.WriteLine,<a href='truebase/csharp.html'>C#</a> <a href='truebase/visual-basic.html'>Visual Basic</a> <a href='truebase/oxygene.html'>Oxygene</a> <a href='truebase/beef.html'>BEEF</a>,4
say,<a href='truebase/rexx.html'>Rexx</a> <a href='truebase/netrexx.html'>NetRexx</a> <a href='truebase/kitten.html'>kitten</a> <a href='truebase/raku.html'>Raku</a>,4
putStrLn,<a href='truebase/haskell.html'>Haskell</a> <a href='truebase/idris.html'>Idris</a> <a href='truebase/agda.html'>Agda</a>,3
print_string,<a href='truebase/ocaml.html'>OCaml</a> <a href='truebase/reason.html'>Reason</a> <a href='truebase/skip.html'>skip</a>,3
WRITE,<a href='truebase/algol-60.html'>ALGOL 60</a> <a href='truebase/abc.html'>ABC</a> <a href='truebase/karel.html'>Karel</a>,3
disp,<a href='truebase/matlab.html'>MATLAB</a> <a href='truebase/scilab.html'>Scilab</a>,2
DISPLAY,<a href='truebase/cobol.html'>COBOL</a> <a href='truebase/cobolscript.html'>CobolScript</a>,2
display,<a href='truebase/scheme.html'>Scheme</a> <a href='truebase/racket.html'>Racket</a>,2
printfn,<a href='truebase/f-sharp.html'>F#</a> <a href='truebase/fable.html'>Fable</a>,2
stdout.print,<a href='truebase/zig.html'>Zig</a> <a href='truebase/wyvern.html'>Wyvern</a>,2
Out.String,<a href='truebase/oberon.html'>Oberon</a> <a href='truebase/oberon-2.html'>Oberon-2</a>,2
put,<a href='truebase/hypertalk.html'>HyperTalk</a> <a href='truebase/turing.html'>Turing</a>,2
std::cout,<a href='truebase/cpp.html'>C++</a>,1
fmt.Println,<a href='truebase/go.html'>Go</a>,1
println!,<a href='truebase/rust.html'>Rust</a>,1
io:format,<a href='truebase/erlang.html'>Erlang</a>,1
Text_IO.Put_Line,<a href='truebase/ada.html'>Ada</a>,1
displayNl,<a href='truebase/smalltalk.html'>Smalltalk</a>,1
IO.puts,<a href='truebase/elixir.html'>Elixir</a>,1
WriteLn,<a href='truebase/delphi.html'>Delphi</a>,1
$display,<a href='truebase/verilog.html'>Verilog</a>,1
WriteString,<a href='truebase/modula-2.html'>Modula-2</a>,1
w,<a href='truebase/mumps.html'>MUMPS</a>,1
WRITES,<a href='truebase/bcpl.html'>BCPL</a>,1
OutText,<a href='truebase/simula.html'>Simula</a>,1
dbms_output.put_line,<a href='truebase/pl-sql.html'>PL/SQL</a>,1
printLine,<a href='truebase/self.html'>Self</a>,1
display dialog,<a href='truebase/applescript.html'>Applescript</a>,1
Serial.println,<a href='truebase/arduino.html'>Arduino</a>,1
stdout.printf,<a href='truebase/vala.html'>Vala</a>,1
trace,<a href='truebase/actionscript.html'>ActionScript</a>,1
Response.Write,<a href='truebase/asp.html'>ASP</a>,1
IO.print,<a href='truebase/wren.html'>Wren</a>,1
OUTPUT,<a href='truebase/snobol.html'>SNOBOL</a>,1
MsgBox,<a href='truebase/autoit.html'>AutoIt</a>,1
call void [mscorlib]System.Console::WriteLine,<a href='truebase/cilk.html'>CIL</a>,1
sys->print,<a href='truebase/limbo.html'>Limbo</a>,1
write.full.string,<a href='truebase/occam.html'>Occam</a>,1
io:println,<a href='truebase/ballerina.html'>Ballerina</a>,1
prn,<a href='truebase/arc.html'>Arc</a>,1
System.Console.WriteLine,<a href='truebase/nemerle.html'>Nemerle</a>,1
postln,<a href='truebase/supercollider.html'>SuperCollider</a>,1
jlog,<a href='truebase/opa.html'>Opa</a>,1
io.write_string,<a href='truebase/mercury.html'>Mercury</a>,1
PrintN,<a href='truebase/purebasic.html'>PureBasic</a>,1
cfoutput,<a href='truebase/coldfusion.html'>ColdFusion</a>,1
Console.OUT.println,<a href='truebase/x10.html'>X10</a>,1
FStar.IO.print_string,<a href='truebase/fstar.html'>F*</a>,1
print_endline,<a href='truebase/caml.html'>Caml</a>,1
putchar,<a href='truebase/b.html'>B</a>,1
WScript.Echo,<a href='truebase/jscript.html'>JScript</a>,1
stream$putl,<a href='truebase/clu.html'>CLU</a>,1
answer,<a href='truebase/livecode.html'>LiveCode</a>,1
#OUT,<a href='truebase/sather.html'>Sather</a>,1
#print,<a href='truebase/lean.html'>Lean</a>,1
draw_text,<a href='truebase/ibm-gml.html'>GML</a>,1
Stdout,<a href='truebase/miranda.html'>Miranda</a>,1
crLog,<a href='truebase/pharo.html'>Pharo</a>,1
console.loge,<a href='truebase/dogescript.html'>Dogescript</a>,1
System.Console.Write,<a href='truebase/jsharp.html'>J#</a>,1
env.out.print,<a href='truebase/pony.html'>Pony</a>,1
MessageBox,<a href='truebase/powerbuilder.html'>PowerBuilder</a>,1
standard-output,<a href='truebase/islisp.html'>ISLISP</a>,1
document.write,<a href='truebase/objective-j.html'>Objective-J</a>,1
out_string,<a href='truebase/cool.html'>Classroom Object Oriented Language</a>,1
Scream,<a href='truebase/rockstar.html'>Rockstar</a>,1
System.print,<a href='truebase/gravity.html'>gravity</a>,1
write-line,<a href='truebase/clisp.html'>CLISP</a>,1
<Prout,<a href='truebase/refal.html'>Refal</a>,1
fmt.println,<a href='truebase/odin.html'>odin</a>,1
.print,<a href='truebase/lisaac.html'>Lisaac</a>,1
$print,<a href='truebase/neko.html'>Neko</a>,1
WriteF,<a href='truebase/amiga-e.html'>Amiga E</a>,1
PrintLn,<a href='truebase/ec.html'>eC</a>,1
output:,<a href='truebase/rapira.html'>Rapira</a>,1
$console:line,<a href='truebase/parser.html'>Parser 3</a>,1
PRINTF,<a href='truebase/action.html'>Action!</a>,1
hodor.hod,<a href='truebase/hodor.html'>Hodor</a>,1
player:tell,<a href='truebase/moo.html'>MOO</a>,1
bprint,<a href='truebase/quakec.html'>QuakeC</a>,1
Show,<a href='truebase/ox.html'>OX</a>,1
io::println,<a href='truebase/whiley.html'>Whiley</a>,1
pr,<a href='truebase/shen.html'>Shen</a>,1
SysLib.writeStdout,<a href='truebase/egl.html'>EGL</a>,1
traceln,<a href='truebase/monte.html'>monte</a>,1
message,<a href='truebase/uniface.html'>Uniface</a>,1
Logger.log,<a href='truebase/google-apps-script.html'>Google Apps Script</a>,1
ксива.малява,<a href='truebase/yoptascript.html'>YoptaScript</a>,1
Message,<a href='truebase/1c-enterprise.html'>1C Enterprise Script</a>,1
Write,<a href='truebase/cache-objectscript.html'>Caché ObjectScript</a>,1
escribir,<a href='truebase/latino.html'>latino</a>,1
Qout,<a href='truebase/xbasepp.html'>XBase++</a>,1
TextOut,<a href='truebase/nxc.html'>Not eXactly C</a>,1
writeLine,<a href='truebase/elena.html'>elena</a>,1
Println,<a href='truebase/orc-lang.html'>Orc</a>,1
Text,<a href='truebase/xpl0.html'>XPL0</a>,1
IO.write,<a href='truebase/zimbu.html'>Zimbu</a>,1
Console.println,<a href='truebase/ferite.html'>Ferite</a>,1
stdout.putString,<a href='truebase/emerald.html'>Emerald</a>,1
System.puts,<a href='truebase/virgil.html'>Virgil</a>,1
Console.printLine,<a href='truebase/frost.html'>Frost</a>,1
_printf,<a href='truebase/ceu.html'>ceu</a>,1
IO.Println,<a href='truebase/parasail.html'>parasail</a>,1
Js.log,<a href='truebase/rescript.html'>Rescript</a>,1
fmt::println,<a href='truebase/hare.html'>Hare</a>,1
output,<a href='truebase/quorum.html'>quorum</a>,1
comment
xsv select title,appeared,type,rank,printToken pldb.local/languages.csv > ignore/printTokens.csv
comment
printDebug() {
pldbFolder.loadFolder()
const code = new TreeNode(
Disk.read(
__dirname + "/blog/posts/does-every-programming-language-support-print-debugging.scroll"
)
)
const tree = TreeNode.fromCsv(code.getNode("rawData").childrenToString())
const grouped = {}
tree.forEach(row => {
const obj = row.toObject()
if (!grouped[obj.printToken])
grouped[obj.printToken] = {
Keyword: obj.printToken,
Languages: [],
topRank: 0 - parseInt(obj.rank)
}
grouped[obj.printToken].Languages.push(obj.title)
})
const sorted = lodash
.sortBy(
Object.values(grouped).map((item: any) => {
item.Count = item.Languages.length
item.Languages = item.Languages.map(
item =>
`<a href='truebase/${pldbFolder.searchForEntity(
item
)}.html'>${item}</a>`
).join(" ")
//if (grouped[item].length < 1) delete grouped[item]
return item
}),
["Count", "topRank"]
)
.reverse()
console.log(
new TreeNode(sorted).toDelimited(",", ["Keyword", "Languages", "Count"])
)
}
ohayoCode
html.h1 Does every programming language have a central package repository?
web.get https://pldb.io/pldb.csv
tables.basic
filter.where printToken !=
tables.basic
group.by printToken
rows.sortByReverse count
tables.basic
import footer.scroll