Programming

on fundamental matters such as existence, knowledge, values, reason, mind and ethics.

Moderators: kiore, Blip, The_Metatron

Re: Programming

#21  Postby stalidon » Mar 10, 2012 11:15 am

VazScep wrote:I'm considering industry at some point. There are jobs out there where they're using this stuff. I have friends who code in ML for their day-job, and many of the general ideas are leaking through into mainstream languages. C# is totally mainstream, and is a pretty damn interesting language, precisely because of the amount of influence it's had from functional programmers working at Microsoft Research.

Still, I think I could have fun just doing this stuff in my spare time. The perl-mongers here in Edinburgh, and half the people who attend our functional programming meetup are in industry, and they're all interested in this sort of stuff.


Yeah, as I said... it depends on how CS-literate your boss turns up to be. Perhaps it's better now than it used to be. The 'industry' in the US seemed to suck pretty much, hence Dilbert. ;)
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#22  Postby stalidon » Mar 10, 2012 11:17 am

advaitya wrote:I fail to see the philosophy in this thread? Ought to be shoved in some other appropriate forum.


Just wait, the philosophy is coming. From Wiki: "Lambda calculus has applications in many different areas in mathematics, philosophy, and computer science."
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#23  Postby VazScep » Mar 10, 2012 11:55 am

mizvekov wrote:Well, there is a lot of people out there really pumped with all this new stuff, and if you look around, say for instance in github, you will see the place is choke-full of people creating new libs that solve problems already handled by well established ones, except that by doing it the c++11 way. Some of it is promising, some of it looks like shit, but it's only wait and see now.
About the old libraries, well that varies a lot. There has not been a lot of time since the spec got published, and there is no fully conformant compiler / STL implementation yet. Lot's of libraries in boost for instance have been updated to accept and work well with the new additions, but there are still rough edges and not every new feature has been exploited yet.
But still you have got other libraries like Qt which are still using pretty ancient c++ lingo, and still uses that infamous preprocessor called 'moc', for things that could be done just using the standard lib. I've read on their mailing list that they have committed themselves to supporting at least the new stuff which only requires superficial changes and which can be optional, but I guess they still have to support ancient platforms with no hope of ever seeing a c++11 compliant compiler, so I venture to say that no radical changes in the API are to be expected for years to come. Plus their codebase is pretty huge...
Interesting. I thought that GTK was the C library and Qt very much the modern C++ library. I suppose they've been around long enough to both be "outdated" in their own ways.

Though since using languages outside the C family, I've come to appreciate technologies like GTK and OpenGL, which use such simple C code that they become almost trivial to bind to from other languages.

VazScep wrote:Yes, but the Java guys haven't been always successful at that. Last I checked, their GUI situation was a mess, with AWT, swing, SWT etc still competing. But then looking at that side, the other languages do not fare better, except perhaps C#.
Ugh. No fucking idea, but you might well be right about Java's GUI situation. But I'm not sure Microsoft is doing any better. While looking into GUI development on Windows, I was put off by how quickly Microsoft moved from Windows Forms to Windows Presentation Foundation, and by rumours that Microsoft might be ditching Silverlight and moving to Javascript, and then with their rehaul of the look and feel of their widgets with Windows 8. I've read numerous concerns from developers saying "what does Microsoft want us to use?"

GUIs to me seem like a problem that no-one in the software industry has ever really figured out, possibly because a user's expectations of a GUI aren't particularly amenable to precise engineering. I'm only messing around with GUIs as part of a hobby project, and I'm doing it in Ocaml using the Ocsigen framework, which has so far blown me away. But even their framework has yet to commit on using callbacks for event handling or to go with the more declarative reactive frameworks.

VazScep wrote:Well, to be 'fair' to them, that was their introductory course to programming, but you would rarely see it again later in the course. I don't think any of the professors had a vested interest in it, I don't remember seeing anything being published on the matter.
Ah, okay. It would probably vary with the universities anyway. Being at Edinburgh, ML and Haskell are a pretty big deal. Phil Wadler's the professor of computer science here, a position once held by Robin Milner.

Well, if you're interested at all in formal logic, the original inspiration for ML and its earliest applications (such as Logic of Computable Functions) are still, IMO, some of the smartest and coolest examples of functional programming engineering and awesome uses of type abstraction and higher-order functions. I can throw some simple Haskell code your way if you're interested.
Sure I am, thanks :)
Cool. Well, I don't know if I'm going to be able to explain it very well. But here's the most basic idea. Suppose you want to prove stuff in propositional logic. You could do this by writing a SAT solver, but this has a few drawbacks: firstly, the code is probably going to be very complicated, and there's every chance it will contain the odd bug, which is useless for mission-critical verification; secondly, it's not going to scale to logics which are undecidable, such as first-order logic. So you instead work from axiomatics. It turns out that everything in propositional logic can be proven by instantiating the following axioms, and applying modus ponens appropriately:

1) P -> (Q -> P)
2) (P -> Q -> R) -> (P -> Q) -> (P -> R)
3) (~P -> ~Q) -> (Q -> P)

You can code this up as follows:

Code: Select all
-- An encapsulated logical kernel for a Hilbert-style Propositional Calculus

module Propositional (Theorem, Term(..), axiom1, axiom2, axiom3, mp, instTerm, inst,
                      theoremTerm) where

infixr 8 :=>:

data Term a = Var a
            | Term a :=>: Term a
            | Not (Term a)
            deriving (Show,Eq,Ord)

newtype Theorem a = Theorem (Term a) deriving (Eq, Ord, Show)

theoremTerm :: Theorem a -> Term a
theoremTerm (Theorem t) = t

(p,q,r) = (Var "p",Var "q",Var "r")

axiom1 :: Theorem String
axiom1 = Theorem (p :=>: q :=>: p)

axiom2 :: Theorem String
axiom2 = Theorem ((p :=>: q :=>: r) :=>: (p :=>: q) :=>: (p :=>: r))

axiom3 :: Theorem String
axiom3 = Theorem ((Not p :=>: Not q) :=>: q :=>: p)

mp :: Eq a => Theorem a -> Theorem a -> [Theorem a]
mp (Theorem (p :=>: q)) (Theorem p') = [Theorem q | p == p']
                                                 
instTerm :: (a -> Term b) -> Term a -> Term b
instTerm f (Var p)    = f p
instTerm f (Not t)    = Not (instTerm f t)
instTerm f (a :=>: c) = instTerm f a :=>: instTerm f c

inst :: (a -> Term b) -> Theorem a -> Theorem b
inst f (Theorem t) = Theorem (instTerm f t)
Here, the syntax of propositional logic is captured by a simple data-type. The theorems are encapsulated as a type "Theorem" whose data constructors we do not export. Thus, the only theorems that clients can construct are "axiom1", "axiom2", "axiom3"; instantiations of the form "instTerm f thm"; and theorems resulting from modus ponens. It is impossible for a client to ever construct a theorem such as "p -> ~p", since this is not a tautology. The only theorems that can be constructed are precisely the theorems of propositional logic.

This is called a "logical kernel" and the advantage of it is that it is made up of very little code and it is easy to verify as bug-free (there isn't even a single loop to consider). So the security of the code here is very secure. You can be sure that clients cannot use this code in ways to generate non-theorems.

On top of this, you wrap a whole load of additional functionality, probably culminating in a complete tautology-checker. But the great thing about the tautology-checker is that its outputs are guaranteed correct with respect to the kernel. The tautology checker would probably input a Term, and if the term is a tautology, it would output a Theorem. And since the only ways to construct theorems are to apply the rules of kernel, you can be absolutely sure that if it does output a theorem, that theorem really is a tautology.

This is just the beginning. The design of the proof tools you build on top are something else.
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#24  Postby VazScep » Mar 10, 2012 11:57 am

stalidon wrote:Just wait, the philosophy is coming. From Wiki: "Lambda calculus has applications in many different areas in mathematics, philosophy, and computer science."
I originally mentioned lambda calculus and Haskell to simultaneously give a semantics to existential quantifiers in logic and to models of axiomatic theories in mathematics, the latter having been brought up by someone wondering what models are in science.

I'd say there is plenty of philosophy in programming language design. You're trying to come up with a language for (computationally) modelling just about anything in the world you might be interested in. Just by considering ML references, we can mirror the whole conversation in the philosophy of language concerning referential opacity, sense versus reference, use-versus mention and context.

I consider it a boon that the whole conversation is tethered to engineering concerns. It makes sure we don't go floating away into the clouds of vacuous wibble.
Last edited by VazScep on Mar 10, 2012 12:20 pm, edited 2 times in total.
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#25  Postby VazScep » Mar 10, 2012 12:04 pm

mizvekov wrote:By the way, since we were talking about cool new c++ features, here is another one of my favorites:
Example code of the new random number library, much more powerful and modular:
Code: Select all
// 1.0 is the lambda parameter of the exponential distribution
auto random = std::bind(std::exponential_distribution<double>(1.0), std::default_random_engine());
for (;;)
      std::cout << random() << std::endl;
Okay, so exponential_distribution is a first-class function? And one thing we're seeing here is the use of templates to parameterise a first-class function? And presumably, there is also partial specialisation going on, to tailor the implementation to doubles as opposed to some other type?

Can you use bind with any function, or does it have to be declared in a special way? And how does this interact with the object system? Can I get a virtual function of a class as a first-class function, and have it close over its instance?

Will generate numbers like:
Code: Select all
0.330217
3.44907
0.208902
1.28924
0.838482
0.549105
0.0226059

Pretty hard to beat that in elegance :grin:
The modular design means that you can use other generators, like the other pseudo-random ones included in the standard lib, or roll your own, be that another pseudogen, or even one based on reading /dev/random (for unix systems) or which communicates directly with a hardware RNG.
And you can combine any of those with any probability distribution, such as the ones included in the standard (there are several others, like uniform, normal, binomial), or again, create your own.

Pretty neat huh? :grin:
That is very sweet. Have you compared it much to the random generators in Haskell? It looks pretty competitive in terms of expressive power (speedwise, forget it).
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#26  Postby VazScep » Mar 10, 2012 12:10 pm

stalidon wrote:Yeah, as I said... it depends on how CS-literate your boss turns up to be. Perhaps it's better now than it used to be. The 'industry' in the US seemed to suck pretty much, hence Dilbert. ;)
A friend of mine recently posted a joke on Google+ talking about what CS-literate programming bosses are looking for in their employees. Having a phd was considered a strike against you :ill:

I've been told that programming managers can be complete shite, often having been pulled in from projects unrelated to IT. Last time I got a job offer through an agency, I was told how great it was going to be working under the management of expert programmers. The agent said he'd recently put a bunch of applicants into positions where the management didn't let employees talk to one another, or as he assumed "distract one another."

Then there is that whole "mythical man-month" of managerial incompetence. This project will take 10 man-months. Okay, I'll set 20 people on it, and we'll be done in a fortnight! :drunk:
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#27  Postby jamest » Mar 10, 2012 12:17 pm

This is probably a stupid question, but why are there so many programming languages? Why not just use one?
Il messaggero non e importante.
Ora non e importante.
Il resultato futuro e importante.
Quindi, persisto.
jamest
 
Posts: 18934
Male

Country: England
Jolly Roger (arr)
Print view this post

Re: Programming

#28  Postby VazScep » Mar 10, 2012 12:45 pm

jamest wrote:This is probably a stupid question, but why are there so many programming languages? Why not just use one?
Why don't we just have the one operating system, or the one web-browser, or the one GUI framework, or the one database system, or the one political party or the one religion? The answer is because people are ignorant and can't think for themselves, and they usually just stick to the first bit of crap that they learn as kids, or the nonsense they got from their college professors. If there was any sense in the world, we'd all be using Gentoo Linux, w3m, programming in ML with Ocsigen using mysql, and we'd all be voting for the Green Party and believing in Zeus.

Seriously, it's just that in computing, like with so many things, we haven't figured out how to definitively solve our problems. But it hasn't stopped people coming up with more and more solutions and gathering more and more adherents around them.

For myself, the only heated and highly unpleasant conversations I've had in the pub with friends have been about programming. Don't bring that shit up at the dinner table.
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#29  Postby jamest » Mar 10, 2012 1:36 pm

VazScep wrote:
For myself, the only heated and highly unpleasant conversations I've had in the pub with friends have been about programming. Don't bring that shit up at the dinner table.

I hadn't realised that heated debates about programming were possible. I must get into this business!
Il messaggero non e importante.
Ora non e importante.
Il resultato futuro e importante.
Quindi, persisto.
jamest
 
Posts: 18934
Male

Country: England
Jolly Roger (arr)
Print view this post

Re: Programming

#30  Postby stalidon » Mar 10, 2012 7:21 pm

jamest wrote:
VazScep wrote:
For myself, the only heated and highly unpleasant conversations I've had in the pub with friends have been about programming. Don't bring that shit up at the dinner table.

I hadn't realised that heated debates about programming were possible. I must get into this business!


:rofl: :rofl: :rofl: :rofl: :rofl:

(Not laughing at you jamest, but to even considering that idea in my head.)

Programming, especially the programming 'industry' is plagued with religious wars about whats the best OS, programming paradigm, programming team management methodology, etc. The ironic part is, of course, it's all about what's the 'perfect toy'. There's absolutely no science in 'what's the best methodology to build a Lego tower'.
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#31  Postby stalidon » Mar 10, 2012 7:28 pm

VazScep wrote:
stalidon wrote:Just wait, the philosophy is coming. From Wiki: "Lambda calculus has applications in many different areas in mathematics, philosophy, and computer science."
I originally mentioned lambda calculus and Haskell to simultaneously give a semantics to existential quantifiers in logic and to models of axiomatic theories in mathematics, the latter having been brought up by someone wondering what models are in science.

I'd say there is plenty of philosophy in programming language design. You're trying to come up with a language for (computationally) modelling just about anything in the world you might be interested in. Just by considering ML references, we can mirror the whole conversation in the philosophy of language concerning referential opacity, sense versus reference, use-versus mention and context.

I consider it a boon that the whole conversation is tethered to engineering concerns. It makes sure we don't go floating away into the clouds of vacuous wibble.


Yeah, and that's were my interest in this thread resides ;) I have no idea how lambda calculus is applied in philosophy, but we shouldn't move it to the 'Social & Fun' area of the forum... I think the programming mind-set has a lot to offer in philosophical matters.

As I said, I never finished uni, and I never had to apply any math theory in my work (and I did have to code some systems which probably required me to invent mathematical theories by myself which probably have names in the textbooks). But I'd love to learn CS at the abstract level, especially now that I don't need to code myself unless it's totally for my own entertainment ;)
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#32  Postby VazScep » Mar 10, 2012 7:29 pm

stalidon wrote:There's absolutely no science in 'what's the best methodology to build a Lego tower'.
Hence why you used "religious wars" in your first sentence.
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#33  Postby stalidon » Mar 10, 2012 7:41 pm

VazScep wrote:
stalidon wrote:Yeah, as I said... it depends on how CS-literate your boss turns up to be. Perhaps it's better now than it used to be. The 'industry' in the US seemed to suck pretty much, hence Dilbert. ;)
A friend of mine recently posted a joke on Google+ talking about what CS-literate programming bosses are looking for in their employees. Having a phd was considered a strike against you :ill:

I've been told that programming managers can be complete shite, often having been pulled in from projects unrelated to IT. Last time I got a job offer through an agency, I was told how great it was going to be working under the management of expert programmers. The agent said he'd recently put a bunch of applicants into positions where the management didn't let employees talk to one another, or as he assumed "distract one another."

Then there is that whole "mythical man-month" of managerial incompetence. This project will take 10 man-months. Okay, I'll set 20 people on it, and we'll be done in a fortnight! :drunk:


Yup. Big IT companies tend to treat programmers as monkeys. I think your best bet would be to land a job on a company that takes programmers seriously, and those tend to be the ones run by programmers. Probably something like Joel's Fog Creek Software.

If you want a terribly contrasting view of CS Academia vs the 'Industry', check http://www.dbdebunk.com/about.html . I don't recommend reading too much of Pascal's diatribes in one sitting though, it might turn you into a suicide bomber for the cause of Truth.
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#34  Postby think » Mar 10, 2012 7:43 pm

So does anyone care to say how programming is relevant to philosophy/why this thread is in the philosophy section?
think
 
Posts: 628

Print view this post

Re: Programming

#35  Postby stalidon » Mar 10, 2012 8:03 pm

Well, this started when we were talking about model-dependent realism in the other thread. We could build a whole structure of meta-models for MD realism with dependency injection, in an abstract library, and feed them to an evolving neural network in digital space. If we then up the level of abstraction we'd probably be talking about what kind of 'concepts' the neural net form about it's reality when we through models at it.

That is, my only reason for wanting it to stay in the Philosophy section is that we probably will be able to talk about some intricate philosophical problems in a language that, despite technical, makes sense to someone with programming knowledge. I suspect professional philosophers in the p of mind department or the formal logic department talk at this level of technicality when dealing with their subjects too.

(My digressions into the state of the 'industry' are slightly off-topic here, my hope being that we abstract from the level of tools to the theoretical-scientific level)
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#36  Postby think » Mar 10, 2012 8:10 pm

Can you give an example of a philosophical problem or question concerning which a computer program might facilitate our thinking?
think
 
Posts: 628

Print view this post

Re: Programming

#37  Postby stalidon » Mar 10, 2012 8:39 pm

C
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#38  Postby stalidon » Mar 10, 2012 8:44 pm

I'm not being 'categorical' about this, by all means they should move the thread to another section if they want... As I said my only interest is in talking about philosophy in CS terms, and if they move the thread that probably won't happen, but it's not like I care too much about it, just seems interesting.

(And C, as in consciousness... CS (computing science) is sometimes enumerated as one of the branches of science contributing to neuroscience (along with neurology, evolutionary psychology, etc.)
-
stalidon
 
Posts: 145
Age: 49
Male

Country: Argentina
Argentina (ar)
Print view this post

Re: Programming

#39  Postby VazScep » Mar 10, 2012 9:40 pm

think wrote:Can you give an example of a philosophical problem or question concerning which a computer program might facilitate our thinking?
How about a philosophical field? You don't get very far in philosophy of mind as a naturalist unless you start talking about computer programs and computer simulations.

I, for one, would be happy to wax philosophical about sense/reference, intension/extension, use/mention, referential opacity/transparency, context and identity (all of which are terms in philosophy of language) in the context of programming languages, where all those distinctions are present and have real consequences in terms of representation.

When it comes to logic, I'm happy to wax philosophical all day about the Curry-Howard isomorphism.

I'm also happy to wax philosophical and say that lambda abstraction really is about abstraction and abstract objects, and get involved in that whole problem of universals. I'll also add that the lambda calculus was originally intended as a foundation for mathematics, in the same sense as Russell and Whitehead's Principia Mathematica. The equational theory of typed lambda terms still does very well here, with the non-equational fragment serving as a model of computation.

I'm not willing to take any of this stuff seriously, but then my presence in the philosophy forum is highly questionable as it is anyway.
Here we go again. First, we discover recursion.
VazScep
THREAD STARTER
 
Posts: 4590

United Kingdom (uk)
Print view this post

Re: Programming

#40  Postby jamest » Mar 11, 2012 12:17 am

Actually, if I knew enough about this stuff, it might have been useful in my recent language thread, where much of the discussion was about translation and codes. Computers and programs, generally, have been used by philosophers as analogies to the ways our brains work (or cannot work) - the Chinese Room argument, for instance, by Searle.
Il messaggero non e importante.
Ora non e importante.
Il resultato futuro e importante.
Quindi, persisto.
jamest
 
Posts: 18934
Male

Country: England
Jolly Roger (arr)
Print view this post

PreviousNext

Return to Philosophy

Who is online

Users viewing this topic: No registered users and 1 guest