On 2011-02-23 16:36, Andrei Alexandrescu wrote:
On 2/23/11 9:30 AM, Jacob Carlborg wrote:
On 2011-02-23 13:57, Andrei Alexandrescu wrote:
On 2/23/11 5:10 AM, Jacob Carlborg wrote:
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def
On 02/24/2011 09:55 AM, Russel Winder wrote:
On Wed, 2011-02-23 at 23:51 +0100, spir wrote:
[ . . . ]
(sequence(["#"])(nextCarpet) drop n next) foreach println
Hey guys, it's PostScript, no it's Forth ;-)
Note that method chaining in typical OO syntax writes the process in
chronologic
On Wed, 2011-02-23 at 23:51 +0100, spir wrote:
[ . . . ]
> (sequence(["#"])(nextCarpet) drop n next) foreach println
Hey guys, it's PostScript, no it's Forth ;-)
--
Russel.
=
Dr Russel Winder t: +44 20 7585 220
On 02/23/2011 01:57 PM, Andrei Alexandrescu wrote:
On 2/23/11 5:10 AM, Jacob Carlborg wrote:
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def nextCarpet(carpet: List[String]): List[String] = (
carpet.map(x => x + x + x) :::
carpet
On 2/23/11 9:30 AM, Jacob Carlborg wrote:
On 2011-02-23 13:57, Andrei Alexandrescu wrote:
On 2/23/11 5:10 AM, Jacob Carlborg wrote:
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def nextCarpet(carpet: List[String]): List[String] =
On 2011-02-23 13:57, Andrei Alexandrescu wrote:
On 2/23/11 5:10 AM, Jacob Carlborg wrote:
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def nextCarpet(carpet: List[String]): List[String] = (
carpet.map(x => x + x + x) :::
carpet.ma
On 2011-02-23 13:13, bearophile wrote:
Jacob Carlborg:
def sierpinskiCarpets(n: Int) = (Iterator.iterate(List("#"))(nextCarpet) drop n
next) foreach println
Again Scala shines with its beautiful lambdas compared to Ds ugly string
version.
In software engineering there aren't many free thin
Andrei:
> popFrontN(c, 3);
> ... use c.front() ...
Right. I have used the c.popFrontN(3); syntax and then I have not read the
error message well.
A drop(range, n) is an expression, it allows to write it as this:
drop(c, 3).front
> You shouldn't need array most at all. Use chain() instead of ~
On 2/22/11 8:28 PM, bearophile wrote:
import std.stdio, std.string, std.algorithm, std.array, std.range;
string[] nextCarpet(string[] c) {
auto b = array(map!q{a ~ a ~ a}(c));
return b ~ array(map!q{a ~ a.replace("#"," ") ~ a}(c)) ~ b;
}
void main() {
auto c = recurrence!((a, n){
On 2/23/11 5:10 AM, Jacob Carlborg wrote:
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def nextCarpet(carpet: List[String]): List[String] = (
carpet.map(x => x + x + x) :::
carpet.map(x => x + x.replace('#', ' ') + x) :::
carpet.ma
Jacob Carlborg:
> > def sierpinskiCarpets(n: Int) = (Iterator.iterate(List("#"))(nextCarpet)
> > drop n next) foreach println
>
> Again Scala shines with its beautiful lambdas compared to Ds ugly string
> version.
In software engineering there aren't many free things. For some of the Scala
fe
On 2011-02-23 03:28, bearophile wrote:
This is a Scala implementation of a function that prints the carpet:
def nextCarpet(carpet: List[String]): List[String] = (
carpet.map(x => x + x + x) :::
carpet.map(x => x + x.replace('#', ' ') + x) :::
carpet.map(x => x + x + x))
def sierpin
On 02/23/2011 03:28 AM, bearophile wrote:
A task from the RosettaCode site asks to generate a Sierpinski carpet like
this, on given order:
###
# ## ## ## ## ## ## ## ## #
###
### ## ## ###
# # # ## # # ## # # #
### ##
A task from the RosettaCode site asks to generate a Sierpinski carpet like
this, on given order:
###
# ## ## ## ## ## ## ## ## #
###
### ## ## ###
# # # ## # # ## # # #
### ## ## ###
###
# #
14 matches
Mail list logo