Showing posts with label factor. Show all posts
Showing posts with label factor. Show all posts
Friday, May 16, 2008
Markdown what does it take to parse you
Its been 4 designs trashed since I've got this need to write a Markdown to HTML convertor in Factor. The catch: I don't want to use regular expressions. I'm trying to make it really generic but some stupid edge case comes along and crashes the parser. Talk about morale sapping. Particularly when I'm already quite frustrated. This is the only frustration which I can rant about in public.
Friday, March 07, 2008
.57142857 way through
Hey the name's KodeClutz, I had to be precise.
4 papers down, 3 to go, after which I'm one step closer to freedom, and quite a major step because all the exams after that are just one day affairs, 4 of them.
In going stupid, I'm thinking of writing a Markdown parser in Factor. The problem isn't Factor, I'm just not that well qualified. But I might just do it.
4 papers down, 3 to go, after which I'm one step closer to freedom, and quite a major step because all the exams after that are just one day affairs, 4 of them.
In going stupid, I'm thinking of writing a Markdown parser in Factor. The problem isn't Factor, I'm just not that well qualified. But I might just do it.
Sunday, February 17, 2008
Why factor is cool
Before beginning, I must admit I haven't messed with Factor for a couple of weeks now, nor do I contribute to it, I'm a Factor n00b. Please contradict peacefully.
Of course there are the usual reasons that it is open source, most of the standard libraries are in Factor itself, and that it has a really cool development environment. But almost every popular language these days has all that stuff.
The real reason I think factor is cool is because it still isn't near complete!
It's small and so the sense of community is much stronger, you can be the first to do things in Factor, when they've already been done elsewhere, and anyone with a decent education and experience could easily grok the theory too.
I would say Factor's basic constructs are even smaller than Python's. Just knowing a few shuffle words and USING:, defining words and quotations, gives you almost everything you need to know.
Everything else is just built on top of this.
At present Factor users are probably just in 2 digits. And there are no products (that I know of). Which means you could probably restructure the whole language without affecting anyone. This allows Factor to improve by rewrite, rather than by add-on.
Writing libraries for a new language means doing stuff that most have probably never done. So you have to learn about Unicode, or just traverse strings recursively (?!?) like I had to do in brainfacktor. ( Could it be better? )
Basically by keeping the core small, keeping a single stack and enforcing recursion by not having loops, Factor really forces iterative programmers to go stack based/functional. And that itself is a lot of fun, even though it is hard.
Reading about all the developers coding the standard libraries is also very informative, as is looking through the Factor sources.
And it would be fun to look at the interpreter, though I've never done it.
So that was my attempt at some evangelism :D
Of course there are the usual reasons that it is open source, most of the standard libraries are in Factor itself, and that it has a really cool development environment. But almost every popular language these days has all that stuff.
The real reason I think factor is cool is because it still isn't near complete!
It's small and so the sense of community is much stronger, you can be the first to do things in Factor, when they've already been done elsewhere, and anyone with a decent education and experience could easily grok the theory too.
Small syntax
I would say Factor's basic constructs are even smaller than Python's. Just knowing a few shuffle words and USING:, defining words and quotations, gives you almost everything you need to know.
Everything else is just built on top of this.
Small population
At present Factor users are probably just in 2 digits. And there are no products (that I know of). Which means you could probably restructure the whole language without affecting anyone. This allows Factor to improve by rewrite, rather than by add-on.
Educational
Writing libraries for a new language means doing stuff that most have probably never done. So you have to learn about Unicode, or just traverse strings recursively (?!?) like I had to do in brainfacktor. ( Could it be better? )
Basically by keeping the core small, keeping a single stack and enforcing recursion by not having loops, Factor really forces iterative programmers to go stack based/functional. And that itself is a lot of fun, even though it is hard.
Reading about all the developers coding the standard libraries is also very informative, as is looking through the Factor sources.
And it would be fun to look at the interpreter, though I've never done it.
So that was my attempt at some evangelism :D
Thursday, February 14, 2008
This thing creeps along
Not much posts here, and nothing of interest. Well there really isn't much I've been doing.
I hacked a brainf**k interpreter in Factor, but since I've no time for Turing tarpits, someone should test it on more complex programs. Besides the number to string conversion does cause output problems.
I also have a refresh ready for my website, but it isn't going online any time soon, because its not for 22bits, but a new one, which I might do after a few months.
Other than that I'm just messing around with a few ideas, I really haven't got time for anything else.
The only thing new I've been doing is listening to a LOT of new music, by Radiohead, Broken Social Scene, and other alternative bands. See my Last.fm.
I hacked a brainf**k interpreter in Factor, but since I've no time for Turing tarpits, someone should test it on more complex programs. Besides the number to string conversion does cause output problems.
I also have a refresh ready for my website, but it isn't going online any time soon, because its not for 22bits, but a new one, which I might do after a few months.
Other than that I'm just messing around with a few ideas, I really haven't got time for anything else.
The only thing new I've been doing is listening to a LOT of new music, by Radiohead, Broken Social Scene, and other alternative bands. See my Last.fm.
Thursday, January 10, 2008
Factor: Guess the number
My first useful factor program.
You might want to try it in the UI, the command line listener seems to have issues flushing the I/O streams. To run go:
Notice the lack of looping in Factor ( it's available but not recommended ) and using recursion in its place.
! A guessing game
USING: calendar random strings namespaces prettyprint math.parser io io.files math kernel combinators ;
IN: guess
! lets choose our number
SYMBOL: answer
! initialize the generator
now timestamp>unix-time init-random
! get a number [1..100] and put it in answer
100 random answer set
answer get .
! keep asking the user
: start-guessing ( -- )
"Enter number: " print
! get the number as a string
stdio get stream-readln
! convert to integer
string>number
! push on answer
answer get
! now stack top is : input, answer
{
{ [ 2dup < ] [ "try higher" print start-guessing ] }
{ [ 2dup > ] [ "try lower" print start-guessing ] }
{ [ 2dup = ] [ "Thats right!" print ] }
} cond
;
You might want to try it in the UI, the command line listener seems to have issues flushing the I/O streams. To run go:
"<path>/<filename>" run-file
Notice the lack of looping in Factor ( it's available but not recommended ) and using recursion in its place.
Friday, January 04, 2008
Factor -ize
Its been a week since i discovered Factor. So first, it's stack based, it's small, it's almost tiny. I've never programmed in a stack based language before. But I liked it, really makes you think. Infact I haven't got any program written yet, just playing around in the interactive interpreter. It's got really good documentation by way of the API, what it could use is a quick start guide, ie. a list of some basic operations of the stack, using conditionals and looping and arrays and hashmap, because right now you've to look through the documentation for each concept, which means the unity is broken.
But great language, small community, even smaller existing code. What is bad is that most of the 'responders' give 404s. :(
But great language, small community, even smaller existing code. What is bad is that most of the 'responders' give 404s. :(
Subscribe to:
Posts (Atom)