Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gfldex (9543)

  (email not shown publicly)
+ -

  Comment: teach for a new trick (Score 1) on 2010.07.16 9:51

by gfldex on 2010.07.16 9:51 (#72173)
Attached to: Phasers are a blast: FIRST and LAST
If you asume that any block got FIRST and LAST but by default those fellows are empty function calls, you could move the condition to call FIRST and/or LAST out of the pointy block and into for.

The only condition you have left then would be if the list is empty. "for" has to check that anyway (at some point) so you don't really add anything.

I don't really like to have $LOOP_HAS_RUN = True; any time you call the pointy block.

I tried to implement it in javascript and ended up with the following.

window.super_for = function(it, code){
    var first = code.FIRST ? code.FIRST : function(){};
    var last = code.LAST ? code.LAST : function(){};

    var current = it();
    if (current !== iterable.done) {
    } else {

    do {
    } while( (current = it()) !== iterable.done );


In perl6 I would try (if I would know how :) to transform:

for @list -> $a {
  FIRST { say "i haz a first!" }
  say "$a";
  LAST { say "i is done" }


fancy_for(@list, $code, $code_first, $code_last);

You could default $code_first and $code_last to an empty block and let the optimizer remove those.
Read More 13 comments
Comments: 13
+ -

  Comment: Re:what might be your case (Score 1) on 2009.12.28 11:17

by gfldex on 2009.12.28 11:17 (#71446)
Attached to: Notation, and the 'business case' for Perl 6

Hm. But I imagine bridge-building tools aren't free of charge, so I'm not sure if the analogy helps me. It tells me more about how building programs is not like building bridges...

If we put the same amount of afford into bridge building tools then we did invest into information transportation tools (think of all the miners that minded all the copper that was used to make the cables that where needed to power the routers that make it possible that you can read my words right now) it might get possible to provide bridge building tools by everybody to everyone who is willing to play 15 EUR per month.

I'm going to read that as 'mindful of' rather than 'worried about', because the latter sounds like you know something about my financial situation (or my father) that I don't. :)

Do you have children of your own? If you do and you are not in the constant state of mild worryness you are not very close to the average parent and quite lucky :).

Hm. That ('complete and utter cow poo') would be a step down from what I was aiming for: to put what I'm doing in terms that he can understand without distorting them unnecessarily for the purposes of simplicity. My dad's a smart cookie, albeit with little direct experience of FOSS development.

That's the catch. You can't understand FOSS if you don't understand that the interwebs have turned our world up side down. Until about 100 years ago moving information from A to B was hard and involved a lot walking and riding. Is some cases you had to wait a few months for all the snow to go away. Getting food instead was easy. (well, compared to traveling) You went outside and collected or hunted some and you where fine. Try to do the same in a modern City without getting the police after you. Ofc, money will solve that problem but a proper war would cause problems for anybody that lives in a big city. That might be the reason why we don't have any big wars close to mega cities anymore.

Another thing that has changed and are needed to allow you to give software away for free is the frightening increase of efficiency of farmers (or food maker in general). In the western world a single farmer can make the food for hundreds of ppl. If I would be a farmer I would be a tiny little wee bit angry of ppl that get rich with software. I would even go so far to demand getting software for (nearly) free. But here in Europe only french farmers are allowed to be demanding, so I properly wouldn't anyways.

The whole FOSS thingy tells you more about the society we live in that it does about software.

I like the phase space analogy, and I've used it in a few of my own talks. But that wasn't really what I was aiming for here... the notational convenience is more like a better vehicle for navigating the phase space, taking you further than before, and in shorter time.

The whole point of information is that it can grow and accumulate (Thanks DNA!). You are not just getting further then before, you create the tools to be used by ppl to build a whole new continent for you to explore. FOSS is a lot more selfish then it might look to the untrained eye.

Read More 9 comments
Comments: 9
+ -

  Comment: what might be your case (Score 1) on 2009.12.28 9:24

by gfldex on 2009.12.28 9:24 (#71444)
Attached to: Notation, and the 'business case' for Perl 6
A good physical analogy of programming languages are bridges. Getting over a river without getting wet can save your health (getting sick is pricy and ppl that use terms like business plan hate pricy). In bridge-terms providing Perl (awesome) 6 free of charge is like making tools to make bridges available to anybody who likes building bridges. Ofc, you could just build the bridge yourself and therefore could keep Perl (awesome) 6 all to yourself. But with the free as in beer thingy and a bit of time you might end up being able to cross _all_ rivers because you give power to the (slightly strange) ppl. This explanation might suit your dad who is of cause worried about your financial situation. And as many stories-for-parents it's complete and utter cow poo. The Real Thing is that with helping Perl (awesome) 6 to get to birth you increase the speed of the speed of the growth of your personal phase space of shinies. How cool is that! Ohh, while we are on it. Is anybody working on bindings for clutter for Parrot/Perl6? And if there is nobody, where can I read up about making such bindings?
Read More 9 comments
Comments: 9