Slashdot Mirror


User: Jayson

Jayson's activity in the archive.

Stories
0
Comments
225
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 225

  1. Wasn't it supposed to be simple? on W3C Recommends XSL · · Score: 3, Interesting

    After having used XSLT about a dozen times, I gave up. I had DSSSL expreience before, so I thought that it would be similar and that I could transfer some of my experience over. I felt like I was more productive in yacc or Antlr for quick projects and for anything that started to become more complex, I felt that the XSLT transformation definition complexity grew polynomially. For very large projects (more than a hundred million element, blame someone else for choosing XML for this, not me) I couldn't find a transformer that worked, even though I made sure that the DTD was regular (not context free).

    I thought that the original goal was to make a _simple_ declarative language that handled 80% of the transformations easily and left the other 20% to something else (like using a real language). Even the simplest tasks require too much code in my opinion. My first XSLT project, a learning project, was to write the game of life, as it is with every new tool. I have two versions, the shortest being 150 lines that required the field to be an ugly composition of <o/> and <X/> elements.

    There is a very high syntax to semantics ratio. Similar operations require different syntax, such as inserting an element can be done literally, but inserting an attribute requires special instructions (a minimum of 2 elements). There is no continuity in the different ways to reference a variable binding. You use templates to generate the structure of the XML but cannot generate text structure in a similar way, neither content data or attribute value data. Blah blah blah... I could go on. It seems like they ended up with a complex framework without strong expressive power. Why couldn't they just do DSSSL with the XML syntax if they wanted it?

    Besides, for me it is difficult to look at with XSLT definitions/commands, obviously in XML, sprinkled around output literal XML elements. But I haven't trained my XSLT syntax eye too extensively. It is probably the same way people feel about looking at my DSSSL code.

    p.s., I think they lie when they say it is side effect free and completely declarative.

    -j

  2. Do away with set-theoretic background of SQL? on MySQL 4.0 Released · · Score: 2, Informative
    Clustered indexes. These basically physically sort the table based on particular columns. This allows you to ORDER BY username ASC without using anything special since the rows are already sorted on username (if you have a users table and cluster the username col).

    It seems like most of your problems would be easily solved if we ditched the original set-theoretic background of SQL (where results are in an unordered set as opposed to an ordered sequence). If the DBA was heavily aware of the ordering of tables, then constructing efficient queries that made linear table/index scans would be easier. It seems like this would be amazingly cache and read-ahead friendly.

    -j
  3. KDB ran on 50cpu Linux cluster. on MySQL 4.0 Released · · Score: 1

    People should really try some of the other lesser known alternatives. Some area really quite amazing, like KDB.

    KDB is probably the smallest, fastest, most efficient database on Linux. The install files are 148k (compressed). It also has the best stored procedure language around (it may look like Perl, but it is no where close to it in philosophy).

    ----
    on thursday jan 4, 2001 steve miano, ed bierly, keith mason and i
    loaded 2.5 billion trades and quotes on a 50cpu linux cluster.

    simple table scans on one billion trades, e.g.

    select distinct sym from trade
    select max price from trade

    take 1 second

    multi-dimensional aggregations, e.g.

    / 100 top traded stocks
    100 first desc select sum size*price by sym from trade

    / daily high and close
    select high:max price, close:last price by sym, date from trade

    take 10 to 20 seconds

    translating the data from TAQ to kdb took about 5 hours.
    (steve had loaded the 200 TAQ cd's onto several disk drives.)

    distributing the 100gigabytes over the 100Mbit ethernet took 3 hours.
    (this cluster should probably have Gbit ethernet)

    loading the database (k db taq.m -P 2080), starting 50 slaves,
    connecting, mapping shared indicative tables over nfs, building
    parallel partitions, etc. took .1 second.

    ----
    1. What is Kdb ?

    Kdb is an extremely fast RDBMS extended for time-series analysis.

    2. Does Kdb support SQL92, ODBC and JDBC ?

    Yes.

    3. Is Kdb a read-only RDBMS ?

    No. Kdb is very fast for OLTP (online transaction processing).
    For example, it runs over 50,000 ATM-style transactions per second logged
    to disk with full recovery on a single cpu. This was against a database of
    over 100,000,000 accounts, tellers and branches. Kdb can do batch updates at
    several hundred thousand records per second per cpu.

    4. Is Kdb a memory resident RDBMS ?

    No. Kdb has minimal memory requirements and is very fast from disk.
    For example, it ran the gigabyte TPC-D (an industry standard decision support benchmark)
    queries and updates on a 200MHZ PC with 64 megabytes of memory, an ultrawide SCSI
    controller and four disk drives many times faster than the best published results
    at a fraction the cost.

    5. What about time series ?

    Kdb handles much more than just SQL92 tables. Online analytical
    processing (OLAP) on multi-dimensional arrays is done with our
    extended SQL language, KSQL. For example, on the 35 megabyte OLAP APB-1
    benchmark queries, Kdb ran 12,000 queries per minute with no precalculation.

    6. Since Kdb is so fast, does it require more storage ?

    No. Kdb is simple and will often store just the raw data.
    For example, in TPC-D, the published results required storage
    between 3 and 10 times the raw data. The Kdb factor is a little over one.
    Some OLAP tools require (for fast queries) massive precalculations. For example,
    in APB-1 some expanded the 35 megabytes of input data to many gigabytes. Kdb
    aggregates relations (extended with time series fields) so fast that precalculation
    is often obviated. Certainly when the raw data is less than a few gigabytes.

    7. Is there a parallel version ?

    Yes. Although Kdb can handle much larger databases than other database
    products without requiring parallel processing, there is a parallel
    version for the largest applications. Kdb scales

    See http://kx.com

    -j

  4. People should try KDB. Its primo. on New Releases For MySQL (4.0), Samba (2.2.2) · · Score: 3, Interesting

    KDB is a very fast and efficient. It also has the best stored procedure language around (it may look like Perl, but it is no where close to it in philosophy).

    ----
    on thursday jan 4, 2001 steve miano, ed bierly, keith mason and i
    loaded 2.5 billion trades and quotes on a 50cpu linux cluster.

    simple table scans on one billion trades, e.g.

    select distinct sym from trade
    select max price from trade

    take 1 second

    multi-dimensional aggregations, e.g.

    / 100 top traded stocks
    100 first desc select sum size*price by sym from trade

    / daily high and close
    select high:max price, close:last price by sym, date from trade

    take 10 to 20 seconds

    translating the data from TAQ to kdb took about 5 hours.
    (steve had loaded the 200 TAQ cd's onto several disk drives.)

    distributing the 100gigabytes over the 100Mbit ethernet took 3 hours.
    (this cluster should probably have Gbit ethernet)

    loading the database (k db taq.m -P 2080), starting 50 slaves,
    connecting, mapping shared indicative tables over nfs, building
    parallel partitions, etc. took .1 second.

    ----
    1. What is Kdb ?

    Kdb is an extremely fast RDBMS extended for time-series analysis.

    2. Does Kdb support SQL92, ODBC and JDBC ?

    Yes.

    3. Is Kdb a read-only RDBMS ?

    No. Kdb is very fast for OLTP (online transaction processing).
    For example, it runs over 50,000 ATM-style transactions per second logged
    to disk with full recovery on a single cpu. This was against a database of
    over 100,000,000 accounts, tellers and branches. Kdb can do batch updates at
    several hundred thousand records per second per cpu.

    4. Is Kdb a memory resident RDBMS ?

    No. Kdb has minimal memory requirements and is very fast from disk.
    For example, it ran the gigabyte TPC-D (an industry standard decision support benchmark)
    queries and updates on a 200MHZ PC with 64 megabytes of memory, an ultrawide SCSI
    controller and four disk drives many times faster than the best published results
    at a fraction the cost.

    5. What about time series ?

    Kdb handles much more than just SQL92 tables. Online analytical
    processing (OLAP) on multi-dimensional arrays is done with our
    extended SQL language, KSQL. For example, on the 35 megabyte OLAP APB-1
    benchmark queries, Kdb ran 12,000 queries per minute with no precalculation.

    6. Since Kdb is so fast, does it require more storage ?

    No. Kdb is simple and will often store just the raw data.
    For example, in TPC-D, the published results required storage
    between 3 and 10 times the raw data. The Kdb factor is a little over one.
    Some OLAP tools require (for fast queries) massive precalculations. For example,
    in APB-1 some expanded the 35 megabytes of input data to many gigabytes. Kdb
    aggregates relations (extended with time series fields) so fast that precalculation
    is often obviated. Certainly when the raw data is less than a few gigabytes.

    7. Is there a parallel version ?

    Yes. Although Kdb can handle much larger databases than other database
    products without requiring parallel processing, there is a parallel
    version for the largest applications. Kdb scales

    ----
    KDB is the classiest database on the internet.
    See http://kx.com

    -j

  5. Unique Scheme Ideas on Ask Kent M. Pitman About Lisp, Scheme And More · · Score: 1

    Nobody ever mentions call-with-current-continuation. Scheme-like continuations seem to change everything in a language. Now Scheme behaves like Icon in that any function can return multiple times. Coroutines and cooperative threading become trivial to implement. Try to wrap your head around returning a continuation from a function or passing a continuation into another continuation. Continuations provide a functional way to remove control logic from a program.

    Continuations make forms like "promise" and "force" work. With promise and force you can make Scheme lazily evaluate arguments to a function of an infinitely long list (or promise to provide a continuation). force will only evaluate a promise once, no matter how many times a promise is forced.

    (promise thunk) ;; delays the evaluation of the function thunk (a thunk is a function that does not take an angument) until it is later needed.

    (force prom) ;; forces the evaluation of the promise prom, which is the value of evaluting the origiinal thunk.

    You make lists where the tail if the list is a promise to evaluate the rest of the list.

    Another fun Scheme form is "amb" meaning abigious. Solving the 8-queens problem becomes trivial. Amb allows a program to search a state space without having to encoding the search and backtracking logic.

    (amb ...) ;; returns all its arguments, one at a time (meaning the function returns multiple times), until it has no more arguments to return. At that time it fails, and computation backsup to the preceding the preceding amb form.

  6. What was up with CLisp's "loop" form? on Ask Kent M. Pitman About Lisp, Scheme And More · · Score: 1

    Did you can have anything to do or know who had anything to do with the "loop" form in Common Lisp? Why does it look and feel just like a FOR loop on C (from the Graham book):

    (loop for x = 8 then (/x 2)
    until (< x 1)
    do (princ x))

    This is one of by biggest minor nags about CLisp and I am very curious what was going through the committee's collective head. Didn't anybody balk at this enough to at least get the syntax cleaned up?

    -j

  7. APL was the 2nd computer language on Esoteric Programming Languages · · Score: 1

    It was created by Dr. Kenneth Iverson who thought that programming should just be a strict formalized mathematical notation. He then when on to create the successor, J (http://www.jsoftware.com).

    Dr. Iversion originally wanted Arthur Whitney to write the J interpreter and over an afternoon, he created the first J interpreter. I've appended this amazing piece of code (proof you can write APL in any langauage). Arthur decided to attempt his next version of APL, called imaginitively, K (http://kx.com).

    K is one of the fastest, most reflective, powerful languages that I have ever used and I almost do not use anything else anymore. More people should be touting the praises of K.

    Here is the J interpreter (taken from http://www.kx.com/listbox/k/msg03690.html):

    typedef char C;typedef long I;
    typedef struct a{I t,r,d[3],p[2];}*A;
    #define P printf
    #define R return
    #define V1(f) A f(w)A w;
    #define V2(f) A f(a,w)A a,w;
    #define DO(n,x) {I i=3D0,_n=3D(n);for(;i<_n;++i){x;}}
    I *ma(n){R(I*)malloc(n*4);}mv(d,s,n)I *d,*s;{DO(n,d[i]=3Ds[i]);}
    tr(r,d)I *d;{I z=3D1;DO(r,z=3Dz*d[i]);R z;}
    A ga(t,r,d)I *d;{A z=3D(A)ma(5+tr(r,d));z->t=3Dt,z->r=3Dr,mv(z->d,d,r );
    R z;}
    V1(iota){I n=3D*w->p;A z=3Dga(0,1,&n);DO(n,z->p[i]=3Di);R z;}
    V2(plus){I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);A z=3Dga(0,r,d);
    DO(n,z->p[i]=3Da->p[i]+w->p[i]);R z;}
    V2(from){I r=3Dw->r-1,*d=3Dw->d+1,n=3Dtr(r,d);
    A z=3Dga(w->t,r,d);mv(z->p,w->p+(n**a->p),n);R z;}
    V1(box){A z=3Dga(1,0,0);*z->p=3D(I)w;R z;}
    V2(cat){I an=3Dtr(a->r,a->d),wn=3Dtr(w->r,w->d),n=3Dan+wn;
    A z=3Dga(w->t,1,&n);mv(z->p,a->p,an);mv(z->p+an,w->p ,wn); R z;}
    V2(find){}
    V2(rsh){I r=3Da->r?*a->d:1,n=3Dtr(r,a->p),wn=3Dtr(w->r,w->d) ;
    A z=3Dga(w->t,r,a->p);mv(z->p,w->p,wn=3Dn>wn?wn:n);
    if(n-=3Dwn)mv(z->p+wn,z->p,n);R z;}
    V1(sha){A z=3Dga(0,1,&w->r);mv(z->p,w->d,w->r);R z;}
    V1(id){R w;}V1(size){A z=3Dga(0,0,0);*z->p=3Dw->r?*w->d:1;R z;}
    pi(i){P("%d ",i);}nl(){P("\n");}
    pr(w)A w;{I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);DO(r,pi(d[i]));nl() ;
    if(w->t)DO(n,P("< ");pr(w->p[i]))else DO(n,pi(w->p[i]));nl();}

    C vt[]=3D"+{~<#,";
    A(*vd[])()=3D{0,plus,from,find,0,rsh,cat},
    (*vm[])()=3D{0,id,size,iota,box,sha,0};
    I st[26]; qp(a){R a>=3D'a'&&a<=3D'z';}qv(a){R a<'a';}
    A ex(e)I *e;{I a=3D*e;
    if(qp(a)){if(e[1]=3D=3D'=3D')R st[a-'a']=3Dex(e+2);a=3D st[ a-'a'];}
    R qv(a)?(*vm[a])(ex(e+1)):e[1]?(*vd[e[1]])(a,ex(e+2) ):(A)a;}
    noun(c){A z;if(c<'0'||c>'9')R 0;z=3Dga(0,0,0);*z->p=3Dc-'0';R z;}
    verb(c){I i=3D0;for(;vt[i];)if(vt[i++]=3D=3Dc)R i;R 0;}
    I *wd(s)C *s;{I a,n=3Dstrlen(s),*e=3Dma(n+1);C c;
    DO(n,e[i]=3D(a=3Dnoun(c=3Ds[i]))?a:(a=3Dverb(c))?a :c);e[n]=3D0;R e;}

    main(){C s[99];while(gets(s))pr(ex(wd(s)));}

  8. Why the focus on syntax? on Esoteric Programming Languages · · Score: 1

    It might be better to categorize languages by what approach it they use to solve problems. There are many poor Java programmers because they learned C first, when Smalltalk would have been a better initiation.

    An example seperation might be:

    Array: APL, J, K
    Concatenative: Forth, Postscript, Joy
    Declarative Constraint: Prolog, Oz
    Declarative Functional: Erlang
    Functional: Haskel, ML, Icon, Unlambda
    Imperative: Algol, C, Assembly
    Object: Java, Smalltalk, Self
    Pattern: Z

    I am not sure where you put Lisp and Scheme, as these two languages rely heavily on their syntax to blur the line between code and data. Because of this, they seem to really fall into every category. These languages really allow the programmer to define a mini-language that is very close to the problem field. Yes, I am a Scheme fanatic, so I am biased.

    -j

  9. Try the alternative: KDB. It's primo. on Major Changes To MySQL Coming Soon · · Score: 1

    KDB is a very fast and efficient. It also has the best stored procedure language around (it may look like Perl, but it is no where close to it in philosophy).

    ----
    on thursday jan 4, 2001 steve miano, ed bierly, keith mason and i
    loaded 2.5 billion trades and quotes on a 50cpu linux cluster.

    simple table scans on one billion trades, e.g.

    select distinct sym from trade
    select max price from trade

    take 1 second

    multi-dimensional aggregations, e.g.

    / 100 top traded stocks
    100 first desc select sum size*price by sym from trade

    / daily high and close
    select high:max price, close:last price by sym, date from trade

    take 10 to 20 seconds

    translating the data from TAQ to kdb took about 5 hours.
    (steve had loaded the 200 TAQ cd's onto several disk drives.)

    distributing the 100gigabytes over the 100Mbit ethernet took 3 hours.
    (this cluster should probably have Gbit ethernet)

    loading the database (k db taq.m -P 2080), starting 50 slaves,
    connecting, mapping shared indicative tables over nfs, building
    parallel partitions, etc. took .1 second.

    ----
    1. What is Kdb ?

    Kdb is an extremely fast RDBMS extended for time-series analysis.

    2. Does Kdb support SQL92, ODBC and JDBC ?

    Yes.

    3. Is Kdb a read-only RDBMS ?

    No. Kdb is very fast for OLTP (online transaction processing).
    For example, it runs over 50,000 ATM-style transactions per second logged
    to disk with full recovery on a single cpu. This was against a database of
    over 100,000,000 accounts, tellers and branches. Kdb can do batch updates at
    several hundred thousand records per second per cpu.

    4. Is Kdb a memory resident RDBMS ?

    No. Kdb has minimal memory requirements and is very fast from disk.
    For example, it ran the gigabyte TPC-D (an industry standard decision support benchmark)
    queries and updates on a 200MHZ PC with 64 megabytes of memory, an ultrawide SCSI
    controller and four disk drives many times faster than the best published results
    at a fraction the cost.

    5. What about time series ?

    Kdb handles much more than just SQL92 tables. Online analytical
    processing (OLAP) on multi-dimensional arrays is done with our
    extended SQL language, KSQL. For example, on the 35 megabyte OLAP APB-1
    benchmark queries, Kdb ran 12,000 queries per minute with no precalculation.

    6. Since Kdb is so fast, does it require more storage ?

    No. Kdb is simple and will often store just the raw data.
    For example, in TPC-D, the published results required storage
    between 3 and 10 times the raw data. The Kdb factor is a little over one.
    Some OLAP tools require (for fast queries) massive precalculations. For example,
    in APB-1 some expanded the 35 megabytes of input data to many gigabytes. Kdb
    aggregates relations (extended with time series fields) so fast that precalculation
    is often obviated. Certainly when the raw data is less than a few gigabytes.

    7. Is there a parallel version ?

    Yes. Although Kdb can handle much larger databases than other database
    products without requiring parallel processing, there is a parallel
    version for the largest applications. Kdb scales

    ----
    KDB is the classiest database on the internet.
    See http://kx.com

    -j

  10. Re:Open Source Testing on Kernel 2.4.12 Released · · Score: 1
    don't consider a release to be stable just because its in the so-called stable series.

    This has to be the lamest thing that I have ever heard. If this were a Windows(or FreeBSD) release people would be screaming their heads off blaming them or releasing poor quality software, especially when it says "stable". If the Linux branch is not stable, then why call it that? Change the name to "-old" or have a "-release" along with "-stable" and "-current".

    Those who do not know FreeBSD are doomed to repeat it. (Maybe if Linus wasn't so smug as to think that there was nothing to learn from other OSes he might have figured out how to do a proper build, label, and release cycle.)
  11. Re:Interesting view... on Matt Dillon On FreeBSD 5.0 VM System And More · · Score: 1

    Ohhh, I get it.

  12. Re:Functional languages and parentheses on Apocalypse 3 · · Score: 1

    I think the reason is that in Lisp and its derivatives -- such as Scheme -- the parentheses are thought of as the application operator: apply the first form to the succeeding forms.

    Also, it goes naturally with the idea that code (and data) are lists; everything is a list. To overly simplify, when a form is being evaluated you operate on data as lists. When a macro is being evaluated you operate on the code as lists. So Lisp gets to be its own macro language. This oftern verbose syntax gives the language enormous flexibility and reflectiveness; I cannot think of a more reflective languages than Common Lisp, especially since you can control most of the compilation process by modifying various built-in forms.

    If you do not like the parentheses, you can modify the "read" form to accept data that is not in list notation.

    Now, if only it had the beauty and consistency of APL, but that is one of Lisp's best traits; you can make it look and do anything even things that suck. In a way its beauty comes from be able to make it look so ugly.

    -j

  13. Why not a regular transducer? Why still regular? on The Perl Journal Archive Back (and Online Too!) · · Score: 1

    I was under the impression that Perl's patterns are more than regular, but not quite context free. Does anybody know where they are in expressiveness?

    Also, does anybody know why Perl doesn't implement a full regular transducer? It seems like that what they are having to hack at in the regex article. The full transducer can then pull at the already derived theory. I don't know what the theoretical power of the Perl's replace facility is, not being a big Perl person, but I imagine that the transducer would be more expressive and at least have well defined semantics.

    By the way, can anybody explain how Perl's matching expression are implemented? I tried looking at the code, but was quickly lost (At my last job, I even implemented a full transducer, too).

    -j

  14. Who did it? Was: Rotary Rocket gone on Private Rocketplane Test A Success · · Score: 1

    Do you who was doing this? Was it Roger Gregory from the Xanadu project? I used to work with him and he seemed to be working on something similar. He used to bring in pieces from failed tests, like 4" sections of the aluminum engine cracked clean from the rotational force. If it is the same person, too bad it didn't work out, he seemed to really be into his design and we all learned a little about rocketry when he was around.

  15. Warp Core at Disneyland on Star Trek: Enterprise Reactions? · · Score: 2, Funny
    The warp core looks primitive
    The warp core, and engine room in general, looked like Space Mountain at Disneyland.
  16. ResearchIndex cites and clarification on Purdue Builds Quantum-Computing Semiconductor · · Score: 3, Informative

    ResearchIndex should be in everybody's bookmarks.

    In the previous post, I wasn't quite clear (shoot me, it's 5am and I've been up all night): there are a couple of different methods that I was pulling information from. In the penultimate paragraph, the final sentence was an aside referring to a method of using entanglement to transfer the keys. The rest of the post was referring to a method using polarisations and Heisenburg. Here are the two links to the papers.

    First, for the transfer by polarisations. If you are at Cal, then go ask Vazirani, it looks like he has coauthored with them: http://citeseer.nj.nec.com/bennett92experimental.h tml

    Then on the use of entanglement (they do not have the actual paper, bastards): http://citeseer.nj.nec.com/context/18763/0

    -j

  17. Key distribution solved by Quantum, not hurt. on Purdue Builds Quantum-Computing Semiconductor · · Score: 2, Informative
    Nobody yet managed to transfer information like this, since first seperating them is difficult, and second the key to do something against the second one that would change the other one.
    From what I know, IBM Watson has done a quantum key distribution system, only over 30cm and a slow 10bit/s, though.
    Beside the physical part, there is another criptrograic prolbem: transportation of the key. You've to transport -securly- the key to other side, without having it replaced. So also this hypothetical communication is only as sure as your key-transportation is
    Yes, true. But one nice thing that quantum gives us is (probabilisticly) secure key distribution. The short is that you can exchange photon pairs with the person to comminucate to. You determine a polarization randomly before sent. They record what they get, then publicly anounce the type of polarization: 2 types with 2 directions, and you can only determine type of direction (Heisenburg tells us this). You tell them which ones are correct. Then direction becomes the 1's and 0's of the key. An eavesdropper by measuring the photon will introduce a 25% error since they/you can only determine either direction or type and they will get the other wrong half of the time. Also, the eavesdropper would need to detect the photon, then retransmit another, but this will destroy the quantum correlation betweent the two entangled photons so you will also know that way.

    Somebody please correct the problems here. I don't really know what I am saying and am bound to be wrong in places.

    -j
  18. Re:Clarification on Purdue Builds Quantum-Computing Semiconductor · · Score: 1
    factorisation of large numbers (which is an NP complete problem on conventional hardware)

    They don't know how hard factorizing numbers really is. They haven't proved anything, as far as I know. The best methods currently known are exponential, though; the Number Field Sieve is:
    exp(O(log^{1/3} n log^{2/3} log n))
    People used to think that the older Multiple Polynomial Quadratic Sieve was asymptotically optimal.
  19. Re:equivalent of lambda? on Artificial Intelligence Coding - Perl or Lisp? · · Score: 1

    I don't program enough in Perl to know any of this, so this is just an extension of the previous question.

    Alot of languages have anonymous functions and the ability to read, at definition time, from the enclosing environment. Can Perl also modify bindings from this environment as well as share bindings across multiple functions? I am not being clear, I think, so a code segment might be clearer. What is the Perl equivalent of the following Scheme code?

    ;;; Nobody dig on the code, this is a contrived example, and
    ;;; yes, I know there might be "better" ways to do this.

    (define (linked-counters value)
    (cons (lambda (increment) (set! value (+ value increment)) value)
    (lambda (decrement) (set! value (- value decrement)) value)))

    (define counters (linked-counters 3))
    (define increment-counter (car counters))
    (define decrement-counter (cdr counters))

    (increment-counter 4)
    (decrement-counter 10)

    In Scheme the result is '7' then '-3'.

    And of course, Scheme has the Real Programmers' favorite function 'call-with-current-continuation'. Quiche eaters will never understand it; it changes __everything__.

  20. Re:War will spill over into Pakistan and India on Afghanistan Is Like Nothing You've Ever Seen · · Score: 1

    Musharraf is hardly a dictator. Sharif killed that country. He was the leader of a corrupt government that destabilized the country by dividing his poeple over religion and and caused the schism with India over Kashmir to widen. He was more militant than General Musharraf, ironic isn't it. Pakistan has real problems that are not going to be fixed within a couple of years. The biggest complain I hear is that he is ineffective. Well, that is alot better than going in reverse. He has been trying to fix diplomatic relations with other countries. He has been trying to get assistance from the IMF, but they are being bastards. Everytime the IMF turns him down for assistance, they cause the countries markets to tumble. It is very had to have progress with a dead economy. The IMF is trying to treat Pakistan as a developed nation in their demands. At least Musharraf is actually trying to feed his people; he is trying to help the economy; he is trying to improve their relations outside and inside their borders. The military, the same that brounght him into power, is incredibly crooked and fractionalized and anti-Western. Sometimes Musharraf needs to walk a careful policy line between aiding other countries, such as allowing the US to use their territory for any campaign they may attempt, and appeasing the military. Musharraf is really putting himself in a position that can easily lead to his ousting. Even if that does happen, at least he removed Sharif. Musharraf himself even says that once Pakistan is more stable, he will have a democratic election for his replacement. People and the IMF need to give him a break.

  21. Balanced Ternary in Knuth on Chuck Moore Holds Forth · · Score: 1

    Yes, it is called a Balanced Ternary and it is in the seminumerical volume of Knuth. It is very interesting because it provided some interesting ways of parallelizing arithematic at the bit level (i.e., you can borrow the your neighbors value when subtracting -- I think this is how it goes). Anyways, it is by far the elegant representation that I have seen.

    -j

  22. Maintaining APL is not hard, just learned on Chuck Moore Holds Forth · · Score: 1

    I am not speaking directly about APL, but more about its successors: J and mostly K. I used to think it was hard to stare at a page of K, but after programming in it for a few months, I find it very hard to look at Java code. Code compaction allows the programmer to get the big picture in one page of code. I do not need to constantly flip between multiple pages of code to determine what it happening. I have found myself not using bookmarks or tags in code. Just as you became trained to stare at C-like statements, you also become trained to look at APL/J/K sentences.

    There are some very powerful ideas in the APL family. The ability to read code like prose, where each symbol on the screen has an english equivalent (e.g., the "," operator is pronounced join). I was very sceptical when my roommate showed me one of these languages, K, but soon we were deubugging incredibly complex functions but just speaking the phrases aloud. For example, in K:

    x is the default first argument to a function
    x is is used here as a vector
    x is pronounced x

    + is pronounced plus
    / is pronounced over
    # is pronounced count
    % is pronounced divide

    "(+/x)%#x" is pronounced "plus over x, divide count x"

    Even more powerful is how idioms are built from this. This is what is referred to as building your vocabulary:

    "+/" is also pronounced sum
    "(+/x)%#x" is then pronounced "sum x divide count x"

    the whole construct is is really average.

    : is pronounced is or gets
    * is pronounced times

    "weighted_average:{(+/x*y)%+/x}"
    is pronounced "weighted_average is sum x times y divide sum x".

    Yes, you can abstract it away as a function in this very simple example, but the point is more of how powerful idioms can be and how you build your vocabulary, especially, when interacting with people across the room. Compare this to the C equivalent:

    [not shown; censored by lameness filter; wtf?]

    I am very new to this whole APL/J/K thing, so things are probably a bit off.

    In the C-like languages idiomatic exblockquotessions are not nearly as clear. I only have a 19" monitor, so I use K to make my monitor a JumboTron.

    -j
  23. Hawking's other career on Stephen Hawking On Genetic Engineering vs. AI · · Score: 1

    But has anybody heard of Steven Hawking's other career:

    http://www.mchawking.com

  24. Views on other minimalist projects: pinky and j/k on Ask Chuck Moore About 25X, Forth And So On · · Score: 1
    The Q:
    Have you seen other projects that aim towards minimalization and what do you think of the direction they have choosen to follow? What projects (commercial, univerisity, or open) do you see as heading in a very good direction?

    The Elaboration:
    Specifically, on the hardware side, the Pinky 1 bit processor with 4 instructions seems near your chip design philosophy: small and smaller. Have you had a chance to look at the ideas behind it?
    The pinky processor is a chip that's designed to be extremely parallelizable, that is, it is designed to work extremely well in groups. Developed by Dave Taylor, they are extremely simple chips made to be small and efficient, and fast.
    And on the software side, do you see any programming languages headed in The Right Direction? Such as the APL branches of J and K, where the community sees code concision playing a very important role in understanding and maintainability. [A slight warning: I am now a convert of the K and KDB religion, so I am definitely biased. If Arthur Whitney can out code Oracle, it must say something about K; my fragile little mind is still disturbed by some of his golf scores.]

    The Thanks:
    Also, thanks for Fourth. I arrived there via excursions into PostScript and Joy and try to use it often.

    -j
  25. FreeBSD bootloader in Fourth on Ask Chuck Moore About 25X, Forth And So On · · Score: 1

    If I am not mistaken, the FreeBSD bootloader is a Fourth interpreter. If you look at /boot you will see a few Forth scripts that comprise the default bootloader and "libraries". You seem to be able to write your own boot logic.

    Somebody please correct me if I am wrong.

    -j