Logo
Explore Help
Sign In
intercal/not-python
1
0
Fork 0
You've already forked not-python
Code Issues Pull Requests Releases Wiki Activity
Files
a9d59be4728b0af41e8ba52814af55dd741244db
not-python/examples/expr.not

16 lines
201 B
Plaintext
Raw Normal View History

Finish up old example that shows off basic expressions and funcalls The VM now supports the various int comparison methods. An example of a "pow" method is given to show off recursion, which means we're now TURING COMPLETE! Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-11-09 16:50:16 -08:00
pow = fn (n, p) {
if p <= 0 {
return 1
} el {
return n * pow(n, p - 1)
}
}
Add hypothetical "pow" function syntax includes function declaration syntax + ternary expression syntax Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-17 13:31:41 -07:00
Add rerun_except crate, and small example code * rerun_except will ensure a build doesn't rerun if a *.not file is modified, which it would otherwise do * Add examples/expr.not with some basic assignment statements and function calls Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-17 13:26:38 -07:00
kilo = pow(2, 10)
mega = pow(2, 20)
giga = pow(2, 30)
Finish up old example that shows off basic expressions and funcalls The VM now supports the various int comparison methods. An example of a "pow" method is given to show off recursion, which means we're now TURING COMPLETE! Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-11-09 16:50:16 -08:00
println(kilo)
println(mega)
println(giga)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.5 Page: 40ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API