Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

April 12 2009

leobm

Rhino on Android

Reposted fromrobi42 robi42
leobm

March 30 2009

leobm
6733 10bf
SimplyNoise is a white, pink, and brown noise generator in the form of a web page.
Reposted fromminima minima

February 18 2009

leobm
leobm

Array/List comprehensions

When you read the great book "Programming Erlang" from Joe Armstrong
there is a chapter about Mnesia. Mnesia is a distributed, soft real-time database
management system written in the Erlang and included in the Erlang distribution.
One great thing, when you looking at the Mnesia queries, it is not SQL or a new exotic own query language.
No, It is pure Erlang and called list comprehension. You have to know only Erlang!

qlc:q([X#shop.item || X <- mnesia:table(shop),
                                         X#shop.quantity < 250,
                                         Y <- mnesia:table(cost),
                                         X#shop.item =:= Y#cost.name,
                                         Y#cost.price < 2
            ]).
%% SQL equivalent
%% SELECT shop.item, shop.quantity, cost.name, cost.price
%% FROM shop, cost
%% WHERE shop.item = cost.name
%%   AND cost.price < 2
%%   AND shop.quantity < 2

A list comprehension is a syntactic construct for creating a list based on existing lists.
It can be implemented  using map and filter too. But list compressions provide you a  simpler to use and more natural syntax.
Today, I realized that the same feature is already included in Javascript since version 1.7.
What a shame ! :)
It called array comprehensions but works similar like list comprehension in Erlang.
Here the equivalent full javascript code:

<script type="application/javascript;version=1.7">
var shop_table = [
    {item:"apple", quantity: 20, cost:2.3},
    {item:"orange", quantity: 100, cost:3.8},
    {item:"pear", quantity: 200, cost:3.6},
    {item:"banana", quantity: 420, cost:4.5},   
    {item:"potato", quantity: 2456, cost:1.2}
];
var cost_table = [
    {name: "apple", price: 1.5},
    {name: "orange", price: 2.4},
    {name: "pear", price: 2.2},
    {name: "banana", price: 1.5},
    {name: "potato", price: 0.6}
];

var items = [s.item for each (s in shop_table)
        for each (c in cost_table)
        if (s.quantity < 250 && s.item==c.name && c.price<2)                               
];
console.log(items);
// Result: ["apple"]
</script>

[1] https://developer.mozilla.org/en/New_in_JavaScript_1.7#Array_comprehensions
[2] http://ecmascript4.com/doc/arraycomprehensions
[3] http://en.wikibooks.org/wiki/Erlang_Programming/List_Comprehensions
[4] http://www.scribd.com/doc/103818/MNESIA-Database-Management-System
Reposted bymuhqu muhqu

February 06 2009

leobm
leobm
Play fullscreen

Lecture about Z3 at Deutsches Museum

A funny Guide explains the Functions of the Z3 and tells some stories about Conrad Zuse:

"Die Zuse-Firma bestand aus ihm selber, der Chef, dann ein vorbestrafter Buchhalter, ein blinder Mathelehrer - der hat die Filme gelocht… ja, der hat das Tag und Nacht gemacht - das war dem auch wurscht, ob’s Tag oder Nacht war. Und dann kam noch ein Konstrukteur aus einer Nervenheilanstalt. Was sehen wir an der Story? In der Branche waren immer schon die abgefahrensten Typen!"
Reposted fromerstgeborener erstgeborener

January 20 2009

leobm

January 07 2009

leobm

December 10 2008

leobm

December 03 2008

leobm
Reposted fromtypography typography

November 25 2008

leobm

November 21 2008

leobm

November 18 2008

leobm

Girl with a perl earring

Reposted fromjohl johl viatowo towo

November 16 2008

leobm
visible sound
Reposted fromschischa schischa viaantifuchs antifuchs

November 15 2008

leobm

Higher-order shell

Reposted byantifuchsjaphybbd

October 28 2008

leobm
Video Tutorial To Start Developing Web Applications on Erlang
leobm

October 27 2008

leobm
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl