Skip to Content
深入理解運算原理|從簡單的機器到無所不能的程式
book

深入理解運算原理|從簡單的機器到無所不能的程式

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
276
|
8
實際上幾乎可以肯定的是,
ruby does_it_say_no.rb < does_it_say_no.rb
會耗盡主機有限的記憶體,這將導致 ruby 當掉,而不是真正的永遠循
環。雖然這是從程式外部施加的資源限制,不是程式本身的屬性;但原則
上,我們可以根據需要繼續將更多的記憶體加入電腦,並且讓運算得以無
止盡的執行。
這似乎像是示範 Ruby 讓我們編寫非停止程式的無益且複雜的方式。畢竟
while true do
end
是完成相同事情更簡單的例子。
但藉著思考
does_it_say_no.rb
的行為,我們已經示範了:無論系統的特定功能如何,非
停止程式都是通用的必然結果。除了通用之外,我們的主張不是依據 Ruby 的任何特殊
能力,所以相同的概念也適用圖靈機、lambda 演算,或其他任何通用系統。每當我們
使用能力強大到足以估算自己的語言時,我們就知道必須使用相同的
#evaluate
來建構
永遠不會停止的程式,而不需瞭解有關語言能力的其他任何內容。
尤其不可能以阻止我們在保持語言足以強大到通用的情況下編寫非停止程式的方式,刪
掉程式語言裡的功能(例如
whilp
迴圈)。如果刪掉特定功能而讓它不可能編寫永遠循
環的程式,它也就必須讓它不可能實作
#evaluate
精心設計以確保它們的程式一再停止的語言,稱為
總體程式語言
total programming
language
),相對於更傳統的
部分程式語言
partial programming language
),後者的程
式有時會與答案停止,有時候並不會。總體程式語言的能力還是非常強大,能夠表示許 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JSON實務手冊

JSON實務手冊

Tom Marrs

Publisher Resources

ISBN: 9789864766000