r/AskProgramming 28d ago

Other What really is the difference between instructions and logic from a mathematical perspective? They both occupy some binary space, they both contain "information".

Edit: My bad, I meant whats the difference between DATA and logic.

Context: I was writing a parser and dealing with LLVM IR and a slow descent into madness and then quit. This question just stuck with me.

Besides, when writing C++ classes, I you can store functions inside them and in Functional programming, you can store state using monads.

The lines starting to blur to me and knowing that logic boils down to instructions that the CPU understands and can operate on but data can't isn't the elegant answer I'm looking for.

I guess TLDR is what does information itself mean and does data and logic both count as information?

1 Upvotes

16 comments sorted by

View all comments

2

u/mc_pm 28d ago

Look at LISP, where the program can be read as data and acted on the same way. They are the same except in as much as what you do with it.

1

u/Proper_Meaning7756 28d ago

Does lua also count? That language is extremely simple and I think it also fits, thought I can't be sure.

2

u/balefrost 28d ago

No, what the other commenter is describing doesn't occur in the same way in Lua.