[Factor-talk] Finding words with given stack effect

2011-11-10 Thread missingfaktor
Does Factor have a word for searching words given a stack-effect?

Something like:

(( x p q -- )) words-with-stack-effect

will list out 'bi' and other words with that effect.

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Writing a zip-with function

2011-11-11 Thread missingfaktor
( scratchpad ) { { 1 2 } { 3 4 } { 8 9 } }
   { { 8 9 } { 0 2 } { 1 5 } }

--- Data stack:
{ ~array~ ~array~ ~array~ }
{ ~array~ ~array~ ~array~ }
( scratchpad ) zip [ [ first ] [ second ] bi append ] map

--- Data stack:
{ ~array~ ~array~ ~array~ }
( scratchpad ) [ . ] each
{ 1 2 8 9 }
{ 3 4 0 2 }
{ 8 9 1 5 }


The above code zips the two lists and then maps each pair to an element
using  some function. This pattern occurs very often while coding, and I'd
like to abstract it out in as a separate word.

I tried writing it this way, but the code fails to compile:


:: zip-with ( xs ys quot -- zs )
   xs ys zip [ [ first ] [ second ] bi quot ] map ;


Q1. How do I make it work?
Q2. How to write this without locals?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Abstraction like Clojure's protocols?

2011-11-17 Thread missingfaktor
Factor's generic words are similar to Clojure's multimethods. However there
are times when protocols (in Clojure speak) are more appropriate
abstraction. Does Factor support a construct similar to protocols?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Where can I get this Factor Listener?

2011-11-19 Thread missingfaktor
Where can I get the Factor Listener used in this video:
http://www.youtube.com/watch?v=f_0QlhYlS8g?

The one I downloaded from the project site is different and less convenient
to use.

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] "group-by" word

2011-11-19 Thread missingfaktor
I want to write a word "group-by" that has following stack effect and
behavior:

Signature:

: group-by ( seq quot -- alist ) (group-by-impl) ;

Input:

{ "hello" "hola" "ball" "scala" "java" "factor" "python" } [ length ]
group-by

Output:

H{
  { 5 { "hello" "scala" } }
  { 4 { "hola" "ball" "java" } }
  { 6 { "factor" "python" } }
}

I tried this many times, but failed. Can someone please provide me an
implementation for this, preferably with an explanation?
-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] A word similar to Haskell's 'iterate'

2011-12-06 Thread missingfaktor
Does Factor have a word similar to Haskell's 'iterate' function?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.

When you stand for what you believe in, you can change the world.
--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] A word that lets me ommit stack comments

2011-12-18 Thread missingfaktor
Is there a parsing word that lets you define words without a stack effect
declaration?
-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Attempting to solve Project Euler problem 2

2011-12-19 Thread missingfaktor
Text of the problem: Each new term in the Fibonacci sequence is generated
by adding the previous two terms. By starting with 1 and 2, the first 10
terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... . By considering the
terms in the Fibonacci sequence whose values do not exceed four million,
find the sum of the even-valued terms.

My solution:

: million ( n -- n' ) 100 * ;
: fibonacci ( n -- seq ) 0 1 rot '[ dup _ < ] [ swap over + dup ] produce
2nip ; ! Where has "tuck" gone?!
4 million fibonacci [ even? ] filter sum

Any comments on how it can be simplified or made more idiomatic?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] What does "fried" in "fried quotations" mean?

2011-12-19 Thread missingfaktor
Or, why are fried quotations called what they are called?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Short-circuiting boolean operators?

2011-12-20 Thread missingfaktor
I was unable to find short-circuiting boolean operators in Factor's
standard vocabs. Does it not have them? If not, why not? If yes, where are
they?

-- 
Cheers,
missingfaktor <http://twitter.com/#!/missingfaktor>.
--
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk