On Mon, May 20, 2013 at 10:11 PM, Alex Vondrak ajvond...@gmail.com wrote:
Oo, or even
: triples ( n -- seq )
iota rest 3 [ first3 triple? ] filter-combinations ;
Does filter-combinations filter as it builds the list?
Or does it build the list then filter it?
ajvond...@gmail.com wrote:
Oo, or even
: triples ( n -- seq )
iota rest 3 [ first3 triple? ] filter-combinations ;
Out of all the examples given in several languages, this is by far the
most concise version.
--
Using ranges, iota rest is just [1,b) (and more memory efficient because
rest causes the virtual sequence to become concrete).
The filter-combinations word is more efficient than all-combinations [ ... ]
filter because it can ignore or skip the ones that are not triples as it builds
the
On Wed, May 22, 2013 at 8:58 AM, John Benediktsson mrj...@gmail.com wrote:
Using ranges, iota rest is just [1,b) (and more memory efficient because
rest causes the virtual sequence to become concrete).
How come rest doesn't just use a virtual sequence to offset the
original index by 1.
I'm glad the final version is so elegant!
Best,
John.
Chuck Moore declared that the software problem was solved and that
the remaining problem was hardware.
-- http://www.ultratechnology.com/
With the software problem solved, maybe the remaining problems are
hardware and pure math.
How come rest doesn't just use a virtual sequence to offset the
original index by 1.
You're thinking of rest-slice, which is a virtual version of rest.
--
Try New Relic Now We'll Send You this Cool Shirt
New Relic is
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
We don't have list comprehensions, per se - but instead have basic map
and filter operations...
Instead of
[ x for x in range(5) if x % 2 == 0 ]
We would have:
5 iota [ 2 mod zero? ] filter
Instead of
[ x ** 3 for x in foo() ]
We would have:
foo [ 3 ^ ] map
You could use
! Copyright (C) 2013 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences math math.functions arrays math.combinatorics ;
IN: pythagorean-triples
: a-b-list ( n -- seq )
iota rest 2 all-combinations ;
: a-b-c ( seq1 -- seq2 )
[ first ]
[ second
Or, going by the algorithms in the wiki:
```
USING: arrays kernel locals math math.ranges sequences
sequences.extras ;
:: triples ( n -- seq )
n [1,b] [| x |
x n [a,b] [| y |
y n [a,b]
[| z | x sq y sq + z sq = ]
[| z | x y z 3array ]
Oo, or even
: triples ( n -- seq )
iota rest 3 [ first3 triple? ] filter-combinations ;
On Mon, May 20, 2013 at 7:06 PM, Alex Vondrak ajvond...@gmail.com wrote:
Or, going by the algorithms in the wiki:
```
USING: arrays kernel locals math math.ranges sequences
sequences.extras ;
::
On Sun, Sep 27, 2009 at 1:44 PM, Hugh Aguilar hugoagui...@rosycrew.com wrote:
None of the spliting functions take an index however. All of
them are splitting on a particular subsequence.
I think you want 'cut' or 'cut*'. This is in the Subsequences and
Slices part of the help.
Chris.
--
On Sat, Sep 26, 2009 at 8:44 PM, Hugh Aguilar hugoagui...@rosycrew.com wrote:
For example, I want to find a node in the list and split the list into two
lists at that point. With sequences, the function find returns an index into
the sequence. None of the spliting functions take an index
On Fri, May 29, 2009 at 11:03 PM, Hugh Aguilar hugoagui...@rosycrew.com wrote:
I'm aware of unit testing, having read about it in a book: Foundations of
Agile Python Development (Jeff Younker). I don't have much experience with
it in any language though (I'm learning Python simultaneously with
.
- Original Message -
From: factor-talk-requ...@lists.sourceforge.net
To: factor-talk@lists.sourceforge.net
Message: 2
Date: Wed, 27 May 2009 19:44:08 +0300
From: Kobi Lurie k_lu...@gbrener.org.il
Subject: Re: [Factor-talk] list
To: factor-talk@lists.sourceforge.net
Message-ID
Hugh,
What you've implemented is like Factor's dlists,
http://docs.factorcode.org/content/article-dlists.html.
They are an implementation of the deque abstract data type,
http://docs.factorcode.org/content/article-deques.html
Slava
On Tue, May 26, 2009 at 11:59 PM, Hugh Aguilar
I'd like to implement a FUEL command displaying the list of callers of a
given word. Is there an easy way to ask factor for them?
--
___
Factor-talk mailing list
On Dec 20, 2008, at 11:11 AM, Jose A. Ortega Ruiz wrote:
I'd like to implement a FUEL command displaying the list of callers
of a
given word. Is there an easy way to ask factor for them?
The usage. word will do what you want.
\ swap usage.
-Joe
18 matches
Mail list logo