[Factor-talk] Wish list

2013-12-15 Thread graham telfer
Hi, One thing I really miss in Factor is a constraint programming library. Something like Choco for Python that works with MiniZinc or Gecode that is implemented in C++. Sent from my iPad -- Rapidly troubleshoot

[Factor-talk] Cookbook and Learning

2013-06-17 Thread graham telfer
The lack of tutorials for Factor is a major bugbear. I have found The Rosetta Code site very useful because you can compare Factor code with a language you already know for many different problems. Chapter 4 of Thinking Forth is also useful because it has a lot of good advice about factoring

Re: [Factor-talk] Cookbook and Learning

2013-06-17 Thread graham telfer
I would initially like to see 2 tutorials: one which teaches the basics of Factor in the manner of Learn you a Haskell for Great Good stressing the functional programming paradigm. It should get a beginner to the point of being able to think about problems in a functional way and compose

[Factor-talk] Constraints on sequence functions

2013-06-04 Thread graham telfer
I am trying to define a word; bagof which will collect subsequences of values that satisfy some constraints. : bagof ( seq -- set-of-sub-sequences ) constraints-to-satisfy collect-the-sub-sequences ; Constraints might be anything but for example at the moment I want to collect the bag of

Re: [Factor-talk] Constraints on sequence functions

2013-06-04 Thread graham telfer
Maybe happiness! Perhaps the math.combinatorics vocabulary has what I need. Sent from my iPad On 5 Jun 2013, at 12:45, graham telfer gakouse...@hotmail.com wrote: I am trying to define a word; bagof which will collect subsequences of values that satisfy some constraints. : bagof ( seq

[Factor-talk] Test Driven Development

2013-05-26 Thread graham telfer
Hi, Test driven development completely baffles me. Any advice on this topic and how to make effective use of Factor's tools? -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based

[Factor-talk] List Comprehension in Factor

2013-05-20 Thread graham telfer
I was checking out the Rosetta Code site and noticed there is no example of list comprehension in Factor. How can we simulate this convenient tool? -- AlienVault Unified Security Management (USM) platform delivers

Re: [Factor-talk] length

2012-08-29 Thread graham telfer
I'm using Windows Vista. From: gakouse...@hotmail.com To: factor-talk@lists.sourceforge.net Subject: length Date: Wed, 29 Aug 2012 01:38:15 + Using sequences in Factor 0.95 I type something like { 1 2 3 } length in the Listener but get nothing returned. The stack is not empty though

Re: [Factor-talk] Literate Programming

2012-08-29 Thread graham telfer
I just pushed a vocab with some ideas that might help you get started: USE: literate LITERATE This is a section that is mostly text... you can even include factor stuff that doesn't get parsed like the following: : does-this-work? ( -- x ) no it doesn't! ; But, then if you want to run some

[Factor-talk] Literate Programming

2012-08-28 Thread graham telfer
Does Factor have any tools to develop programs using a literate programming method? Something like Bird notation used with Haskell or a document generator like DocGen with VFXForth. The usual thing in code is to mark the comments and leave the code, but in a literate programming approach

[Factor-talk] length

2012-08-28 Thread graham telfer
Using sequences in Factor 0.95 I type something like { 1 2 3 } length in the Listener but get nothing returned. The stack is not empty though because ' .s ' does not report stack underflow. It prints out a blank. Typing ' . . ' prints a blank line rather than the length of the sequence and

[Factor-talk] Time for some Tutorials

2012-08-20 Thread graham telfer
I down loaded and installed the latest version of Factor. The list of improvements and new libraries is impressive but pretty scary to a casual user of Factor like myself. Isn't it time there were some tutorials available? I would like to see 3 initially: a beginner's tutorial in the manner of

Re: [Factor-talk] Stack Depth

2012-07-07 Thread graham telfer
Thanks to everybody who gave me suggestions about the stack. I'd like to add a final comment about why I think the stack is useful in this case. Imagine you are going to chop up a carrot to cook it. There are 2 ways you might go about the job: the first is to cut off a piece and then turn

[Factor-talk] Stack Depth

2012-06-19 Thread graham telfer
The word narray constructs a sequence but needs an integer to tell it how many elements to push. If you want to push all the stack elements how do you find the stack's depth?

Re: [Factor-talk] Stack Depth

2012-06-19 Thread Graham Telfer
Doug Coleman doug.coleman@... writes: In general, you shouldn't want to do this, as all Factor words (besides the one I'm about to show you) need a fixed number of parameters at compile-time. Macros expand at compile-time, so that's one way to get around the restriction. The other way it

Re: [Factor-talk] Stack Depth

2012-06-19 Thread Graham Telfer
Marshall Lochbaum mwlochbaum@... writes: I figured there would be a word designed for that already... Here's my take on this anyway. I would append the items to a sequence as the algorithm goes along: { } swap [ dup 1 ] [ dup 2 /i [ suffix ] dip ] while suffixaccomplishes the task.

Re: [Factor-talk] Stack Depth

2012-06-19 Thread Graham Telfer
John Benediktsson mrjbq7@... writes: I want to divide an integer by 2 until it gets to 1. I have this snippet of code that goes into a loop. dup 1 [ dup 2 /i ] [  ] if When it gets to 1 I want to push the elements into a sequence. Take a look at the produce word: : divide-until-2

Re: [Factor-talk] Stack Depth

2012-06-19 Thread Graham Telfer
Doug Coleman doug.coleman@... writes: How would you do this in C? Would you take the return address off the stack frame, then start calculating the division-by-2s and pushing them to the local stack frame in a loop, and then walk back up accumulating them in an array until you hit the

[Factor-talk] Use of While Loop

2011-09-15 Thread graham telfer
Hi, I am trying to get to grips with Factor. My first attempt is to write a program to the following spec: Pick some positive integer and call it n. If n is odd, multiply it by three and add one. If n is even, divide it by two. Continue this process until n is equal to one. This is a program

[Factor-talk] New to Factor

2011-09-13 Thread graham telfer
Hi there, I have just downloaded Factor and look forward to learning it. I used to program using Forth and it is good to see that one of the major gripes I always had about Forth: its lack of data structures and the intoned mantra , Forth doesn't provide data structures because it is so easy