pozorvlak: (Default)
2010-11-01 01:41 pm

PeCoWriMo

As seems inevitable these days, a load of my friends are doing National¹ Novel Writing Month this year. I won't be joining them: I have no particular ambition to become a novelist. However, I do want to become a better programmer.

To that end, I shall be participating in my own Personal Code Writing Month, the rules of which are
  1. Write some non-work code every day.
  2. Make what I write available, if only on GitHub.
  3. Wherever possible, make something that can be used over the Web, and get it hosted somewhere so people can use it.
I'm deliberately not setting myself a more concrete project or Grand Lofty Goal, for fear of scaring myself off: the idea is just to work on whatever attracts me on any given day. Nor am I setting myself any targets as to how much code I must write on any given day, or how long I should spend on it. To start with, though, I was thinking I might do something about the poor Factor coverage in the Programming Languages Examples Alike Cookbook, and I've just subscribed to the PLEAC mailing list.

I'll be posting regularly about this: if you don't want to hear about it, please let me know so I can set up a filter or something.

Edit: I've uploaded today's hack - a partial fix to the irritating "light goes off when you rotate the phone" bug on my LED flashlight. It's not a complete fix, because the light still blinks out for half a second before coming on again. I'm sure the world doesn't need Yet Another Flashlight App, but I'll sort out Android Market access and upload it there anyway. Meanwhile, you should be able to sideload it from here.

¹ By the way: why "national"? I see from Wikipedia that the first year (1999) was San Francisco-only, but from 2000 onwards it's been an international event.
pozorvlak: (Default)
2009-11-17 11:48 pm

Project Euler in Factor, part 1

In a (probably futile) attempt to acquire Real Ultimate Power, I have been trying some Project Euler problems in Factor. Here are my first five solutions, along with my comments: I was going to post my first ten solutions, but this was getting too long.

Spoilers herein, obviously.

Problem 1 )

Problem 2 )

Problem 3 )

Problem 4 )

Problem 5 )

Overall comments
  • The dev tools are nice, once you work out what everything's called - the debugger's called the "walker", for instance. I particularly like the way that the listener pops up a stack effect declaration in a minibuffer when you type in a word's name - since the conventions are strictly followed, this is often all the documentation you need. When you need more, it's easy to get help and see source code using the help and see words, or using the browser (Alt+B). I haven't yet worked out how to take best advantage of the editor integration, but I'm sure that will come.
  • For getting started, I found the Factor cookbook invaluable.
  • #concatenative is one of the friendliest tech forums I've encountered, and hands down the most helpful. In every case my (admittedly n00bish) questions were answered before I'd finished posing them.
  • I'm finding programming without variables to be really hard. Factor does have facilities for both lexically- and dynamically-scoped variables, but I've been mostly avoiding their use, on the grounds that I'll have to learn how to use the stack some time and I might as well do so now.
Any comments or questions, on the code or the presentation, are very welcome!

Edit: thanks once again to the members of #concatenative, particularly slava and erg, for comments on this post.
pozorvlak: (gasmask)
2009-07-04 12:16 am

Now that's what I call Real Ultimate Power!!!!!

By popular demand, a picture of Slava Pestov wailing on guitar:

Slava Pestov wailing on guitar, in mid-air.


NB: image may not actually depict Slava Pestov.

Previously.
pozorvlak: (Default)
2009-06-26 12:02 am

Are you ready to get pumped?

Hi, this post is about Factor, real Factor. This post is awesome. My name is [livejournal.com profile] pozorvlak and I can't stop thinking about Factor. Factor is cool, and by cool, I mean totally sweet.

Facts:
1. Slava Pestov is a mammal.
2. Slava Pestov hacks on Factor ALL the time.
3. The purpose of Slava Pestov is to flip out and kill people.

Weapons and Gear:
1. Concatenative (stack-based, Forth-like) language.
2. Dynamic types.
3. First-class functions.
4. Object-orientation.
5. Real macros.
6. Batteries included.
7. The listener: debugger/REPL/help browser/etc.
8. Optimizing, self-hosting native-code compiler.
9. Ninja stars.

Testimonial:
Factor programmers can kill anyone they want! Slava cuts off heads ALL the time and doesn't even think twice about it. The guys on #concatenative are so crazy and awesome that they flip out ALL the time. I heard that littledan was eating at a diner. And when some dude dropped a spoon littledan GC'ed every object in memory. My friend Mark said that he saw a Factor programmer totally uppercut some kid just because the kid opened a gl-window.

And that's what I call REAL Ultimate Power!!!!!!!!!!!!!!!!!!

If you don't believe that Factor programmers have REAL Ultimate Power you better git clone their repository right now or they will chop your head off!!! It's an easy choice, if you ask me.

Writing OpenGL code in Factor:
Step 1: Look for some Factor OpenGL documentation.
Step 2: Fail to find any.
Step 3: Get really super pissed.
Step 4: Get some C++ OpenGL documentation instead.
Step 5: Put something slippery on it, like butter or cream.
Step 6: Bend it to fit (this is crucial).
Step 7: Keep folded and insert into listener hard.
Step 8: Push hard until you can't see it.
Step 9: Wait.
Step 10: Die.

If you succeed, everybody will be like “Holy Crap!

Update: by popular demand, a picture of Slava wailing on guitar.