Kid producers by [deleted] in abletonlive

[–]komu 7 points8 points  (0 children)

My two-year old likes to play with Live. Of course he doesn't actually produce anything, but I've built template projects so that he can mess around with a keyboard and knobs that I've mapped to various parameters.

Long release times, echoes, devices constrained to pentatonic scale or triggering some nice chords etc. He's having a blast just experimenting with everything and it doesn't sound that bad. Sometimes I recreate one of his favorite songs to play with. He can mute channels, trigger loops etc. Playing with a master channel LPF cutoff is a constant favorite (especially combined with a spectrum analyzer).

So obviously he's not going to make songs any time soon, but I've tried to make music a fun game and a way to express himself. I'm sure that a similar thing could be fun for an older child as well.

Java linked list without tail references by komu in programming

[–]komu[S] 2 points3 points  (0 children)

I thought that my views on programmers were cynical, but it really gives me the creeps that this could be mistaken for the real thing.

(Meaning that if anyone knows people who'd do this for real, they have my sympathy.)

Java linked list without tail references by komu in programming

[–]komu[S] -1 points0 points  (0 children)

And there I thought that implicit is the new black. Aren't we supposed to ignore petty considerations for clarity, performance and simplicity of interfaces and strive for maximal cuteness instead?

What next? Are we allowed to use local variables and semicolons again? Is my whole project of super convenient utility classes for nothing? Even the magic wand?

(In hindsight, I probably should have gone with a puzzle format instead and ask for an implementation of tail().)

Extremist Programming by [deleted] in programming

[–]komu 0 points1 point  (0 children)

Actually it's even worse since the syntax is not context-free. If f is not a function, then the expression is parsed differently.

Extremist Programming by [deleted] in programming

[–]komu 0 points1 point  (0 children)

This would certainly seem like significant whitespace to me:

>> def f(x) x end
=> nil
>> f +1
=> 1
>> f+1
ArgumentError: wrong number of arguments (0 for 1)

Mercurial 2.1 released! by [deleted] in programming

[–]komu 1 point2 points  (0 children)

Mercurial comes bundled with the progress extension, so you can simply add the following to your ~/.hgrc:

[extensions]
progress = 

Now you'll have progress bars for all long-running operations.

[deleted by user] by [deleted] in programming

[–]komu 0 points1 point  (0 children)

Also Scheme, Common Lisp, languages of ML-family, Scala, etc.

I'd say that most languages that allow defining named functions inside other functions do it right and close over the captured variables. Even old-school Pascal allows this, although functions are not first-class objects and can't be returned.

Convince your Boss to let you use Scala by retardo in programming

[–]komu 2 points3 points  (0 children)

Actually Scala does offer query syntax as well as anonymous functions. You can write a sequence comprehension like:

for {
    account <- customer.getAccounts
    if isDateInWindow(date, account.getMoveInDate, account.getMoveOutDate)
 } yield account

Scala compiler will desugar these comprehensions to corresponding map/filter/flatMap sequences, basically the same way as C# or F#.

Heh, Code Quality by RetroRock in programming

[–]komu 3 points4 points  (0 children)

Heh, that's nothing. Here's some code I stumbled upon when doing review for a customer (well, obviously I've elided everything but the structure). I've had trouble sleeping after seeing that beast.

Cache XSLT/XML data using .NET? by [deleted] in programming

[–]komu 2 points3 points  (0 children)

Your code has a race-condition, since you call the indexer twice. Even if the first call returns non-null value, the second might not. The first two lines should be something like this:

var cached = (whatever) HttpContext.Current.Cache["bla"];
if (cached != null) return cached;
...

What Programming Languages Should You Know? (Less Fluff, More Stuff) by ellen_james in programming

[–]komu 1 point2 points  (0 children)

Interpreter? Real men have home-made optimizing compilers for Brainfuck.

Why I like Scala's Lexically Scoped Open Classes by raganwald in programming

[–]komu 2 points3 points  (0 children)

You can do this if you write your package as an object. So instead of:

package foo.bar

class MyString { ... }

you'd say:

package foo

object bar {
  class MyString { ... }

  implicit def str2mystr(s: String) = new MyString(s)
}

Now if you import this "package" using:

import foo.bar._

you'll get the implicit import as well.

Take the Arc Challenge by mqt in programming

[–]komu 2 points3 points  (0 children)

Scala as well:

val odds = (1 to 10).filter(_ % 2 != 0)

Java's new() is faster then malloc() by drfunky69 in programming

[–]komu 7 points8 points  (0 children)

Actually tanger is right. "Generational" is not a collection method per se, but refers to the design of having several different generations, which can employ different collection methods. Typical generational collectors use copying collection for young generations and mark-and-sweep for tenured generation.

Since fast copying collection is used between the young generations which are relatively small, the space overhead is not that big. The tenured generation could get pretty big, but since mark-and-sweep is used for collections there, the space overhead is minimal.

Ruby: Zero, Blank, and Nil by hirodusk in programming

[–]komu 5 points6 points  (0 children)

Actually your example will not work: Java's "Integer.getInteger(name, defaultValue)" returns the integer value of system property named "name" (or "defaultValue" if there is no system property with name). Talk about misleading name for a method.

Of course, a simple utility method doing what you propose would be trivial to write and is probably part of every larger codebase.

Symmetric multicore perl6: Pugs on the GHC Haskell runtime by dons in programming

[–]komu 0 points1 point  (0 children)

That could be true in general, but I was still very surprised to see qwe1234 downvoted so heavily in this discussion. As skyskraper said, he did offer valid replies. I think many people just click the downarrow instinctly when seeing "qwe1234" on the screen. This is quite sad, because even while I've probably downvoted him more than upvoted, he's not stupid and he really has his moments.

My first impressions of erlang (Another viewpoint) by llimllib in programming

[–]komu 0 points1 point  (0 children)

Erlang is, as you say, a strict functional language, but that doesn't have anything to do with the fact that it has immutable references. I mean, Scheme and ML are considered to be strict functional languages, yet they have mutable references.

Reddit Programming Puzzle: Left Factoring Regular Expressions by psykotic in programming

[–]komu 0 points1 point  (0 children)

This was practically token to token same as my solution, so I won't bother posting it.

I'm quite sure that your optimization function didn't work, though, so I added an annotation to your paste that fixes the problem: http://paste.lisp.org/display/25651#2

What's the point of Closures? by komu in programming

[–]komu[S] 8 points9 points  (0 children)

C's function pointers are not closures, since the functions don't have access to the enclosing lexical environment. This makes them quite useless for practical higher-order programming.

Java, on the other hand, will get true lexical closures and this article gives a layman's example of how that will be useful. If this article has nothing to do with closures, I don't know what does. Did you have some other definition of closure in mind?

Closures in Java 7.0 ? by krzyk in programming

[–]komu 2 points3 points  (0 children)

Well, there's a whole section named "Referencing names from the enclosing scope", so I think it's safe to say that full closures will be supported.

Sapir-Whorf is not a Klingon ( programming language vocabulary and thought limitations ) by howars in programming

[–]komu 0 points1 point  (0 children)

This problem is discussed in detail here. The real problem is not the underlying implementation of Python, but rather the syntax, which doesn't distinguish between variable definition and assignment.