Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Computer Science

Name: Anonymous 2006-10-30 14:52

I might be taking a course in Computer Science at a Uni soon, what languages are commonly used @ Computer Science?

Name: Anonymous 2006-11-02 13:05

Here are some common functional programming tools (note: not all functional languages support all of these, and there are many I won't list):

1. First class functions. Functions are just another datatype. C has this, kinda.
2. Higher-order functions. Functions can be returned by functions. C has this, kinda.
3. Anonymous functions. Use-once functions which you don't need to define so formally. You typically use them to pass some functionality (operation, behaviour, not just data) to another function, or return it.
4. Dynamic functions. You can create functions dynamically. For example, you can have a function create a new function on-the-fly for you, based perhaps on parameters. But this isn't nearly as interesting as...
5. Closures. Functions which are defined inside another function, having their own variables, but also sharing their parent's, even if the parent is no longer running.
6. Lists and dictionaries as a base type, with proper syntax support. You'll discover you can do so much with these. Lists are a basic building block of applications. Dictionaries allow you to implement dynamic structures, trees, sets, and more. They are natively supported and offer a lot of functions to deal with them. It's far more useful to have few data types with a lot of functions to do stuff with them, which you'll presumably use a lot, than a lot of data types (classes, static structures) each with a reduced set of functions which you can't be reusing all the time.
7. List comprehensions, which allow you to build a list from a combination of iterations and conditions of other lists, as in [i * 2 for i in mynumbers if IsPrime(i)] (creates a list containing all primes in the mynumbers list, doubled).
8. Useful list-function functions: map, which applies a closure/anonymous function/function to a list (or a series of lists, read in parallel) and returns a list with the results. filter, which returns a subset of a list for which a closure/function/etc is true. max and min, which find the maximum and minimum values of a list (perhaps with a custom definition of what's maximum and minimum). fold/reduce, scanl/r

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List