13 Replies - 9079 Views - Last Post: 18 July 2010 - 07:55 PM

#1 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2240
  • View blog
  • Posts: 9,411
  • Joined: 29-May 08

Week# 25: Factor

Post icon  Posted 13 July 2010 - 06:29 PM

Submitted by: Raynes

Posted Image

CHALLENGE: Write something fun in Factor.

Factor is definitely not something you're used to. It's a high-level, general purpose, stack-based programming language. The goal of the language is to be a complete and practical stack-based programming language.

From the Factor website: The Factor programming language combines powerful language features with a full-featured library. The implementation is fully compiled for performance, while still supporting interactive development. Factor applications are portable between all common platforms. Factor can deploy stand-alone applications on all platforms. Full source code for the Factor project is available under a BSD license.

More information can be found on the Factor website at http://factorcode.org/.

IDEAS:

* RPN calculator
* Simple website using Furnace
* Alarm clock
* etc

RESOURCES:

For quite some time, Factor has been too fast a moving target for much in the way of beginner tutorials and books and such. Therefore, http://docs.factorcode.org/ is the most complete resource available. Factor is heavily documented. All the documentation is there, you just have to find what you need. The biggest help you'll get is on the #concatenative IRC channel on irc.freenode.org. They are extremely helpful there, and will help you out with code reviews and such, and will answer your questions.

HOW TO GET STARTED:

You'll want to navigate to http://factorcode.org/ and pick up the latest stable or development release for your platform. When you run Factor, it will open a really cool window called the Listener. You can browse documentation all sorts of stuff there, and use it as an REPL. In the Listener, you can go to help to open the documentation browser. You'll then want to go through the Getting Started section of the docs, starting with "Your first program" and then the factor cookbook. After that, you can read code and search through the Factor docs to learn about things you don't understand. Anything else, you can ask questions about on the mailing list or IRC channel.

.uoy htiw eb ecrof eht yaM

Is This A Good Question/Topic? 0
  • +

Replies To: Week# 25: Factor

#2 programble  Icon User is offline

  • (cons :dic :head)

Reputation: 49
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Week# 25: Factor

Posted 13 July 2010 - 07:51 PM

Finally, something good.
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Week# 25: Factor

Posted 13 July 2010 - 09:15 PM

Interesting, I've downloaded everything and think I may give this a go(just for something I've never tried before). Ok Raynes and programble how would I go about creating a GUI with Factor (I'm thinking of trying to create a RSS reader with Factor) so can I create a GUI with like TextBoxes and such or is all command line type?
Was This Post Helpful? 0
  • +
  • -

#4 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: Week# 25: Factor

Posted 13 July 2010 - 09:44 PM

http://concatenative.../view/Factor/UI
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Week# 25: Factor

Posted 13 July 2010 - 10:30 PM

This will apply the ROT13 "encryption" to a string value

! Copyright (C) 2010 Richard L. McCutchen
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math sequences strings io combinators ascii ;
 IN: rot13

: rotate (ch base -- ch) [- 13 + 26 mod] [+] bi ;
: rot-letter (ch -- ch)
{
    {[ dup letter? ] [ CHAR: a rotate ]}
    {[ dup LETTER? ] [ CHAR: A rotate ]}
    {[t] []}
} cond ;   

: rot13 ( string -- string ) [ rot-letter ] map ;   
: rot13-demo ( -- )

"Enter a string:" print flush

readln [
	"Your string value: " write dup print
	"Your string value with the rot13 "encryption" applied: "  write rot13 print
	] when* ;
 MAIN: rot13-demo



Still working on an RSS reader with Factor. Seems like a weird language, but could be fairly easy to learn
Was This Post Helpful? 0
  • +
  • -

#6 programble  Icon User is offline

  • (cons :dic :head)

Reputation: 49
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Week# 25: Factor

Posted 13 July 2010 - 10:35 PM

View PostPsychoCoder, on 13 July 2010 - 10:15 PM, said:

Interesting, I've downloaded everything and think I may give this a go(just for something I've never tried before). Ok Raynes and programble how would I go about creating a GUI with Factor (I'm thinking of trying to create a RSS reader with Factor) so can I create a GUI with like TextBoxes and such or is all command line type?


I don't get why my name is in this. I honestly don't know much of Factor, so couldn't tell you.

This post has been edited by programble: 14 July 2010 - 01:38 PM

Was This Post Helpful? 0
  • +
  • -

#7 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Week# 25: Factor

Posted 14 July 2010 - 01:21 AM

Well since Raynes submitted the challenge...
Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Week# 25: Factor

Posted 14 July 2010 - 06:20 AM

programble I just figured since you said

Quote

Finally, something good.


And Raynes submitted the challenge that you two knew something of the language and could help :)
Was This Post Helpful? 0
  • +
  • -

#9 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Week# 25: Factor

Posted 14 July 2010 - 07:53 AM

I can help!! :P

I'll be the first to tell you, however, that the state of UI development in Factor right now isn't all that great. Factor ships out with a UI library, and like the rest of the language it's heavily documented. Also like the rest of the language, the reference documentation is all there is, and "Getting Started" info is sparse, so you might have to take it slow. The problem is that the UI library that ships with Factor is lacking. Slava has really only implemented the things he needed to get the Factor development tools running (the UI ones of course).

There is a GTK backend (a la gtk bindings) that will be merged into the official repo, so I think the shitty-ui woes will be gone soon.

You *can* write a UI application in Factor, but at this stage of the game, it might take more effort than it would in another language. Factor does have some neat XML stuff. It's got libraries for all sorts of stuff that Slava Pestov has written himself.

I encourage those who are trying the language to take it one step at a time. It's a very weird language, and like I said, it isn't what you're used to. I submitted this challenge, because I thought everyone might enjoy playing with a language out of pretty much *everyone's* comfort zone, but one that is not esoteric and is actually aiming to be practical. I hope everyone has fun! :)

I will point out that I haven't used Factor in quite a while, but if anyone has any questions, I'll try to answer them to the best of my ability.

This post has been edited by Raynes: 14 July 2010 - 07:56 AM

Was This Post Helpful? 0
  • +
  • -

#10 laserbeak43  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 134
  • Joined: 07-November 09

Re: Week# 25: Factor

Posted 14 July 2010 - 07:54 AM

Well, I'm in!
Was This Post Helpful? 0
  • +
  • -

#11 laserbeak43  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 134
  • Joined: 07-November 09

Re: Week# 25: Factor

Posted 14 July 2010 - 09:35 AM

the writing your first program part was pretty cool, but i can see myself having trouble writing anything interesting with this in a week, maybe....
Was This Post Helpful? 0
  • +
  • -

#12 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Week# 25: Factor

Posted 14 July 2010 - 10:03 AM

Remember that you can submit stuff at a later time. If you want to write something that you can't finish in a week, you can always submit it after the week is over. There are no time limits.
Was This Post Helpful? 0
  • +
  • -

#13 laserbeak43  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 134
  • Joined: 07-November 09

Re: Week# 25: Factor

Posted 14 July 2010 - 01:26 PM

oh, I shoulda finished last week's then. LOL
Was This Post Helpful? 0
  • +
  • -

#14 laserbeak43  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 134
  • Joined: 07-November 09

Re: Week# 25: Factor

Posted 18 July 2010 - 07:55 PM

still trying to wrap my head around the concept of combinators.
watching Slava's vid here:
http://www.youtube.c...vq=medium#t=111

-edit-
Well, I guess I'll add what I have, without adding another post to this thread. The beginnings of a syntax highlighter for conTEXT editor :donatello: I know I know, but this is a tough language to get used to. Anyway, if you add to /improve it, please let me know! :)

Attached File(s)


This post has been edited by laserbeak43: 18 July 2010 - 10:59 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1