Set operations on ruby arrays

Nikolaus Gradwohl2009-11-28T05:23:00+01:00

Ruby provides some very interesting set operations on arrays.

given the two arrays A and B wich look like this

A = ["A", "B", "C", "D"]
B = ["C", "D", "E"]

There are three set operations we can use that union, intersection and difference.

Union

union

A | B

contains all elements from both sets without doublicates. So this results in ["A", "B", "C", "D", "E"]

Difference

difference

A - B

contains all elements from set A that are not in set B. So this results in ["A", "B"]

Intersection

intersection

A & B

contains all elements that are in set A and in set B. So this results in ["C", "D"]

read more ...

Proagwrimo 16 - 22

Nikolaus Gradwohl2009-11-23T03:06:00+01:00

45 pages so far. I started making screenshots for the examples, and finished some of the code examples.

read more ...

Pragprowrimo 11-15

Nikolaus Gradwohl2009-11-15T06:42:00+01:00

32 pages so far, i added another section and i finished some of the examples for the book. One example for the chapter on interaction will be a litte game. The player has to type some random letters that appear on the screen. After 20 sections the number of found letters is displayed as the score.

click here to give it a try

read more ...

multiple lines in processing

Nikolaus Gradwohl2009-11-12T04:57:00+01:00

I wrote a processing-sketch to test how to connect to points using multiple curves that are slightliy shifted by random values. Looks really good in datavisualisation apps.

click here to run the applet and see the code.

multiline

read more ...

Pragprowrimo day 8,9,10

Nikolaus Gradwohl2009-11-11T03:20:00+01:00

I wrote 26 pages so far, and i startet a new chapter on interaction using audio and video.

read more ...

pragpromwrimo day 5, 6 and 7

Nikolaus Gradwohl2009-11-07T10:36:00+01:00

It's a bit chaotic at the moment, but i managed to write at least 1/2 a page every day. I have 21 pages now and i have split up my docbook file in one file per chapter. I also started writing some of the example processing-sketches.

read more ...

Ruby Caldav Library 0.3

Nikolaus Gradwohl2009-11-07T07:14:00+01:00

have made a new version of my ruby caldav lib.

version 0.3 is a bugfix release, to make it work with the kde4 calendar

read more ...

pragpromwrimo day 3 and 4

Nikolaus Gradwohl2009-11-05T04:22:00+01:00

I wrote 4 new pages on the processing book i write for pragprowrimo, and startet to read what i have written. i also fixed some small typos. i think one section needs to be rewritten, but i'm surpriced how well it works so far.

read more ...

pragprowrimo day 2

Nikolaus Gradwohl2009-11-03T04:00:00+01:00

I wrote anoter 5 pages of my processing book, and as the praglife blog tells us i haven't tried to correct anything besides syntax-errors in my docbook files yet.

read more ...

pragprowrimo the first day

Nikolaus Gradwohl2009-11-01T20:26:00+01:00

The pragmatic programmers have started the Pragmatic Programmers Writing Month and post tips in their pragmatic live blog. The goal is to write 80 pages or more during november.

I have started a book on processing today and managed to write my first 6 pages. i will post my progress on this blog and tag the articles with pragprowrimo

read more ...