2011-01-22

HTML Validation, Google, Amazon

Perm url with updates: http://xahlee.org/js/html_validation_google_amazon.html

HTML Validation, Google, Amazon

Xah Lee, 2011-01-22

More HTML validation Pain.

Here's a amazon ad widget from Amazon Associate site:

<iframe
src="http://rcm.amazon.com/e/cm?t=xyzxyz-20&o=1&p=11&l=ur1&category=textbooks&banner=17P1AE8RQ1T7ZFC62V82&f=ifr"
width="120"
height="600"
scrolling="no"
border="0"
marginwidth="0"
style="border:none;"
frameborder="0">
</iframe>

Of course it is not valid html. The ampersand needs to be &amp;. Also, there's no border="0" attribute for “iframe” tag.

Well, google isn't doing much better. Here's the code given by youtube for embedding a video:

<iframe
title="YouTube video player"
class="youtube-player"
type="text/html"
width="640"
height="390"
src="http://www.youtube.com/embed/nnsSUqgkDwU"
frameborder="0"
allowFullScreen>
</iframe>

“iframe” tag doesn't have the “type” attribute type="text/html", and there's no such thing as “allowFullScreen”.

How bad can it be? So, from these 2 sites alone, handling out bad code, are directly responsible for millions of site being invalid html. Of course, all other video sites all hand out invalid html. None gives correct html as far as i know. (See: How to Embed Video with Valid HTML.)

In the Google case, am sure they are just trying to solve a practical problem, though, i'm not sure it is absolutely necessary to resort to using invalid attributes. Clearly, the “allowFullScreen” is there to be parsed by javascript. If so, then it could easily be a comment tag instead, e.g.: <iframe ...><!-- allowFullScreen --></iframe>. And am not too sure that type="text/html" there is really necessary.

2011-01-21

Emacs Online Resources and Communities 2011

Perm url with updates: http://xahlee.org/emacs/emacs_resources.html

Emacs Online Resources and Communities 2011

Xah Lee, 2011-01-21

This pages gives you a summary of most useful online resources for emacs.

Official Documentation and Emacs Books

If you want a systematic approach, best are the official docs and commercial books. See: Emacs Lisp References.

Note that emacs has many commands to search the bundled doc. See: Tips on Long Term Emacs ProductivityHow to Eval Emacs Lisp Code, Search a Function, and Lookup Documentation.

What Does This Mode Do? is There a Mode for xyz?

emacswiki.org is a emacs wiki. Most useful info there are about hundreds of modes in the wild.

If you want to know what does a mode do, or if a mode exist for lang xyz, this is the best resource. For example, it would list several modes for twitter, templates..., where to download, how to install, and usually has tips about the good/bad/tips of each.

The info on the site is often chaotic and not well organized, but still it is a great resource. Emacswiki.org is started by Alex Schroeder.

Other Emacs Blogs

There are quite a few emacs blogs. They are useful for casual, periodic reading. Getting tips, latest news, trends. The most consistent and reader oriented known to me are:

I also run a emacs blog, you can subscribe at: Xah's Emacs Blog.

Blog Collections, Emacs News

http://www.reddit.com/r/emacs/ is reddit's emacs link collection.

http://planet.emacsen.org/ is a blog aggregate of about 80 emacs blogs. Usually random news, tips, code, in varying quality, and sometimes doesn't have that much to do with emacs.

Emacs Micro Blogs

There are several twitter micro blogs on emacs. None are updated regularly, sometimes weeks with no post.

Forums

If you have a emacs or elisp question, the best place is online forum. Here's the top few good ones.

stackoverflow.com emacs is pretty good. Probably should be your first stop.

gnu.emacs.help newsgroup is FSF's official emacs help forum. The forum is read by many emacs developers.

FSF's GNU Emacs Dev Mailing List @ http://lists.gnu.org/archive/html/emacs-devel/. This is the most hardcore. If you know elisp well and really have a hard question, this is the best place to get answers.

Emacs Resource For Chinese Readers

For those who reads chinese, there's a very popular chinese emacs blog/wiki @ emacser.com. It's based in China, mostly used by Chinese people there. The site has lots of info, tips, discussions, including links to major Chinese elisp hacker's sites.

Emacser is started by ahei.

(Thanks to fangzhzh for a correction.)

2011-01-20

Why Humbleness Sells?

hmm... interesting. my facebook page is google ranked at 4. I guess it's good thing for me to be ranked high, though i have little idea why. I guess people google my name and clicks on my facebook page. I got a rep among online programing forums as a troll. I know people are interested in oddball personalities, as in gossip mags on celebrities. Though, i dont write much personal stuff (as in, my current mood, feelings, what i had for dinner, new relationships), partly because writing trivia isn't my style, partly because in past 7 years i don't really have good news on these to brag about. (that reminds me, i'll have to write my 2-years experience living in a Honda Civic around 2005.)

Am guessing that the perception of me as a troll has waned in the past 3 years. I think partly because my emacs tutorial is getting popular, and i haven't written much essays with downright idiot-this n shit-that expressions.

As a thinker, even a nameless one, or possibly crazy idiotic one, i think it's important to write as you are, even with extreme views and insulting words. Because, that is the force of idea, expression, that are not ubiquitous. Sure, politeness is great, in fact critical, and actually necessary if you want to sell yourself, make friends. (e.g. in marketing, advertising, diplomacy, a core ingredient is to make people like you, and cynically — ingratiation.) But if thinking is what you sell, as a philosopher or artist, you have to sell them as is, and best to express them as you are.

Yeah, right! So, Xah, you think you can make a point only if you insulted people. What you take of me, a idiot? Yes, and i just made a new friend. (O, Shakespear says, please remember to read between the lines!)

Now, let's engage in a lil' fun speculation on humbleness from evolutionary psychology's perspective. Why do people despise arrogance? why humbleness sells? Besides selling, what's the effect of humbleness in the quality of work?

I don't know!

PS this blog shouldn't be titled “why humbleness sells”. That's the inaccurate message. Humbleness doesn't sell by itself, of course. Nobody would care more just because a idiot is humble. Rather, “why humbleness is in general a good quality to present onself”. For exmple, some well known celebrities are not shy to express themselves, examples are Stephen Wolfram, Steve Jobs. Others, for example blogger Steve Yegge (of amazon and google), Jeff Atwood (of codinghorror and stackoverflow frame), write conspicuously in a humble way (usually injecting extraneous humble statements or jokes), and they get tens of thousand followers. Political leaders, some are also humble, some cocky.

See also: Self-deprecation. Quote:

Self-deprecating humor relies on the observation of something negative about the person delivering the commentary. Many comedians use self-deprecating humor to avoid seeming arrogant or pompous, and to help the audience identify with them. In this way, the use of self-deprecating humor could be seen as an application of the rhetorical concept of ethos. This is a major component of the comedy of comedians such as Don Knotts, Jon Stewart, David Letterman, Craig Ferguson, Jerry Seinfeld, Rodney Dangerfield, Conan O'Brien, and Daniel Tosh.

Thanks to Lori Williams for some thoughts.

Remove Windows Media Player Context Menu

Perm url with updates: http://xahlee.org/mswin/remove_Windows_Media_Player_menu.html

Remove Windows Media Player Context Menu

Xah Lee, 2011-01-20

In Windows (Vista), when viewing a folder, when right clicking on a item, there's the menu “Play with Windows Media Player”. How to set it so such submenu does not show?

Remove the “WMP*” items in the following the registry folders.

[HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Image\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Video\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\SystemFileAssociations\audio\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\SystemFileAssociations\video\shellex\ContextMenuHandlers]

If you are not familiar with Registery, see: Microsoft Windows Registry Tutorial.

Thanks to “Synetech inc” for the answer at Source superuser.com.

Mathematica Version 3 to Version 7 Conversion Notes

Perm url with updates: http://xahlee.org/comp/Mathematica_learning_notes.html

Mathematica Version 3 to Version 7 Conversion Notes

Xah Lee, 2010-11-22, 2011-01

This page is misc personal notes of learning new features of Mathematica since version 3 in 1996.

In 1998, i was fairly a expert of Mathematica. I read the Mathematica Book from cover to cover systematically 3 times over different years. (See: Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover?.) I've also read basically all popular Mathematica books in print of the 1990s. (See: A Survey of Mathematica Books 1997) A package i wrote Plane Tiling Mathematica Package, i consider more powerful, more flexible, more well documented, than a commercial one in a book written by one of the top Mathematica expert. I know almost all the programing constructs well, and know pretty much all the packages that exists, and have used lot of them. This is about 6 years of intensive Mathematica coding.

Though, that's over 10 years ago. I havn't done any math seriously since 1998, and i haven't coded Mathematica neither. The Mathematica i'm familiar with is Mathematica 3. It was the first major version, and the major feature was programable notebooks and automatic 2D typesetting and rendering. Mathematica has grown tremendously since. In particular, to areas outside math. Though, i still kept a eye on Stephen Wolfram and Wolfram Research's news and features. (See: Notes on A New Kind of Science.)

The following are some random, personal, technical, notes about Mathematica, when i convert/rewrite many of my packages from v3 to v7. These notes are on-going as i work more with Mathematica. (Thanks to Wolfram for giving me Mathematica version 7 as a gift.)

If you are interested in a comprehensive and detailed list of Mathematica thru the versions, there are official release notes in its documentation. See: http://www.wolfram.com/mathematica/quick-revision-history.html.

Some slightly more coherent Mathematica tutorials i've written are the following. Mostly for programers.

Obsolete Functions

• GraphicsArray is replaced by GraphicsRow and GraphicsGrid

<< Graphics`ImplicitPlot`; is obsolete. Use ContourPlot instead. Example:

<< Graphics`ImplicitPlot`;
ImplicitPlot[{(x^2 + y^2)^2 == x^2 - y^2, (x^2 + y^2)^2 == 2 x y},
 {x, -2, 2},
 PlotStyle -> {GrayLevel[0], Dashing[{.03}]}]
ContourPlot[{(x^2 + y^2)^2 == x^2 - y^2, (x^2 + y^2)^2 == 2 x y},
 {x, -1, 1}, {y, -1, 1}, 
 ContourStyle -> {GrayLevel[0], Dashing[{.03}]}]

Needs["Utilities`FilterOptions`"]; is obsolete. Replaced by FilterRules.

If you have:

opts = {a->b, c->d, Axes -> False};
BeginPackage["ParaPlot`","Utilities`FilterOptions`"]
FilterOptions[Graphics,opts]

Now you should do this:

opts = {a->b, c->d, Axes -> False};
FilterRules[opt,Options@Graphics]

• «As of Version 6.0, Random has been superseded by the functions RandomReal and RandomInteger and others.»

• «As of Version 6.0, StyleForm has been superseded by Style.»

Behavior Changes

• Evaluation behavior seems to have changed. Before, you need to put a “Evaluate” in.

ParametricPlot[Evaluate[Ellipse[.8][t]], {t, 0, 2 \[Pi]},  AspectRatio -> Automatic]

Now you don't.

• By default the input cell now uses StandardForm instead of InputForm. (if i recall correctly)

• definition of function's inline doc seems now needs to first check if it is defined, e.g.

If[ Not@ValueQ[Agglomerate::usage], Agglomerate::usage = "Agglomerate[list] ...."]

• Order of symbols in $Context seems to have changed. That is, when loading a package, the exported symbols now override your global ones (goes first in $Context). Before, when you call a function in a package such as ParaPlot, but you forgot to load the package. M gives a error. Then, you load the package, but that won't work, because “ParaPlot” is in the Global` context and that has precedence than the one in Graph`ParaPlot. This used to be a big problem. Now, this seems fixed. Haven't thought about logical consequences yet.

Graphics Display Behavior

• The semicolon now surpresses the side-effect of displaying graphics. Any Graphics[...] object (e.g. Graphics[Line[{{0, 0}, {1, 1}}]]) is auto displayed as if with a Show[Graphics[...]] but the textual output is still surpressed.

The plot function's option the DisplayFunction's default value $DisplayFunction seems changed to Identity. Before, if set to Identity it will not display the graphics. Now, the display of graphics seems dependent on whether there's a semi-colon at the end of the whole expression.

It appears, the new logic is that any output of the form Graphics[...] will be displayed visually. To surpress it, simply put a semi-colon.

• Graphics output inside of Do, For, and While loops is suppressed unless Print is used.

Plotting Functions

• When plotting multiple curves with ParametricPlot, the curves automatically gets colored differently. e.g.

ParametricPlot[{{x, x^2}, {x, x^3}, {x, x^4}}, {x, -1.2, 1.2}]

You don't have to use set PlotStyle yourself now, e.g. PlotStyle -> {Hue[0], Hue[.65], Hue[.34, 1, .7]}

• “ParametricPlot” now uses Automatic as the default value for AspectRatio.

New Functions

• Translate, Scale, Rotate, RotationMatrix, RotationTransform, TransformationFunction and a bunch others affine or otherwise transformation functions, that either work on graphics directly, or return the matrix formula, or a function that represent such operation. (v6) Nice!

• Norm returns the length of vector. (v5). Nice!

• Normalize returns the unit vector. (v6). Nice!

These are very nice. Without them, you have to define them like these:

normalize=Function[#/Sqrt@(Plus@@(#^2))]

(See also: A Example of Mathematica's Expressiveness)

Of course, it's slower than builtin. These are critical functions that are called tens of thousand times if you do graphics programing.

• Other new functions.

  • ConstantArray (v5)
  • SparseArray (v5)
  • Tuples (v5.1)
  • Riffle (v6)
  • Subsets (v5.1)
  • RandomChoice (v6)
  • Dynamic (v6)
  • Slider (v6)
  • DynamicModule (v6)
  • Animate (v6)
  • Animator (v6)
  • Manipulate (v6)
  • Row (v6)
  • Cone (7)

Unanswered Questions

Is there a hotkey to switch windows?

Yes. 【Ctrl+F6】 also with Shift. This is not document in v7.

• The real-time rotation of graphics feature does not seems to use GPU. Major disappointment. This means, when you have a graphics with tens of thousands of polygons (as opposed to toy example or classroom examples), the real time rotation is not usable. It has a frame-per-second like 0.1 (i.e. takes 10 secs to see a movement).

According to: http://www.wolfram.com/products/mathematica/newin6/content/RealTime3DGraphics/, it says «Seamless optimization with graphics hardware on all computer platforms.»?

  
i noticed that in many addon packages, 

they define the inline doc by first checking whether it is already defined, 
e.g. at ... Mathematica/7.0/AddOns/Packages/FourierSeries/FourierSeries.m

like this:

If[Not@ValueQ[SomeF::usage],SomeF::usage = "..."

why does it need to check if it is already defined?

Google Search Ranking Ingredients (SEO secrets)

Perm url with updates: http://xahlee.org/js/google_seo_ingredients.html

Google Search Ranking Ingredients (SEO secrets)

Xah Lee, 2011-01-19

Here's some tips about what Google uses to rank a site. Tips gathered from different sources and edited with my own experiences.

What and Why of SEO

Note: Search Engine Optimization (short SEO) is about editing your site so it shows up as top result in search engines. This activity is mostly gaming, and often with underhand tactics. Note that, if you want your site to be popular, the one most important factor is to create useful content that visitor likes. However, for certain content, there are thousands of competitors. For example, if your site sell or write about cell phone, then there are thousands of sites all in the market, and most of them all have useful content.

So, SEO is not something just for the shady businesses. It is critical. Looking at it from another perspective, understanding SEO can be thought of as part of understanding marketing — a necessity of business.

Unfortunate Effects of SEO

The unfortunate thing about existence of SEO is that, if your site is not a commercial organization — maybe you are a professor writing about math education on your blog, or maybe you are a professional novelist writing a personal blog about creative writing, then, even if you writing is top quality content within your subject, you site may be hard to find in search engines, because of the SEO activity by thousands commerical orgs.

The text in the html <title> and <h1> tags is perhaps the most important item in how Google determine a site's content, and suppose you have a creative blog about about English lexicon, and titled your blog with a artistic name such as “the Making of Belles-Lettres”. When people search about English vocabulary, your writing may be what they need exactly, but because your title does not contain the word “vocabulary” nor “English”, and fail among other 100 esoteric SEO factors, so search engine won't show your site on top, if at all.

Many people with expertise in particular area write blogs (e.g. academicians, artists). They write as a hobby, personal notes, to share their ideas with friends or other people. They have no intention to make money out of the blog. They wouldn't know the concept of SEO. If they do, they wouldn't be spending hundreds or thousand dollars to hire SEO companies to optimize their page, nor do they have the time and expertise to know all the tech details. The general public suffer from this, because millions of sites engage in pro SEO activity for the sake of money, and a majority of them have little or no quality content. So, when people search for “English vocabulary”, “math education”, “geometry”, they arrive at shady sites that sell low-quality English Tutorial or other products, and your expertly written blog “the Making of Belles-Lettres” went unnoticed.

Most Important Factors

Here's a list of most important factors. Main source: Source www.seomoz.org.

Top 5 Ranking Factors

  • Keyword Focused Anchor Text from External Links 73%
  • External Link Popularity (quantity/quality of external links) 71%
  • Diversity of Link Sources (links from many unique root domains) 67%
  • Keyword Use Anywhere in the Title Tag 66%
  • Trustworthiness of the Domain Based on Link Distance from Trusted Domains (e.g. TrustRank, Domain mozTrust, etc.) 66%

Ranking Algorithm

  • 24% Trust/Authority of the Host Domain
  • 22% Link Popularity of the Specific Page
  • 20% Anchor Text of External Links
  • 15% On-Page Keyword Usage
  • 7% Traffic and Click-Through Data
  • 6% Social Graph Metrics
  • 5% Registration and Hosting Data

Google Search Ranking Ingredient

Google itself said there are about 200 factors. Here's a list of factors, based on Source www.seomoz.orgSource www.vaughns-1-pagers.comSource www.webmasterworld.com.

Content

  • Keyword in <title> tag
  • Keyword in Meta Description (Not Meta Keywords)
  • Keyword density of page
  • Keyword in header tags (<H1>, <H2> etc)
  • Keyword in body text
  • Freshness of Content

Per Inbound Link

  • Quality of website linking in
  • Quality of web page linking in
  • Age of website
  • Age of web page
  • Relevancy of page’s content
  • Location of link (Footer, Navigation, Body text)
  • Anchor text if link
  • Title attribute of link
  • Alt tag of images linking
  • Country specific TLD domain
  • Authority TLD (“.edu”, “.gov”)
  • Location of server
  • Authority Link (CNN, BBC, etc)

Architecture

  • HTML structure
  • Use of Headers tags
  • URL path
  • Use of external CSS / JS files

Domain

  • Age of Domain
  • History of domain
  • keyword in domain name
  • Sub domain or root domain?
  • TLD of Domain
  • IP address of domain
  • Location of IP address / Server

Cluster of Links

  • Uniqueness of Class C address.

Internal Cross Linking

  • No of internal links to page
  • Location of link on page
  • Anchor text of FIRST text link (Bruce Clay’s point at PubCon)

Penalties

  • Over Optimisation
  • Purchasing Links
  • Selling Links
  • Comment Spamming
  • Cloaking
  • Hidden Text
  • Duplicate Content
  • Keyword stuffing
  • Manual penalties
  • Sandbox effect (Probably the same as age of domain)

Miscellaneous

  • JavaScript Links
  • No Follow Links
  • Performance / Load of a website
  • Speed of JS

2011-01-18

3D Visualization Design

Perm url with updates: http://xahlee.org/comp/design_3D_visualization.html

3D Visualization Design

Xah Lee, 2011-01-18

Looked into Wolfram Demo Project for real today. http://demonstrations.wolfram.com/. Am rather disappointed. I checked about over 30 demos. Most are bad. They don't illustrate a point or showing some insight.

Then i checked a few authored by those i know are Mathematica experts. e.g. Sándor Kabai and Michael Trott. They are better, but still not impressive.

The power of animation, or interactive animation, is that the animation must bring out something that cannot be seen or felt by a series of static images. Here's some example of bad animation designs.

• Just a bunch of static images. If all you do is just put static images in a slideshow with a slider, that's useless. I rather look at the array of static image instead, because that lets reader see all variations at the same time, in high quality, with clear annotation on each, instead of one at a time in low resolution that glides by.

• Bad Use Of Animation. I saw one demo that shows a ellipse, with a point on the curve connected to the curve's focuses by 2 lines. When animated, the point movies on the ellipse, and a text display shows the sum of distances. The key design of this is to let reader realize that the displayed text didn't change while the point is moving, i.e. the sum of distances is a constant. What does such use of animation bring us visually more than a static image? Nothing.

• Insignificant use of sliders. Then, lots other animations have several sliders that lets you control opacity of the surface, rotate in particular axes, etc. These are really not meaningful. When being presented by a interactive panel, you get confused with all these sliders. You take the trouble to adjust each slider to see what they do, but you are not rewarded by some visual insight or dazzling graphics, but realized that these sliders just changes something trivial, such as coloring of the surface. The visualization activity essentially becomes a coloring book activity.

Am guessing at this point, that the majority of the demos there are not much valuable. Am guessing vast majority are uploaded by college students.

It should be noted that good scientific animation or visualization takes some effort to design. Just because you can easily create slider to change parameters doesn't mean your animation will be great. Nor should you make a lot sliders just to increase the “power” of variation. Which parameter to animate, their step-size (or carefully chosen discrete values, or increasing by a smooth function), good explanation, display of critical label, are important.

Your design must have a clear purpose. It can be a visual demonstration of a theorem ◇ visualization of data ◇ visualization of complex 3D objects such as math surfaces or molecule ◇ exploration of a algorithm by its parameters, etc. One thing you should try to avoid is using sliders or whatever the new fancy tech just because you can easily do so. For example, when Desktop Publishing is new in the early 1990s, people discovered that they can easily change font, color, size etc., so newbies adorned their email that's garish and hard to read. Similar thing happened with CSS in early 2000s. Ultimately, novelty use of tech wears off quickly.

Though, the Mathematica engine for interactive manipulation is certainly a great feature. But seems it has its flaws. For example, one great use of interactive features of Mathematica is for visualization of family of surfaces. You can interactively push a slider to change a parameter, and see the surface change in real time. Unfortunately, it seems that Mathematica 7 does not use GPU, so it is slow when you have a real surface such as complicated minimal surface that are tens of thousands of polygons. And when used in animation with Manipulate, the animation is slow. You move the slider, then continuously wait for the graphics to update. When the animation does not update in sync with your slider movement, it can be quite frustrating. One such example is this http://demonstrations.wolfram.com/BoySurfaceAndVariations/. In general, Mathematica's whole interactive feature does not seem smooth for anything other than simple plane curves. The graphic's frame size also changes by jumping around when you try to rotate the 3D object.

Ok, that's some negative aspects. Here's some good ones i enjoyed.

(haven't really looked at lots of them.)

For some quality visualizations, see: Requirements For A Visualization Software System For 2020.

✻ ✻ ✻

When you click on a control of a demo, it pops up a panel with choices to: ① watch web preview ② download live version with active controls.

I looked a bit into what tech they use for the web preview. The Wolfram Demo site relies on Javascript and Adobe Flash to work. The web preview feature is done with Flash. My guess is that each notebook gets translated into a sequence of screenshots, packed into a movie format, then Flash is used as a wrapper to display them.

Why You Need To Quit Facebook?

Ran into this mockery: “Why I Need To Quit Facebook” @ Source runt-of-the-web.com.

Though, note, that fb and other social media is merely a extension of RL chat or whatever u do around friends or water coolers.

So, when you are with friends in meat space, may it be in party, on phone, or at work place, do you engage in serious intellectual stuff like history, philosophy? Of course not.

In a sense, the article about “why i need quit facebook” mockery is itself just another insignificant thing on the web that “wastes” your time.

Its significance, is alerting us that many of us spend too much time on social media. Though, that itself isn't a problem caused by social media, rather, it is caused by modern society. The internet merely provided you a way to waste time by many means. Without, those who spend too much time on Facebook probably would over-sleep or playing solitaire endlessly (which indeed people do a lot in 1990s). You won't be reading War And Peace or dig into history, philosophy, anytime soon.

Likewise, average human activity been like that for past thousands of years too. Books such as War And Peace existed for over a hundred years, likewise other great literature or philosophy been around for thousands of years. Do average people get excited by them?

2011-01-16

fold, reduce, in emacs lisp

Hauke Rehfeld send in this improved version of “fold”.

(defun fold (f x list)
  "Recursively applies (F i j) to LIST starting with X.
For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)."
 (let ((li list) (x2 x))
   (while li
     (setq x2 (funcall f x2 (pop li)))
   )
   x2
  )
)

This one improves upon on a primitive one i've written, which has problems if element in the list eval to nil. For some info and a practical example of using “fold”, See: More Elisp Examples. Thanks Hauke.