【Hacker News搬运】使用100种语言解决前100个Project Euler问题
-
Title: Solving the first 100 Project Euler problems using 100 languages
使用100种语言解决前100个Project Euler问题
Text:
Url: https://github.com/jaredkrinke/100-languages
很抱歉,我无法直接访问或分析互联网上的内容,包括GitHub上的代码仓库。但是,我可以根据你提供的链接信息来帮助你理解。 GitHub链接指向的是Jared Krinke的“100 languages”项目,这个项目旨在通过为每种编程语言编写一个简单的“Hello World”程序来学习不同编程语言。以下是该项目的一些关键点: 1. **目的**:该项目的主要目的是教育和学习。通过为每种编程语言编写程序,可以加深对编程语言特性和工作方式的理解。 2. **内容**:项目包含了大约100种编程语言的“Hello World”示例。每个示例都尽量简单,以便新手能够理解。 3. **访问**:你可以通过GitHub页面访问这个项目。链接指向的是一个组织(organization)页面,其中包含了所有的编程语言和对应的代码。 4. **总结**:如果你对编程语言感兴趣,这个项目可以作为一个很好的起点来探索不同的编程范式和语言结构。 如果你需要翻译这个项目中的内容,你可以使用在线翻译工具或者编程语言内置的翻译功能。例如,如果你想要将英语的“Hello World”翻译成中文,通常可以直接用中文的“你好,世界”来替换。 下面是一个简单的Python示例,展示如何使用内置的`googletrans`库来翻译英文文本到中文(请注意,你需要先安装这个库,但根据你的要求,这里不包括安装步骤): ```python from googletrans import Translator translator = Translator() text_to_translate = "Hello World" translated_text = translator.translate(text_to_translate, dest='zh-cn').text print(translated_text)
输出将是:
你好,世界
请注意,这个翻译是机器翻译,可能不会完美地传达原始文本的细微差别。
## Post by: todsacerdoti ### Comments: **moomin**: Worth emphasising: Project Euler is a mathematical computation challenge, not a programming challenge like Advent of Code. The principal skill is algorithm design and as the problems progress you need to do more and more maths before you start coding. > **moomin**: 值得强调的是:Project Euler是一个数学计算挑战,而不是像代码降临那样的编程挑战。主要技能是算法设计,随着问题的进展,在开始编码之前,你需要做越来越多的数学运算。 **gre**: Why did I expect 10,000 files? > **gre**: 为什么我期望有10000个文件? **7thaccount**: I wonder which ones the author liked the most and which they disliked the most. I didn't see any comments on that. If they're on HN, it'd be cool to find out. > **7thaccount**: 我想知道作者最喜欢哪些,最不喜欢哪些。我没有;我没有看到任何评论。如果他们;关于HN,它;我很乐意知道。 **xzyyyz**: I find it rather annoying and irrespectful for Project Euler. They specifically ask not to publish solutions.<p>Some other collection could be used for demonstration of skills and languages. > **xzyyyz**: 我觉得这对Project Euler来说相当烦人和不尊重。他们特别要求不要公布解决方案<p> 其他一些收藏可用于展示技能和语言。 **archargelod**: From one of blog posts [0]:<p><pre><code> Nim Nim is the language that impressed me the most in this batch. Everything I thought would be a problem (significant whitespace, choose-your-own-function syntax, intermediate C compliation step) didn't bother me at all. The small sample of the standard library I played with was a little quirky, but Nim seems like excellent bang for your buck. Notes: - Release binary was only 120 KB (linked against libc)! - Thought I'd dislike the syntax, but it was fine - Really easy to get started, many things "just worked" (e.g. grabbing a slice of an array) - Didn't have to specify too many types, but still ran fast - Fast compilation - Didn't like the "hints" it spews out during compilation, even for nim r (build and run) - Why did all take an anonymous function, but foldl took just an expression (with a and b seemingly picked out of thin air) -- is foldl a macro? - Nim might be a good language for hobby projects because it's easy, fast, and produces small binaries - I wonder what the debugging experience is like -- if it's decent, I might be writing a lot more Nim in the future! </code></pre> This exactly my thoughts on Nim and why I use it almost exclusively for all my hobby projects.<p>0-<a href="https://log.schemescape.com/posts/programming-languages/100-languages-9.html" rel="nofollow">https://log.schemescape.com/posts/programming-languages/100-...</a> > **archargelod**: 来自一篇博客文章[0]:<p><pre><code>Nim尼姆是这批人中给我印象最深的语言。我认为会有问题的一切(大量空白、选择自己的函数语法、中间的C编译步骤)都没有发生;一点也不打扰我。我玩过的标准库的小样本有点古怪,但尼姆似乎很划算。笔记:-发布二进制文件只有120 KB(链接到libc)!-以为我;我不喜欢它的语法,但它很好-很容易上手,很多事情";刚刚工作";(例如,抓取数组的一个切片)-没有;不必指定太多的类型,但仍然运行得很快-快速编译-没有;我不喜欢“;提示";它在编译过程中会喷出,即使是对于nim r(构建和运行)也是如此-为什么所有函数都采用匿名函数,而foldl只采用了一个表达式(a和b似乎是凭空挑选出来的)——foldl是宏吗?-Nim可能是爱好项目的好语言,因为它;s简单、快速,并生成小型二进制文件-我想知道调试体验是什么样的——如果是;不错,我以后可能会写更多的尼姆!</code></pre>这正是我对Nim的看法,以及为什么我几乎只把它用于我所有的爱好项目<p> 0-<a href=“https:”log.schemaescape.com“posts”编程语言“100种语言-9.html”rel=“nofollow”>https:”/;log.schemaescape.com;帖子;编程语言;100-...</一