theory

What exactly does homoiconicity mean?

被刻印的时光 ゝ 提交于 2019-12-03 09:28:50
问题 I was trying to understand the Wikipedia article on homoiconity, but it's too verbose and does not explain the main theory behind the word concisely. I should add that I'm not a native English speaker so I prefer simple English over academic white paper quotes. So, what exactly does it mean if a language is homoiconic? What makes C#, Java or JavaScript non-homoiconic? 回答1: It means "code as data" which is a general characteristic of Lisp family. (add 2 3) Just like above string, which is both

Graph Theory in Networkx

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am starting to use this interface now, I have some experience with Python but nothing extensive. I am calculating the transitivity and community structure of a small graph: import networkx as nx G = nx.read_edgelist(data, delimiter='-', nodetype=str) nx.transitivity(G) #find modularity part = best_partition(G) modularity(part, G) I get the transitivity just fine, however - there is the following error with calculating modularity. NameError: name 'best_partition' is not defined I just followed the documentation provided by the networkx site

Do theoretical computer science topics have “real world” development applications?

雨燕双飞 提交于 2019-12-03 05:53:05
问题 By "theoretical computer science topics", I am referring to things such as regular vs non-regular languages, the pumping lemma, and grammars. I'm familiar with the real world applications of finite automata and regular expressions, but topics such as these other ones are giving me more problems as I'm not seeing any real world applications. 回答1: These things are useful if you want to know whether trying to do something is futile with regular expressions. For example, knowing that XML is non

In terms of programming, what do semantics mean?

孤街醉人 提交于 2019-12-03 05:41:55
问题 This is a sentence from Eric Lippert's blog: Given that unfortunate situation, it makes sense to emphasize the storage mechanism first, and then the semantics second. It's easy to get a dictionary definition of what "semantic" means but what does it mean in terms of computer jargon? 回答1: but what does it mean in terms of computer jargon? Essentially the same thing. Example: x = 5; The above is the syntax (representation). The meaning (i.e. the semantics) of this term is to assign the value 5

Are GHC's Type Famlies An Example of System F-omega?

て烟熏妆下的殇ゞ 提交于 2019-12-03 05:11:31
问题 I'm reading up about the Lambda-Cube, and I'm particularly interested in System F-omega, which allows for "type operators" i.e. types depending on types. This sounds a lot like GHC's type families. For example type family Foo a type instance Foo Int = Int type instance Foo Float = ... ... where the actual type depends on the type parameter a . Am I right in thinking that type families are an example of the type operators ala system F-omega? Or am I out in left field? 回答1: System F-omega

Can liftM differ from liftA?

江枫思渺然 提交于 2019-12-03 04:46:23
问题 According to the Typeclassopedia (among other sources), Applicative logically belongs between Monad and Pointed (and thus Functor ) in the type class hierarchy, so we would ideally have something like this if the Haskell prelude were written today: class Functor f where fmap :: (a -> b) -> f a -> f b class Functor f => Pointed f where pure :: a -> f a class Pointed f => Applicative f where (<*>) :: f (a -> b) -> f a -> f b class Applicative m => Monad m where -- either the traditional bind

What are some good computer science resources for a blind programmer?

拟墨画扇 提交于 2019-12-03 03:32:52
问题 I'm a totally blind individual who would like to learn more of the theory aspect of computer science. I've had an intro data structures class and the general intro programming but would like to learn more on things such as software design, advanced data structures, and compiler design. I want to do this as a self study course not as part of college classes. Unfortunately there aren’t many text books available on computer science from Recordings for the Blind and Dyslexic where I normally get

Why is number of bits always(?) a power of two?

╄→гoц情女王★ 提交于 2019-12-03 03:25:50
问题 We have 8-bit, 16-bit, 32-bit and 64-bit hardware architectures and operating systems. But not, say, 42-bit or 69-bit ones. Why? Is it something fundamental that makes 2^n bits a better choice, or is just about compatibility with existing systems? (It's obviously convenient that a 64-bit register can hold two 32-bit pointers, or that a 32-bit data unit can hold 4 bytes.) 回答1: That's mostly a matter of tradition. It is not even always true. For example, floating-point units in processors (even

What do we call this (new?) higher-order function?

孤者浪人 提交于 2019-12-03 02:55:59
I am trying to name what I think is a new idea for a higher-order function. To the important part, here is the code in Python and Haskell to demonstrate the concept, which will be explained afterward. Python: >>> def pleat(f, l): return map(lambda t: f(*t), zip(l, l[1:])) >>> pleat(operator.add, [0, 1, 2, 3]) [1, 3, 5] Haskell: Prelude> let pleatWith f xs = zipWith f xs (drop 1 xs) Prelude> pleatWith (+) [0,1,2,3] [1,3,5] As you may be able to infer, the sequence is being iterated through, utilizing adjacent elements as the parameters for the function you pass it, projecting the results into a

Powerful algorithms too complex to implement [closed]

我的未来我决定 提交于 2019-12-03 02:48:43
What are some algorithms of legitimate utility that are simply too complex to implement? Let me be clear: I'm not looking for algorithms like the current asymptotic optimal matrix multiplication algorithm, which is reasonable to implement but has a constant that makes it useless in practice. I'm looking for algorithms that could plausibly have practical value, but are so difficult to code that they have never been implemented, only implemented in extremely artificial settings, or only implemented for remarkably special-purpose applications. Also welcome are near-impossible-to-implement