theory

Church Numerals: how to encode zero in lambda calculus?

I am learning lambda calculus but I cant seem to understand the encoding for the number 0. how is "function that takes in a function and a second value and applies the function zero times on the argument" a zero? Is there any other way to encode zero? Could anyone here help me encode 0? ...

Bootstrapping a compiler: why?

I understand how a language can bootstrap itself, but I haven't been able to find much reference on why you should consider bootstrapping. The intuitive answer is that the language you're writing offers utilities that are not found in the "base" language of the compiler, and the language's features are relatively well-suited for a compi...

Secret computing: does such an animal exist?

A question in theory of Computer Science Today I can secretly store files in the cloud (say, amazon s3), by having them encrypted before I store them and decrypt them after I download. The storage provider cannot obtain any information from the stored files - everything is encrypted safely, and even symmetrical cipher will be ok here. ...

C++ implicitly calling a function When? and How?

I have a couple questions. Are all functions inside of a class member functions? or only the ones preceded by the declaration "friend"? The significance of member functions are that they cannot be accessed by any other classes correct? What is the difference between an implicit and explicit call? Which functions can or cannot be imp...

How to handle theming of modules in a web application?

Hi, I have made a CMS that allows users to choose which modules to show where on the website. I also have templates/themes that define how the site look. The problem I have goes like this: Suppose I have placed a voting booth module on the site. When I press "View results", it will display the results with graphical bars like on this d...

Theory: Compression algorithm that makes some files smaller but none bigger?

I came across this question; "A lossless compression algorithm claims to guarantee to make some files smaller and no files larger. Is this; a) Impossible b) Possible but may run for an indeterminate amount of time, c) Possible for compression factor 2 or less, d) Possible for any compression factor?" I'm leaning ...

what is use of finite automata ?

What is the use of finite automata. And all the concepts that we study in the theory of computation. I've never seen their uses yet. ...

will reading compiler construction increase my programming skills?

will reading compiler construction increase my programming skills? ...

What is the shortest way to write parser for my language?

PS.Where to read about parsing theory? ...

Coinduction - clear, concise description

Hi, I am studying coinduction(not induction) as part of a class on static analysis. Rummaging around the internet, I am simply not finding clear, concise description of: What coinduction is How coinduction actually proves something(it seems that coinduction is like waving a magic hand in the treatments I've read) What propositions req...

Is there a general term for a pairing of tables where one has header information and the other has detail lines?

Is there a general term for a pairing of tables where one has header information and the other has detail lines? For example, a pair of tables describing sales orders, or a pair storing bill of materials data. ...

Understanding word alignment

I understand what it means to access memory such that it is aligned but I don’t understand why this is necessary. For instance, why can I access a single byte from an address 0x…1 but I cannot access a half word (two bytes) from the same address. Again, I understand that if you have an address A and an object of size s that the access i...

Optimization! - What is it? How is it done?

Its common to hear about "highly optimized code" or some developer needing to optimize theirs and whatnot. However, as a self-taught, new programmer I've never really understood what exactly do people mean when talking about such things. Care to explain the general idea of it? Also, recommend some reading materials and really whatever y...

Why is (a | b ) equivalent to a - (a & b) + b?

I was looking for a way to do a BITOR() with an Oracle database and came across a suggestion to just use BITAND() instead, replacing BITOR(a,b) with a + b - BITAND(a,b). I tested it by hand a few times and verified it seems to work for all binary numbers I could think of, but I can't think out quick mathematical proof of why this is cor...

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

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 ...

Asymptotic Notation - does n (log n) (log n) simplify?

If I have an algorithm that takes n log n steps (e.g. heapsort), where the steps take log n time (e.g. comparison/exchange of "big" integers in the range 0 to n-1), what is the asymptotic bound for the whole process. Obviously we can say "n (log n) (log n)", but I'm having a hard time trying to convince myself that I cannot simplify thi...

Can liftM differ from liftA?

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 whe...

What really is 'good enough' for a late project?

It seems like management always is saying how the project is late, then we have to figure out what is good enough to go live fast. The problem I find is that we tend to focus on the features that the client wants more than some basic features that I would think a web app should just have by it's very nature. For example we spent more t...

Pros and Cons explicitly setting enum field's values

Is it preferable to explicitly set enum's fields instead of just defining their names? E.g. any pros and cons for Enum1 vs Enum2? Enum1: enum SomeEnum { Something1 = 0, Something2 = 1 } Enum2: enum SomeEnum { Something1, Something2 } P.S. This question doesn't relates to enums that would be stored in database, which i...

What are the overall most valuable/profitable programming expertises?

Hi, I would like to know if it's possible to point it out, and if so If anyone would know to summarize, considering things well beyond the basics and expectable of course, what would be nowadays the overall or statistical most highly regarded pieces of technical knowledge I better have if I wanna improve my chances of getting the highes...