Xah's Programing Blog

On programing, languages, functional programing, Unicode, keyboard, hacker culture, ….

Want to master JavaScript in a week? Buy Xah JavaScript Tutorial.

Clojure Tutorial: Parallel Assignment, Destructure Binding (updated)

Linux: View Directory as Tree (repost)

happened to find this:

the following Mathematica program uses linked lists to solve the n-queens problem: …

Here is the equivalent F#: …

source: http://mathematicanews.blogspot.com/2012/05/tree-data-structure-in-mathematica.html by Jon Harrop

and noticed it is written by Jon Harrop. I'm sorry to say, he's truly a loud-mouthing idiot. (if you don't know, Jon Harrop is infamous as a “troll” for posting idiot posts to various comp.lang newsgroups and peddling his F# books or whatever he's doing)

discovered a new keyboard mechanical key switch, the Cherry ML switch. The interesting thing is that it's not a full depth key, but somewhat like laptop key, but taller. Yet, mechinacl switch. See: Cherry G84 4100 Keyboard

Get yourself one for the holidays. Logitech Gaming Keyboards Review (minor update)

Google Chrome now pops up “page unresponsive” false positive every few seconds, even everything works fine. This makes it unusable.

Google product is going downhill everyday. From bugs to commericialization.

temp fix: start Google Chrome by: google-chrome --disable-hang-monitor

Google Chrome support forum disscussion: https://productforums.google.com/forum/#!topicsearchin/chrome/page$20unresponsive%7Csort:relevance/chrome/CjX7L7MLzX4

Razer Targus Gaming Keypad Review. But you should get Best Keypad: Razer Orbweaver, Mechanical Keys or Logitech G13 Gaming Keypad Review

looks like this is a new firewall software. firewalld. https://fedoraproject.org/wiki/FirewallD

not sure if it's a wrapper to iptables. Seems at least partly so.

see also Linux Firewall Tutorial: iptables & netfilter


Linux Command to Download YouTube Video (repost)

Erik Meijer on Xtreme Programing and Agile

Clojure Tutorial: Partial Function Generator (Currying)

Clojure binding forms: syntax sugar on drugs. Clojure Tutorial: Parallel Assignment, Destructure Binding

Ruby is lisp-2 too. Added example. Thanks to Dario Bertini. See: What's lisp-1, what's lisp-2? Why You should Not Use the Jargons lisp-1 lisp-2

Wolfram Language (aka Mathematica) is bundled with every RaspBerry. It is also to be bundled with Unity game engine.

raspberry pi ultimate starter kit 2014-12-01
CanaKit Raspberry Ultimate Starter Components

for a glimpse of Wolfram Language, see: Wolfram Language, Mathematica (lots images)

linux systemd is wreaking serious havok in Linux community. Now Debian is forking. How i wish i can understand it, or, have any clue about system programing, or, how kernal, cpu, memory, assembly, etc low-level stuff works.

but life is short. I don't envision i'll ever go down this path. What remaining time i have in life i'll keep at high-level math stuff. Recursion theory, parser, math, proof systems, etc.

you can read about its controversy at Wikipedia Systemd

Programming in movies vs. programming in real life

xah's rumination extempore: on Turing Machine being a misfit in terminology and ontology of theory of computation

(note: “xah's rumination extempore” is when i type as fast as i can of my brain flow for fun & profit)

when intro to “turing machine” in comp theory, the term is illogical, out of blue. ⁖ why not elephant, or ghosts? we want the ontology of things. what this “machine” thing relates to comp theory.

even “Turing model of algorithm” is bad, because the word “model”, like wtf is that?

ok, it's like this. Suppose we are discussing which restaurant to go to. I say McDonalds, some said Kenturkey Chicken, some say Donking Donuts, some said TGI Fridays, some said the local restauraunt, but then, somebody said pizza!

now, you see that's out of the blue. That doesn't fit. The fitting set are restaunraunt names, but out comes a food name. That's outside the system.

So, when discussing theory computation, introducing Turing Machine, is like that, in about 99.99999% of books. (assuming here we are following a logical style of a treaties on theory of computation).

note that, intuitively we understand it. As soon as people learned what Turing machine is, we can see how it fits into computer science. But, the point of this article, is that it is not a systematic logical approach of things.

what we want, is a ontology of things. So, when talking about theory of computation, we'd like to establish first that what it is. (that is, in more severe degree, we want a so-called mathematical formal definition. Or, in a extreme case, we want symbolic logic.)

once we know what it is, then, we may in due course introduce different topic, such as Turing Machine, and we can see, exactly, how it fits in. That is, ontology.

so, what's the relation of “turing machine” to theory of computation? we need to think about that. Remember, that we all intuitive know what the relation is. The problem, is to come up with explicit relation, which also means a lot explicit definition, thinking a lot about it.

in a few minutes, am thinking “turinig machine” is best termed “turing model of algorithm”. But that doesn't exactly work, because then what does “model” means? I also thought, “turing machine” is best characterized simply as “algorithm”, but that's not right, because that's not a specific algorithm or the general sense of algorithm; it is NOT a algorithm.

comment at https://plus.google.com/+XahLee/posts/T2J7ho9vFUY

PS: ah,a epiphany❕ theory of computation includes a hardware,of which algorithm works on,we call “machine”。That's how Turing Machine fits。yay❕

indicator function

comp sci terminology: a indicator function is a function ƒ[x] that returns either true or false, with true meaning the input is a member of a particular set.

the function ƒ is either used as a definition that defines a set, or as problem of finding a way to construct the set. (the set may be well-defined yet we don't know its members. (⁖ solution of a equation of 1 variable))

to understand clojure in depth, the best is Rich Hickey's “Reference Documentation” essays http://clojure.org/documentation

Any programing tutorial that mention patterns, agile, idioms, koan, ninja, zen, tao, monk, cartoons, mentions of Martin Fowler, needs to be garbage collected.

Rich Hickey Q&A By Michael Fogus. @ http://codequarterly.com/2011/rich-hickey/

JSON ≈ edn = lisp syntax intended for wider use as data format. edn is to Clojure as JSON is to JavaScript

edn home at https://github.com/edn-format/edn

clojure syntax: http://clojure.org/reader

happy hacking keyboard pro japan 3143
Happy Hacking Keyboard Pro JP, with customized keycaps. (photo by Rick Cogley @ https://plus.google.com/+RickCogley/posts/ZeLsRgiypjG. used with permission)

see The Idiocy of Happy Hacking Keyboard

idiotic linux aspell, doesn't understand the word “interoperation”. aspell sucks: Dismal Vocabulary Size

clojure problem: string not in core

string manipulation is the most important element in modern programing. This is the first thing you teach to beginners, about any language.

But with Clojure, it's not core part of the language. You need to load it as a lib, or, goto Java's string stuff.

Try to tell it to beginners. You either face the clojure namespace complexity, or dealing with one bag of the Java interoperation complexity.

PS: actually, just prefix the namespace. ⁖ (clojure.string/upper-case "xyz").

produce & production. nutty & nuts. 8 thousand fathoms into the realm of clojure. Clojure Tutorial: Calling Java

JDK1.0 Java8, Java 1.8, just wtf which? f��k Sun Microsystems. Jargons of Software Industry

One Weird Annoyance About Clojure: Java

one annoying thing about Clojure is that it runs on Java Virtual Machine. Clojure is actually a so-called hosted language, and this is by spec. (and JavaScript is a hosted language too. 〔➤ JavaScript Tutorial: Understand JavaScript in Depth〕).

This practically means is that, Clojure isn't a “fixed” language. For example, when it's running on JVM, its regex is Java syntax, its string functions are Java language's string methods. When it runs in JavaScript world (as ClojureScript do), its regex is JavaScript's regex. 〔➤ JavaScript Regex Syntax

But, that's not all. The MOST annoying thing is that, you actually need to know a lot about stinking Java in order to do any real world work with Clojure. (don't let any hacker type fanatics tell you otherwise) You need to know Java class/object system, its package system, its namespace scheme, Java Virtual Machine system, its compilation cycle, its tools and achive files. Even the official Clojure documentation, outright simply say things like “returns a Java xyz object.” with no further explanation, in lots of places.

it is not to be taken lightly, that when you learn Clojure, you actally need to gradually understand a lot about Java ecosystem too.

but at least, thank god, it's a lisp that has industrial value, and is a Java replacement.

Java Tutorial: Java Constructors (minor update)

ctags ctags gtags: How to Find Where a Function is Defined or Called? (draft)

clojure libs used in industry

here's sample of clojure libraries. They are dependencies of the gorilla-repl. 〔➤ Interactive Clojure Notebook: gorilla-repl

http://http-kit.org/ Ring-compatible HTTP client/server for Clojure

https://github.com/ring-clojure/ring-json Standard Ring middleware functions for JSON requests/responses

https://github.com/dakrone/cheshire JSON parser

https://github.com/weavejester/compojure Compojure is a small routing lib for Ring


http://www.slf4j.org/ abstraction for various logging frameworks

http://logback.qos.ch/ logging framework

https://github.com/clojure/data.codec base64 encode/decode

https://github.com/grimradical/clj-semver version string parser, ⁖ 3.2.2

https://github.com/clojure-emacs/cider-nrepl clojure network repl

https://github.com/clojure/tools.nrepl clojure network repl

https://github.com/ninjudd/clojure-complete Clojure-complete is an symbol completion library for Clojure

tweet a million

start to use markdown for real. It sucks donkey ass. it became popular because it's simplistic. I suppose it's better than plain text.

asciidoc is better than markdown. not gonna look into it.

A tool is kinda a propaganda machine. It shapes how people think. If u create a idiotic one, but with pop factor (⁖ TV ads) unix C vi perl …

hackers beware❕❕❕ my tweets are for entertainment purposes only.

hackers hark❕ follow https://twitter.com/wolframtap to see what one-liner means. #perl #haskell #lisp #clojure

speaking of #perl is like talking bout history today. Nobody cares & u r strange. Perl One-Liner Screw Perl One-Liner Screw

Clojure “protocol” and the “expression problem”

Clojure's “protocol” (expression problem) is roughly a layer of mix of java abstract class & class interface.


The “expression problem” isn't really a problem in computer science. It is a problem as in: “Houston, we have a problem.”

I'll have more detailed article later. For now, the best place to see is:

the “Expression Problem” is best explained here: http://c2.com/cgi/wiki?ExpressionProblem but, better is to understand it as the general case of “Cross Cutting Concerns”, explained here: http://c2.com/cgi/wiki?CrossCuttingConcern

comment at https://plus.google.com/+XahLee/posts/1Nh68RParSL

clojure parser instaparse, and excellency of clojure docs

A clojure parser lib, instaparse: https://github.com/Engelberg/instaparse, seems to be the topnotch parser. Instaparse is written by Mark Engelberg.

It has excellent tutorial too. Clear, to the point.

so far i've seen, clojure community's doc is top-notch. The official documentation is excellent. The lib/build manager Leiningen's documentation is excellent. 〔➤ Clojure Leiningen Tutorial〕And now the instaparse documentation is excellent.

it appears, a language's community pretty much follows the style of its leader. In this case, it's Rich Hickey. You can see Hickey's writings, his documentation style, in several essays titled “Reference Documentation” at http://clojure.org/documentation. They are, concise, to the point.

meanwhile, python's documentation are pretentious garbage, following Guido's style. Here's a typical one: Python, Lambda, Guido: is Language Design Just Solving Puzzles?.

and perl's drivels are derived from Larry Wall's drivel. Here's a sample: Perl Documentation: the Key to Perl

for much more, see programing doc idiocies collection

regex haven't been unified, but rather diversified, in past decade. perl, python, ruby, java, JavaScript, emacs lisp, all have slightly different regex syntax.

regex should be ban'd anyway. PEG rules.

new index page: regex, parsing

What Can We Do about the Unnecessary Diversity of Notations for Syntax Definitions? —Niklaus Wirth on BNF, 1977


What's the Difference Between BNF, EBNF, ABNF?

Clojure doc need cross-links, and example for some functions. 3rd party docs notwithstanding. ⁖ reading about some->, what the hell is “thread”? no link to ->, and no example. Xah Clojure Tutorial.

looks like Clojure solved another lisp problem:piping functions (-> expr1 expr2 …) but Clojure calls it “threading”. Programing Language: LISP Syntax Problem of Piping Functions

logitech g502 mouse 2
Logitech G502 Proteus Gaming Mouse

Logitech G502 Proteus Gaming Mouse (on its own page)

new Logitech mouse, widely praised. Currently the best wired gaming mouse from Logitech. Logitech G502 Proteus

now i haven't played games for years. Am a coder. But i will only use gaming mouse. I've written too much on the subject, not going to repeat here. If you haven't seen yet, see Computer Mouse, Trackball, Input Devices

new. Razer Naga Epic Rechargable Wireless MMO PC Gaming Mouse. Bad reviews on amazon.

Logitech G500 Gaming Mouse (Discontinued)

Logitech G9X Gaming Mouse (Discontinued)

new index page. Python Problems. There's quite a few more articles that needs to be linked there, but this is a start.

when you name something “x” as experimental in your language or protocol, it'll stuck forever. java javax, mime type x-, …

Linux: Traverse Directory: find, xargs (updated again)

gorilla-repl plot
clojure user rejoice. Interactive Clojure Notebook: gorilla-repl

if you are Clojure beginner, you need to know something about Java too in real world projects. Java Shell Commands: javac java jar javadoc (first version)

Current Assessment: Wolfram Language ≻ Clojure ≻ Ruby ≻ Emacs Lisp ≻ Common Lisp ≻ Python ≻ Perl ≻ Java ≻ C ≻ C++

Which Languages to Learn? Perl, Python, Ruby, JavaScript, PHP, Emacs Lisp

steam punk sojourner keyboard
Steam Punk Sojourner Keyboard

jargon “closure” should be named “enclosure”

while discussion jargons, Tom Novelli suggested a excellent one. “closure” should be named “enclosure”, or the full “lexical enclosure”. see his blog at 〔TECH JARGON REFORM By Tom Novelli. @ http://tnovelli.net/ref/jargon-reform.html

more revamp of the page Lore of the Hacker Cult

new section:

to get serious with clojure, you also need to understand how leiningen compile things. Here's a excellent article.

How Clojure Babies Are Made: Understanding lein run By Daniel Higginbotham. @ http://www.flyingmachinestudios.com/programming/how-clojure-babies-are-made-lein-run/

to do clojure for real world, you must understand something about Java. I'm reviewing java myself. Java Tutorial: Package System in Java (minor update)

Linux: View Directory as Tree

excellent article for those of you who don't know how Operating System works (me): 〔When Does Your OS Run? By Gustavo Duarte. @ http://duartes.org/gustavo/blog/post/when-does-your-os-run/

this guy seems to be a OS guy. You should checkout his archive of articles, lots on how OS works. http://duartes.org/gustavo/blog/archives/

What's Docker?

learned something new: persistent data structure, as in Clojure. (it's not “saved to disk”) See Wikipedia Persistent data structure

The Words Synchronous & Asynchronous Should be Ban'd (elaborated, on its own page)

There are 2 fundamental problems of lisp. One of them, the “cons business”, is now fixed by Clojure. Fundamental Problems of Lisp

Clojure Books, and Xah Style Tutorial

Python should be diced to a million pieces.

comment at https://plus.google.com/+XahLee/posts/WMEA5UBJbhE

Clojure is one big copy of Wolfram Language

Clojure is one big copy of Wolfram Language (aka Mathematica), even down to many function names (those sequence functions).

Of course, it is a inferior copy.

Google Plus discussion https://plus.google.com/+XahLee/posts/3ae5GMdj7At

Clojure Missing Docs

Technical Writing as Symbolic Logic: Clojure Intern Symbol