-
-
Save jeremyheiler/10015006 to your computer and use it in GitHub Desktop.
USING: kernel math math.functions sequences ; | |
IN: euler1 | |
: euler1 ( x -- y ) | |
iota [ dup [ 3 divisor? ] [ 5 divisor? ] bi or [ drop 0 ] unless ] map-sum ; |
You bet! If you keep posting gists, I'd be glad to review stuff.
The online documentation is a bit easier to search because it has all of the vocabularies loaded, where your local image won't. There are words like apropos, see, about and so on to help explore, but discoverability is admittedly a bit difficult. The docs are great, but it's still hard to narrow things down if you don't know what you're looking for...but that gets easier. Scanning through the "Vocabulary Index" in the help can give you a good idea of the types of stuff that's covered, and also -completing things while paying attention to the stack effect declaration displayed at the bottom of the listener can also be useful. The #concatenative chatroom is also helpful and friendly folks are always willing to review code and offer advice.
http://elasticdog.com/2008/12/beginning-factor-shufflers-and-combinators/#iota 😄
Using numeric ranges can be handy; my first attempt at this problem (from many years ago) looked like:
: euler1 ( x -- y )
0 999 3 <range> sum 0 999 5 <range> sum + 0 999 15 <range> sum - ;
Thanks again!
That's a clever way to solve the problem.
Thanks! Appreciate it.
[1,b]
.3 & 4. Excellent.