News for hackers. Stuff that matters.
Re:I finally understand why I'm not allowed to use Lisp by siika2000 on Sunday February 20, 2011 @10:11AM (#2241990)
In what language are arrays of numbers their own class?
Re:I finally understand why I'm not allowed to use Lisp by IDisposableHero on Monday February 21, 2011 @08:53AM (#2245366)
That would be legal in C# 3.5 or later.

Though technically it's not that "array of numbers" is a class, but that array of T implements the interface IEnumerable<T>, and Sum() is extension method defined for IEnumerable<int>

It's even in the standard libs, you don't have to build it. Documentation is here: http://msdn.microsoft.com/en-us/library/system.linq.enumerab...

Re:I finally understand why I'm not allowed to use Lisp by IDisposableHero on Monday February 21, 2011 @11:36AM (#2245973)
It looks like there's two directions for a language's type system to go:

1) strict typing, but with lots of constructs (e.g. inheritance, interfaces, generics, extension methods) to work around that strictness so that you can do what you want, if you understand the rules and syntax to get it to compile.

2) loose, "duck typing" so you just do what you want, but without compiler checking that it's possible, and with the posibility that it fails at runtime if the right method isn't found.

C# is in the first direction.

Re:I finally understand why I'm not allowed to use Lisp by siika2000 on Sunday February 20, 2011 @10:38AM (#2242050)
Re:I finally understand why I'm not allowed to use Lisp by sophacles on Sunday February 20, 2011 @11:03AM (#2242123)
In dynamic languages where arrays can be homogenous, the array can still have a sum method, it just assumes decent coercion rules and overloaded + (or it barfs...).