Learning Functional Programming For Improved C++11 style. Haskel, Lisp, or [closed] - haskell

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've never programmed in a "pure" functional language. I earned my stripes on C and C++, tried Java, C#, PHP etc... but always I found myself going back to C++. Perhaps I'm a bit of a masochist, but I love the low level stuff.
I also find that I can accomplish rapid development quickly through the embedding of LUA, Python or other scripting languages (along with their focus on rapid development).
Long story short, I'm not quitting C/C++ so don't talk me out of it. However I've had little time to learn C++11 and I'm starting to feel the acceleration of the curve towards functional programming happening in the future.
My question is twofold. What language was C++11's concept of lambda functionality "borrowed" from, and what language would be the ideal one, if not that one, or if any to get a feel for "the way" to use C++11's new lambda functionality (no pun intended).
PS: I'm honestly not too happy about the new "bloated" additions to C++. I liked C++ how it was, it's starting to feel like the language is becoming bloated. I won't clam that to be a fact; I hear you have to have experienced a functional language to "get it".
It honestly seems like there is a new heavyweight in town. First it was just "procedural" programming, then came the OOP paradigm shift, while now it seems like things are heading towards the "functional" way of doing things.
Of course procedural programming is still alive and well (inside classes), I have to wonder where the lambda way will fit in (properly used) to class/oop design. Will it just be a replacement for the procedural part? Make OOP a thing of the past (pfft)? Or something else entirely (say, a functional event system generating events for objects encapsulating procedural code)?

I would try to curtail your opinions until you have more rigorous experience of the issues involved.
To paraphrase Bjarne Stroustrup: Functional programming has had a lot of airtime in academia over the last several decades, yet the number of deployed functional systems in industry remains about zero.
More concretely to your question, a lambda is just a short-hand syntactic way to declare a singleton functor object (a class with an operator() function) that captures variables from its enclosing scope as member variables. I wouldn't consider it a "functional programming" concept, any more so than any other entity in C++.
Functional programming generally involves immutable data types (objects that dont change once constructed) and pure functions (functions that have output that depends purely on their input, and nothing else).
If you are interested in functional programming there is a free online course (MOOC) starting right now called Functional Programming Principles in Scala, that serves as a very good and highly regarded introduction to the subject from one of the top Swiss universities.

I can't speak about lambdas in C++11, but I know that part of the rationale for adding lambdas to Java 8 is to enable transparent concurrency support out of the box. How? It provides a (lazy) Stream interface where you can switch between parallel and sequential processing simply by calling parallel and sequential (these methods return new streams, and do not have side effects on existing streams).
If you look at the methods in Stream, you'll quickly notice that without a lambda facility, they would be an extreme pain to use. Have a look at some examples of what you can do with streams in combination with lambdas.
It should be possible to implement a similar library for C++11, if there isn't already such a library.

Related

Guidelines for creating a programming-language enjoyable to write programs in? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently working on the topic of programming-languages and interpreter-design. I have already created several programming languages but couldn't reach my goal so far:
Create a programming-language which focuses on giving the programmer a good feeling when writing code in it. It should just be fun and/or interesting and in no case annoying to write something in it.
I get this feeling when writing code in Python. I sometimes get the opposite with PHP and in rare cases when having to reinvent some wheel in C++.
So I've tried to figure out some syntactical features to make programming in my new language fun, but I just can't find any.
Which concrete features, maybe mainly in terms of syntax, do/could make programming in a language fun?
Examples:
I find it enjoyable to program in Ruby because of it's use of code blocks.
It would be nice if you could include exactly one example in your answer
Those features do not have to already exist in any language!
I'm doing this because I have experienced extreme rises in (my own) productivity when programming in languages I love (because of particular features).
You mentioned Ruby in your question. AFAIK, Ruby is the only programming language, for which Joy is an actual, stated, explicit design goal. (In fact, it is the only design goal.)
The reason that Yukihiro Matsumoto was able to design Ruby this way, is that he already knew and used tons of programming languages before he started designing Ruby and learned tons more in order to design Ruby. (Interestingly, he didn't know Python, and has said that he probably wouldn't have created Ruby if he did.)
Here's just a tiny fraction of the languages that matz has either used himself, or looked at for inspiration (or in some cases for inspiration what not to do):
CLU
Sather
Lisp
Scheme
Smalltalk
Perl
Python
Haskell
Scala
PHP
C
C++
Java
C#
Objective-C
Erlang
And I believe that this is one way that good programming languages can be designed (what Larry Wall calls postmodernist language design): Throw away everything that didn't work in the past, take everything that worked and combine that tastefully.
Of course, this requires that you actually know all those languages from which you want to "steal" and in particular, it requires that you know lots of very different languages with different paradigms, different concepts and different "feels", otherwise the idea pool from which you steal is rather small and inbred.
Consistency.
Its the feeling that you already know something when you use an API or feature you've never used before. It also makes you more productive as you don't have to learn something new for the sake of it.
I think this is also one of the Ruby 'likes', in that if you follow the naming convention, things start to 'just work' without bindings and glue and suchlike.
For example, using the STL in C++, many of the algorithms are the same for all containers - even strings. That makes it nice to use... except for those parts that do not follow the same API (eg vector of bools) then the difference is more noticable.
Two things to keep in mind are orthogonality and the principle of least surprise.
A programming language should make it easy to write correct programs and difficult (if not impossible) to write incorrect programs. For instance, in Java
long x = 2000000000 + 2000000000;
overflows, while
long x = 2000000000L + 2000000000;
doesn't. Is this obvious? I don't think so. Does anyone ever want something to overflow? I don't think so.
Hilarity.
http://lolcode.com/
Follow common practices (like using + for addition, & for bitwise/logical and)
Group logicaly-similar code in namespaces
Have an extensive string processing library
Incorporate debugging facilities
For a cross-platform language, try to minimize platform differences as much as possible
A language feature that appears simple and easy to learn surprises and delights the programmer with its unexpected power. I nominate Haskell type classes :-)

What is Haskell used for in the real world? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
There is a lot of hype around Haskell, however, it is hard to get information on how it is used in the real world applications. What are the most popular projects / usages of Haskell and why it excels at solving these problems?
What are some common uses for this
language?
Rapid application development.
If you want to know "why Haskell?", then you need to consider advantages of functional programming languages (taken from https://c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming):
Functional programs tend to be much more terse than their ImperativeLanguage counterparts. Often this leads to enhanced
programmer productivity
FP encourages quick prototyping. As such, I think it is the best software design paradigm for ExtremeProgrammers... but what do I know?
FP is modular in the dimension of functionality, where ObjectOrientedProgramming is modular in the dimension of different
components.
The ability to have your cake and eat it. Imagine you have a complex OO system processing messages - every component might make state
changes depending on the message and then forward the message to some
objects it has links to. Wouldn't it be just too cool to be able to
easily roll back every change if some object deep in the call
hierarchy decided the message is flawed? How about having a history of
different states?
Many housekeeping tasks made for you: deconstructing data structures (PatternMatching), storing variable bindings (LexicalScope with
closures), strong typing (TypeInference), GarbageCollection, storage
allocation, whether to use boxed (pointer-to-value) or unboxed (value
directly) representation...
Safe multithreading! Immutable data structures are not subject to data race conditions, and consequently don't have to be protected by
locks. If you are always allocating new objects, rather than
destructively manipulating existing ones, the locking can be hidden in
the allocation and GarbageCollection system.
Apart from this Haskell has its own advantages such as:
Clear, intuitive syntax inspired by mathematical notation.
List comprehensions to create a list based on existing lists.
Lambda expressions: create functions without giving them explicit names. So it's easier to handle big formulas.
Haskell is completely referentially transparent. Any code that uses I/O must be marked as such. This way, it encourages you to separate code with side effects (e.g. putting text on the screen) from code without (calculations).
Lazy evaluation is a really nice feature:
Even if something would usually cause an error, it will still work as long as you don't use the result. For example, you could put 1 / 0 as the first item of a list and it will still work if you only used the second item.
It is easier to write search programs such as this sudoku solver because it doesn't load every combination at onceā€”it just generates them as it goes along. You can do this in other languages, but only Haskell does this by default.
You can check out following links:
https://c2.com/cgi/wiki?AdvantagesOfFunctionalProgramming
https://learn.microsoft.com/archive/blogs/wesdyer/why-functional-programming-is-important-in-a-mixed-environment
https://web.archive.org/web/20160626145828/http://blog.kickino.org/archives/2007/05/22/T22_34_16/
https://useless-factor.blogspot.com/2007/05/advantage-of-functional-programming.html
I think people in this post are missing the most important point for anyone who has never used a functional programming language: expanding your mind. If you are new to functional programming then Haskell will make you think in ways you've never thought before. As a result your programming in other areas and other languages will improve. How much? Hard to quantify.
There is one good answer for what a general purpose language like Haskell is good for: writing programs in general.
For what it is used for in practice, I've three approaches to establishing that:
A tag cloud of Haskell library and app areas, weighted by frequency on Hackage.
Indicates that it is good for graphics, networking, systems programming, data structures, databases, development, text processing ...
Areas it is used in industry - a lot of DSLs, web apps, compiler design, networking, analysis, systems programming , ...
And finally, my opinion on what it is really strong at:
Problems where correctness matters, domain specific languages, and parallel and concurrent programming
I hope that gives you a sense on how broad your question is, if it is to be answered with any specificity.
One example of Haskell in action is xmonad, a "featureful window manager in less than 1200 lines of code".
From the Haskell Wiki:
Haskell has a diverse range of use
commercially, from aerospace and
defense, to finance, to web startups,
hardware design firms and lawnmower
manufacturers. This page collects
resources on the industrial use of
Haskell.
According to Wikipedia, the Haskell language was created out of the need to consolidate existing functional languages into a common one which could be used for future research in functional-language design.
It is apparent based on the information available that it has outgrown it's original purpose and is used for much more than research. It is now considered a general purpose functional programming language.
If you're still asking yourself, "Why should I use it?", then read the Why use it? section of the Haskell Wiki Introduction.
Haskell is a general purpose programming language. It can be used for anything you use any other language to do. You aren't limited by anything but your own imagination. As for what it's suited for? Well, pretty much everything. There are few tasks in which a functional language does not excel.
And yes, I'm the Rayne from Dreamincode. :)
I would also like to mention that, in case you haven't read the Wikipedia page, functional programming is a paradigm like Object Oriented programming is a paradigm. Just in case you didn't know. Haskell is also functional in the sense that it works; it works quite well at that.
Just because a language isn't an Object Oriented language doesn't mean the language is limited by anything. Haskell is a general-purpose programming language, and is just as general purpose as Java.
I have a cool one, facebook created a automated tool for rewriting PHP code. They parse the source into an abstract syntax tree, do some transformations:
if ($f == false) -> if (false == $f)
I don't know why, but that seems to be their particular style and then they pretty print it.
https://github.com/facebook/lex-pass
We use haskell for making small domain specific languages. Huge amounts of data processing. Web development. Web spiders. Testing applications. Writing system administration scripts. Backend scripts, which communicate with other parties. Monitoring scripts (we have a DSL which works nicely together with munin, makes it much easier to write correct monitor code for your applications.)
All kind of stuff actually. It is just a everyday general purpose language with some very powerful and useful features, if you are somewhat mathematically inclined.
From Haskell:
Haskell is a standardized, general-purpose purely functional
programming language, with
non-strict semantics and strong static
typing. It is named after logician
Haskell Curry.
Basically Haskell can be used to create pretty much anything you would normally create using other general-purpose languages (e.g. C#, Java, C, C++, etc.).
For example, for developing interactive, realtime HTML5 web applications. See Elm, the compiler of which is implemented in Haskell and the syntax of which borrows a lot from Haskell's.
This is a pretty good source for info about Haskell and its uses:
Open Source Haskell Releases and Growth

Haskell vs. procedural programming in the real world [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
These days I'm getting seriously into functional programming.
While I'm really excited about Haskell and the possibilities it seems to offer, I can also see now that it is going to take me a while to learn. In an SO question on How to learn Haskell an answer states that it'll take months if not years to actually "master" it.
Now, I know C, PHP, some object oriented stuff, etc. And having been told that Haskell isn't much used out there in "the real world", will I be better off improving my skills in the regular languages I know? Is Haskell worth the struggle?
In this question on Why people think functional programming will catch on the conclusion seems to be that functional programming will "catch on". But surely procedural programming will stay on top, right?
EDIT: keparo nicely clarifies my question to: As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?
Haskell isn't as hard as people like to make out to learn. Haskell opens up a new world that you never knew existed for you. It's as valuable to learn as any other language. You might not find a job requiring you to do Haskell programming, but does that really mean a language isn't valuable?
Haskell will teach you a lot of new stuff, and it will show you how to program even better in the languages you /do/ work with. You can do your own personal projects in your spare time with it.
Haskell isn't really used much in the "real world" if you define "real world" as "cash generator". So if that is your objective, then you might have to rethink objectives :p
Also, I don't really like that part of chosen "how to learn haskell" answer. It takes months to years to master any language, not just Haskell. Depending on how you define "master". I can use Haskell to a pretty good degree of efficiency and I've only been learning it for a month, and I've been taking it slow even.
If nothing else, the change in mindset that learning Haskell provides will help you when you have to go back to using those procedural languages that still are used in the workplace.
The functional paradigm is beginning to make it's way into various mainstream applications and languages - Even C++ is going to be adding a (crippled) lambda in C++0x.
You may also want to look at some of the hybrid languages like Scala or OCaml. Scala is being used at Twitter, and OCaml is being used at Jane's Street in a financial trading platform.
I learned Haskell because it was by far the best functional language that I tried out of Scala, Clojure, OCaml and Scheme but I didn't seriously expect to use it for work.
As it turns out, it is perfect for those sorts of odd jobs that are too small for a team and would be just too time consuming in Java. So far, I've used it for ad-hoc data migrations i.e. mangling CSV exports into another format, batch conversions of XML (HXT is more concise and more powerful than XSLT), screen-scraping off the internet and software project estimating including modelling risk using the probability monad and producing optimum gantt charts using backtracking. This is all real work that needed doing, that I wouldn't have even bothered to try and do in Java as it would be a multi-day undertaking.
I now use it instead of Excel for anything vaguely mathematical as it is little more effort to create a list of values in haskell source in a text editor than it is to type them into Excel. Once in haskell, I can then do all sorts of magic like backtracking, probability distributions etc. that Excel can't do. If I need a graph then I spit the values out as CSV (2 lines of code) and load them into Excel.
The only downside is that it does take several months to get proficient, but worth the effort IMHO.
You probably shouldn't expect to use Haskell anywhere nearly as often as a C family language in professional settings. If the question is whether it will be valuable for you to study Haskell and functional programming paradigms, the answer is yes. You can apply your enriched understanding of programming to all of your work.
As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?
If having an expanded skill set is valuable, then: yes.
One advantage you might pick up: parallel and concurrent programming. Procedural languages of the past tend to have no clear notion of side effects, as a result writing parallel programs in them is difficult to do correctly. Functional languages (in particular, ones that limit side effects like Haskell) have a lot more to say about productive parallel programming.
Having that skill up your sleeve can't hurt.
As opposed to procedural languages, will it be valuable for me to study Haskell and functional programming paradigms?
Not unless you want to be miserable. Luke Plant says, in Why learning Haskell/Python makes you a worse programmer:
So, learning Python and Haskell has demoralised me and encouraged
me to write code that is bizarre and difficult to understand...
(This is not entirely a joke.)
I can see that functional programming can be a plus in a production environment if it's very easy to use by non functional code. MS could see that too when they came up with F# I guess.
Since they both compile to IL, you can handle problems that ask for a functional approach functional and use those solutions very easily in your procedural code.
In that way functional code can easily find its way in a production environment a bit at a time
Therefore, and since the userbase of MS is that big, my guess is that if F# will not catch on in the very near future, that Haskell won't either.
I think it's worth the struggle. It will help you to understand how problems are solved and not only how a computer works.
Maybe one particular problem is Haskell itself - As a purely functional language, it's kinda "hardcore" which may on the other hand even complicate things.
Functional programming instead may be extremely useful in a very pragmatic manner - Many OO/imperative languages have now included functional elements for this reason (Linq, anonymous functions, readonly values, function pointers/delegates, type-inference): You can concentrate on what should be done which allows you to express more in less code (that is even less error-prone).
Non-purely functional languages (standard functional languages) like Scala or F# can be integrated easily into existing Java or .NET-projects, so you can combine the benefits of both paradigms where they are needed. For typical advantages of functional languages, see this thread. Just think of extremely powerful parsing (Monadic parser combinators / Parsec) or concurrent programming that is possible with functional languages and you'll see how useful they are.
Broadening your horizons helps you be a better programmer no matter what language you happen to be using at the moment. You'll never look at programming the same way after you've written Lisp macros, for instance. After you begin to think in Haskell terms, you'll find yourself composing functions and wishing for closures in less advanced languages.
Judging from goodies in C# such as lambdas, type inference, closures, and so on, learning Haskell will give you a leg up on tomorrow's cutting edge in mainstream languages.
Some people enjoy programming in Haskell. If you can choose your environment, and enjoyment is a consideration, then maybe you should hop in.
Many programmers are not in position to choose their tools and enjoyment is not a factor for their choices. Many of them get to use C/Java/etc at their workplace for the "core project source", but then also choose or need to use Python for "scripts" such as build-scripts with SCons, other scripts that generate Java/etc code, testing systems, proofs-of-concepts, etc.. And in other places Python is also used in the "core project".
In 8 years, it will be Haskell, not Python, which will be "coming to you". But you can come to it sooner.
You can combine the use of functional programming and be pragmatic about the language.
All modern scripting languages s.a. JavaScript or Lua allow use of the functional paradigm.
The functional concept is coming on strong. Note the flurry of activity and interest around Ruby. I've also noticed a bit more interest in JavaScript beyond a mere browser scripting language lately. You can get ahead of the game by diving in now, though the time invested might not pay off this year or next.
It depends on your general game plan. Are you into programming as an end in itself or as a means to an end? If it's the former, go nuts with Haskell. If the latter, stick with mainstream, "employable" languages. Wait for Haskell to take off and then pounce.
Why procedural and not Object Oriented, not seen procedural being used for many years apart from C.
Commercially speaking. I would go with Java or C#. Doesn't really matter which they both pay well and the skills are interchangeable with other like minded languages such as python, Ruby and JavaScript.
Haskell is worth the time and effort, although it is very academic, some banks use it, although many in Europe and the UK are moving the code base over to F#.
I don't think FOP will be moving at great speeds commercially speaking. But the techniques are definitely making an appearance in the main stay languages. Especially with Multi-Core chip designs and making code run parallel on them.

How can future programming languages better facilitate abstraction? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
One of the key properties to designing comprehensible software (and, indeed, designing anything at all) is to develop a good set of abstractions. These days, those abstractions include things like functions, classes, interfaces, recursion, and higher-order functions. But what else is there? How can we further abstract our designs, so that I needn't think about anything but my immediate, direct goal? What novel abstractions have yet to be leveraged by existing technologies?
Also note that most of the items on my list (with the exception, perhaps, of recursion) are also tools used for code reuse. Code reuse is not the subject of this question, and is not what I see as a necessary aspect of a good abstraction. Functions are useful as abstractions because they hide what they are doing behind a descriptive name, not because I can call them from several different places.
A poorly-formed idea: Is a driver function that only calls a sequence of other functions, without maintaining any state of its own, really the same as a function? We write it as a function, and call it as a function, but perhaps it represents a different concept? This is reflected in some languages by making a distinctions between procedures returning values and procedures not returning values. But maybe there's a better way to view that difference, some different way to abstract the sequence of relatively unrelated steps?
So to reiterate, how can future programming languages better facilitate abstraction?
A powerful absraction tool, Lisp macros. Why not look into the past and present? :)
They can use self-exposing semantics to better allow metaprogramming of the environment/language presented as the end-user interface. Mutable language semantics.
Some areas that I think are potentially fruitful:
Intentional Programming, or something similar. Charles Simonyi's company Intentional Software has been keeping pretty quiet for a while but is now starting to show some promising early demonstrations.
Functional Programming: ideas from functional programming are increasingly finding their way into more mainstream languages like Python, C# (Linq, lambdas, etc.) and even C++ (lambdas in C++ 0x). F# is becoming a first class .NET language with full support in Visual Studio. The rise of multi core development is another factor driving the wider adoption of functional concepts.
Domain Specific Languages (DSLs): closely related to the ideas behind Intentional Programming, Microsoft seem to be putting some effort into supporting DSLs as part of the .NET ecosystem.
Much more sophisticated IDEs. There are already some positive developments with refactoring tools in IDEs like Visual Studio and IntelliJ but I think there's a lot of room for progress in this area. Moving away from dumb text source files towards something more like an abstract syntax tree representation could make it much easier to work at a higher level of abstraction. Again, this connects with many of the ideas behind Intentional Programming.
By having built in detection of stupid ideas that, when tripped, lock the developer out of the IDE and refuse to let them code ever again.
OOP facilitates abstraction quite nicely. It's developers that come up with poorly formed ideas.
Let's see, how about if we make abstraction mandatory for every data type, and then provide ways of generalizing our abstractions over type parameters? Wait! I've just reinvented CLU. Do I get a Turing Award?
Anyone interested in the role of abstraction in programming should study CLU.
Eiffel code proofs. (warning: link to PDF!)
Functional programming, aspect oriented programming, design by contract and generally everything that takes us away from the dark age of imperative programming.
Also, I hope non - managed software development will cease to exist. C++ and other low level stuff makes me sad. :-(
I like my LINQ, my lambda operator, my extension methods and my fluent interfaces. Oh, and I love PostSharp.NET. And F#, but I guess it's very hard NOT to love F#. :-)
I will give an indirect answer. Before we can develop better constructions in programming languages, we must first understand the theory of abstraction.
Oh yes, there is an actual theory which predates modern computing, it is called category theory.

What programming basics should I learn? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've had a very odd learning experience in programming. I was sort of taught C++, but I didn't get a lot out of it. Here's what I did get out of it: headers and variable declaration. And I tried to teach myself PHP, in which I learned a lot of. The problem is, a lot of my knowledge is widespread, random, and designed for specific situations.
So, my questions is: What basics are there to programming in most languages?
The term "basics" implies a short list, but to be an effective programmer you have to learn a LOT of concepts. Once you do learn them, though, you'll be able to apply many of the same concepts across languages.
I've compiled a (long!) list of concepts that are important in several, if not most, programming languages.
Language syntax
Keywords
Naming conventions
Operators
Assignment
Arithmetic
String
Other
Literals
Conditionals
If/else
Switch/case
What is considered true or false (0? Empty String? Null?)
Looping constructs
for
foreach/iteration
while
do-while
Exception handling
importing/including code from other files
Type system
Strong/weak
Static/dynamic
Memory management
Scoping
What scopes are available
How overlapping scopes are handled
Language constructs/program organization
Variables
Methods
Functions
Classes
Closures
Packages/Modules/Namespaces
Data types and data structures
Primitives
Objects
Arrays/Lists
Maps/Hash/Associative Array
Sets
Enum
Strings
String concatenation
String comparison and equality
Substring
Replacement
Mutability
Syntax for creating literal strings
Functions, Methods, Closures
Method/function overloading
Method/function overriding
Parameter passing (pass-by-value/pass-by-reference
Returning values (single return/multiple return)
Language type (not mutually exclusive)
Scripting
Procedural
Functional
Object-oriented
Object-oriented principles
Inheritance
Classical vs Prototypical
Single, Multiple, or something else
Classes
Static variables/global variables
access modifiers (private, public, protected)
API (or how to do basic stuff)
Basic I/O
Print to Standard Out
Read from Standard in
File I/O
Read a file
Write a file
Check file attributes
Use of regular expressions
Referencing environment variables
Executing system commands
Threading model
Create threads
Thread-safety
Synchronization primitives
Templating
Another important thing not mentioned here yet is just Object Oriented Programming. The ideas revolving around classes, inheritence, interfaces, etc.
A very important basic programming skill is the ability to think at many different levels of abstraction and to know when and which level of abstraction is the most appropriate for a particular programming task.
Pointers. Because so few people actually understand them.
Recursion and iteration, plus what the difference is, and when you use them.
Get an algorithms book and work through the exercises -- you won't be disappointed.
Testing! (unit testing, integration testing, fixtures, mock objects, ...)
And not a programming skill, but surely a development skill: using revision control, and learning to commit sets of changes that handle one (or a few related) requirement, or bugfix, and will always result in a source tree that compiles without errors. This will teach you to organize your work :-)
And last but not least: English... :-) Again, this is not a programming skill, and I know some may disagree, but I feel that any programming language that uses English keywords, should also be programmed in English. So: use English variable names, and so on. I'd even say that the code comments should be in English, but I am sure even more people would disagree about that... So: learn how others describe their code, and adhere to that.
If I were you, I'd go back and learn the C programming language from the class K&R book.
Find out what sort of thing you want to program for first - e.g. web, PC applications, Java based applications, mobile devices, reports, system interfaces, business to business interfaces, etc. then go from there.

Resources