Hi Stephen,

Take a look at the 'lines' word (type '\ lines help' in your listener). This
will give you a sequence of strings, which you can then use { "XXXXXX" }
split on to get the separate parts of the data. Factor's sequences
vocabulary is amazingly useful. Remember that strings are sequences in
factor (just like arrays, vectors, and many others), which means that you
can use most of the sequence words on them (such as 'each' and 'map'). As a
demonstration, try the following in your listener: "HAL" [ 1+ ] map .

You may also find set-theoretic operations useful in this sort of problem.
There are some of those in the assocs vocab, but I haven't really explored
their uses.

Have fun, sounds like a good assignment.

Alex

On 10/03/2008, Stephen Hill <[EMAIL PROTECTED]> wrote:
>
>  Hey guys,
>
>
>
> I was starting to get into the Factor programming language and I have
> never done any programming in this language. I have done some programming in
> Scheme so I have some knowledge about how some of the syntax works in this
> language, but there are several differences. My question comes from a
> project that I am working on for one of my computer science classes; my
> project is the Word Amalgamation algorithm. What this algorithm does is it
> reads in information from a file that contains a list of words which forms
> the dictionary. Following the final word is a break designed by X's, and
> following that are words that are scrambled together. With the scrambled
> words we have to match that up to the words in the given dictionary to
> determine if it is possible to unscramble that word to match as many words
> in the dictionary. For example:
>
> (input file)
>
> tarp
>
> given
>
> score
>
> refund
>
> only
>
> trap
>
> work
>
> earn
>
> course
>
> pepper
>
> part
>
> XXXXXX
>
> resco
>
> nfudre
>
> aptr
>
> sett
>
> oresuc
>
> XXXXXX
>
>
>
> (output file)
>
> score
>
> ******
>
> refund
>
> ******
>
> part
>
> tarp
>
> trap
>
> ******
>
> NOT A VALID WORD
>
> ******
>
> course
>
> ******
>
>
>
> So I have been going through the help documents and looked at some of the
> code but I was wondering if there was more information that I could find on
> getting a file parsed into a vector, and how I access that information in
> that vector to do a comparison on the dictionary? I did find the file-reader
> and the file-writer, but I couldn't find any sample code that uses that
> functionality. I was also wondering if there was functionality that allowed
> me to scan through the word itself, character by character, to match up the
> scrambled word to the words in the dictionary?
>
>
>
> I would appreciate any help that could be offered, and I will continue
> looking through the code to see if I can answer my own questions. I was just
> hoping for some help since I haven't had a whole lot of experience in
> Factor.
>
>
>
> Thanks in advance for the help,
>
>
>
> Stephen
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to