Recent posts (max 20) - Browse or Archive for more

Oops, I monad again

This boils down to an ugly hack which is what a monad is.

The principle is that a function by definition is a mapping, which maps a set of values into another set of values. The crucial difference between a function and a procedures is that a function must, by definition, produce the same input for the same output. Always.

So, when a supposed function produces sometimes values and sometimes errors, everything is broken. It is not a function anymore. The ugly hack is to wrap different values into a compound structure of a certain type and reformulate the law of functions to the law of procedures - the same type of output for same values. This is what Maybe monad and Either monad are. Mere ADTs, mere wrappers. As long as input and output values are of the same type (as long as they conform to the same protocol/interface they are considered to be equivalent, but, of course, not equal) procedures which take such type as input and output values could be composed and form a pipelines (like any other procedures with consistent types).

There is nothing more than that. And, strictly speaking, it is not a pure functional programming anymore. Just procedural with static typing (hello, Haskell purists!).

'Breakthrough' Prizes

While multidimensional geometry could be regarded as a separate discipline, dimensions themselves does not exist. It is mere an abstraction created by an observer.

A sphere makes a perfect sense in a in this Universe, while a 4D hyper-sphere (and so-called hyper-cube) is an utter nonsense. Of course, one could describe such an abstraction in as a mathematical object, but it will be mere an abstraction, like Hegelian ones. It does not exist outside people's heads.

All the billions years of this planet never revealed a single dimension. All the geometry we have in proteins is based on the notion of 3D spheres - a notion of the same distance in all possible dimensions (given that there is no such thing as dimension).

Same logic could be applied to refute any string theory sectarian nonsense, given that just one single contradiction is enough. Non-existence of time as a phenomena is enough to destroy all the space-time curvature mathematical or rather Hegelian crap.

But who cares.


Not every abstract notion is applicable. Much less applicable to itself.

The Russell's paradox should be resolved with 'inapplicable' type error. A category tag is inapplicable to itself.

Same goes for probabilistic inference - it is inapplicable for partially observable phenomena. It should be a type error.

Yet another ban.

  • Posted: 2016-11-28 09:12 (Updated: 2016-11-28 09:12)
  • Author: schiptsov
  • Categories: (none)
  • Comments (0)

For the love of god, why?

1 ]=> (expt -2 2)

;Value: 4

1 ]=> (* -2 -2)

;Value: 4
* (expt -2 2)

* (* -2 -2)

>>> -2**2
>>> -2 * -2

Elections 2016

The majority of "less educated" has been primitively manipulated, using naive memes and the modern propaganda technologies developed by the well-educated, to vote against well-educated, framed as "the corrupt establishment".

The less educated majority are so sure about being the majority (statistically they obviously are) that they are taking "the stealing elections from them" meme for granted.

No one even tries to evaluate memes anymore, like "returning back all these manufacturing jobs" - would you really like to compete with Chinese wage laborers by working long hours for less than $15 per day? But this is how the global economy works. No amount of legislation could make much more expensive to produce goods competitive.

The same thing happened with the Brexit - the uneducated majority has been manipulated by populists to vote for unrealistic meme-like prospects.

The problem is simple - too many uneducated, and memes, memes everywhere.

  • Posted: 2016-11-06 18:33 (Updated: 2016-11-06 18:37)
  • Author: schiptsov
  • Categories: (none)
  • Comments (0)

Cognitive decline..

It seems that I used to be in a much better shape 2 years ago - Folds

The fuck?!

schiptsov@Ideapad-300-15ISK:~$ ps -ax |grep systemd
  282 ?        Ss     0:00 /lib/systemd/systemd-journald
  329 ?        Ss     0:00 /lib/systemd/systemd-udevd
  814 ?        Ssl    0:00 /lib/systemd/systemd-timesyncd
  903 ?        Ss     0:00 /lib/systemd/systemd-logind
  910 ?        Ss     0:01 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
 1092 ?        Ss     0:00 /lib/systemd/systemd-resolved
 1159 ?        Ss     0:00 /lib/systemd/systemd --user
 1675 ?        Ss     0:00 /lib/systemd/systemd --user
 1800 ?        Ss     0:00 /lib/systemd/systemd-hostnamed
 1816 ?        Ss     0:00 /lib/systemd/systemd-localed
 1919 pts/0    S+     0:00 grep --color=auto systemd

systemd-localed, Karl!

Essay on Non-Self (Anattman)

The concept of the self is closely related to archaic notion of the soul, which is an important vehicle of socially constructed organized religions (ancient social institutions designed to accumulate wealth and power by exploiting ignorance, superstitions and fear of death of its subjects and followers).

The ultimate non-existence of the self could be proved by the same chain of argumentation educated people dismiss the notion of a soul today as a mere social creation - a meme. The last 300 years of philosophy and science were, to a large extent, was the effort to discard religious dogmas and replace them by more adequate approximation to the truth.

At the time of the Buddha the only reliable method of discovering of the nature of reality was to trust our senses more than dogmas and be very precise with language use. This is the essence of the method of introspection, which, arguably, has been used by the Buddha to gain his insights about the nature of the mind.

Turning his attention inward (to put it in a modern language - he let his intellect observe its own working) he observed and classified mental phenomena (processes of the mind) which arise and fade in his own mind. After analyzing the nature of these processes he concluded that each one of these are impermanent (transitory) and specialized, which means not general enough to govern the whole observable human behavior.

This result of so-called mindfullness or self-awareness - when one aspect of the mind is tried (to a very limited extent) to observe the other aspects within the whole of brain's activity is, arguably, the best "philosophy of mind" has been done so far, and predates modern science of psychology.

One of the implications of observations made by the Buddha transformed by him into profound insights is the illusory nature of what we call "our self". He taught that this self is mere an appearance, a set of aggregates, like cooking spices wrapped in a banana leaf. Another famous metaphor is a process of pealing of a piece of onion, when by removing layer by layer of what we call nowadays habits, memories, personal experiences, social and cultural conditioning, no substantial self, no permanent core could be found.

This notion of an illusory nature of what we call self is the most fundamental concept of the Buddha's philosophy, which relates to the concept of Maya which predates him. Maya, according to some of Hindu mystics (which is another name for the seekers after the absolute truth, or god), is a veil which obstructs or view of what is - of reality as it is. Arguably, it is due to inevitable interference of some parts of the brain with another, especially so-called language area - a seat of linguistic abstractions, which produces its own constructs, which, it seems, looks from the other areas of the brain as a valid and accurate perceptions. The glimpse of such possible dynamics has been demonstrated in the set of experiments with hemisphere-split patients.

What is the mark of true genius is the use intuition - so called non-verbal knowledge of the body to guide ones search for the closest approximation of the truth. Modern scientists will tell us that the body has information about the nature of the environment it has been shaped by, encoded in the physical structure of the specialized sensors and brains areas. The Buddha has no such understanding, but he paid attention to intuitions from his own brain. Nowadays we would formalize this process as a heuristic-guided search.

Thus he, presumably, got the insight about a brain being an aggregate of highly specialized areas and the phenomena of the mind which is accessible to introspection by so-called primordial awareness turned inward, is mere a bunch of parallel processes which arise and fade on-demand to serve a particular low-level or high-level function which is a part of a observable behavior.

It is quite easy to mess everything up with the modern terminology and modern views based on decades of research in the field of cognitive psychology, nevertheless it is easy to observe that the insights about the fundamental principles about the nature of the mind, described by the Buddha, are still hold. His method of direct observation instead of mere abstract speculation and practice as the way of testing his hypothesis (insights) is a precursor of the scientific method we use today, giving that each one of his disciples is free to replicate test and validate his insights and conclusions.

Got flagged on HN again

This is the discussion

This is my comment:

Nothing to see here. In the age of hipsters, cosplay of intelligence and "social" role-governed behavior in general there is no surprise that we could read all that nonsense in the New Yorker, which is a hipster magazine.

No sane person, who have enough intelligence to realize that music, sports, arts and craftsmanship are 95% based on practice would doubt it. Any good music teacher or Olympic coach will tell you this. The 5% of talent determines where most likely would end up on the spectrum, but talent without practice is nothing, like knowledge unapplyed.

Even in programming actually writing code on the daily basis is what distinguish top performers from mere mediocrity and talking heads and bloggers at the bottom.

For the hipster narcissistic sub-culture it is perfectly OK to "challenge" (they think it is a challenge, not a display of stupidity and lack of even basic understanding) the nature of reality with sophisticated (which does not imply intelligent) nonsensical blah-blah-blah in order to gain public attention to their acting according to the role.

Hipsterism as a social phenomena is an insult to intelligence the way commercialized empty yoga of cosplay and asanas is an insult to spirituality (which is seeking for the truth).

Kant was wrong..

It is not that math has been prior to the mind. It is exactly the other way around.

The sequential, serialized nature of perception gave rise the notion of ordering (sequential) - this then that, this before that. The mind, it's introspection and attention turned to the order of events within a perception gave us math. Not that the math existed somewhere gave us mind. The brain is a mechanical machine. As mechanical as Lego set.

No numbers exists outside the mind. There are only forms of energy - photons, fields we call atoms, and everything else built out of them.

Numbers, time, space are concepts of an observer. But there is no observer at the level of atoms or at the higher level of molecular biology. There is no math there either. Only "quantum" mechanics. Nu numbers, but physical shapes due to electro-chemical properties of proteins, which defines it's shapes.

Universe does not contain math. There is no one to observe that particles might be added or multiplied. Each one of them is independent and a part of the whole.

Math requres an observer.

And he was right - so called apriory knowledge do exist, but it is not math, but environmental conditioning encoded as a structure of specialized brain areas - it reflects so called apriory reality.

Philosophy and physics

When people are studying philosophy but not physics they end up in the realms of pure ideas - disconnected from reality chimeras of abstract nonsense.

When physicists does not study philosophy they end up in the same Hegelian abstrac nonsense of disconnected from reality pure mathematical abstractions, such as higher dimensions, space-time, and other god-like fancies.

Yet another HN rant..

This is exactly how you get professionally marketed crap like Mongo, Node, Hadoop or Java itself - you name it.

It is a fast-food way of building software - cheapest processed shit wrapped in a good SEO and naive user experience (quick and rewarding installation and effortless bootstrapping of a meaningless hello-world - I am so clever meme).

What matters in software in the long run, be it an application or even a programming language, is appropriate design decisions and strong emphasis on design around protocols (by duck-typed interfaces), using declarative (instead of imperative) mostly-functioal paradigm, bottom-up process with focus on modularity and code reuse, while sticking to the standard idioms and principle of less astonishment. This is what is still being taught at MIT, and this is how the internet works as a whole.

99% of Node or PHP code is a toxic amateurish crap, precisely due to ignorant over-confidence of the coders and lacking of proper CS education about right principles and programming paradigms, importance of louse coupling and proper encapsulation, which leads to modular, share-nothing, mostly functional designs with emphasis on immutability and persistence (that's why Clojure is so good - it has been, like Erlang, well-researched with tons of good stuff borrowed form Common Lisp).

Erlang or Haskell or Scala or Swift or Golang are on another side of the spectrum, which could be characterized by discipline of sticking to the right principles and rigorous attention to details (of which Haskell might be a bit too strict, but Erlang or Scala just right).

BTW, these observations about the impact of a proper design, based on right principles, which have been made almost 20 years ago still holds - Today we could state the same for Python3.5+, which, finally, evolved to be so carefully refined as old school Lisps, but emphasizing that Python3 is a prototyping language, while CL is both prototyping and implementation language.

No sane person should even touch PHP or Javascript or any other crap with implicit coercions, error supressions, etc, designed by amateurs (hello, MySQL, Mongo, Hadoop!) like one avoid chap processed junk food or drugs.

I am stupid..

I've completed only one task in little more than 1.5 hours in a Toptal test.. There was not a single chance for me to crack all 3 on time.

So I've quit. I am stupid.

Do not copy-paste code

Do not copy-paste shit without understanding.

This comes from straight from The Rossetta Code

def binary_search(l, value, low = 0, high = -1):
    if not l: return -1
    if(high == -1): high = len(l)-1
    if low >= high:
        if l[low] == value: return low
        else: return -1
    mid = (low+high)//2
    if l[mid] > value: return binary_search(l, value, low, mid-1)
    elif l[mid] < value: return binary_search(l, value, mid+1, high)
    else: return mid

apart from retarded formatting it seems OK

but if we test the code

binary_search([2, 3], 1)

we will get

RecursionError: maximum recursion depth exceeded in comparison


all we did is searched for an element which is less than the smallest one in the list.

The bug is due to arrogance of some C or C++ coder

>>> len([]) - 1

which means that -1 is a legit value for high

sane people are using None

One more thing. If you do this

binary_search([3, 3], 3)]

the code will return 1 instead of 0

There is a more correct version:

def binary_search(xs, x, lo=0, hi=None):
    if hi is None:
        hi = len(xs) - 1
    if lo > hi:
        return None
    if xs[lo] == x:
        return lo
    mi = lo + (hi - lo) // 2
    if xs[mi] > x:
        return binary_search(xs, x, lo, mi-1)
    elif xs[mi] < x:
        return binary_search(xs, x, mi+1, hi)
        return mi

What the fucking fuck?!

What is this? For the love of God, what the fuck is this?!

schiptsov@Ideapad-300-15ISK:~$ sudo reboot
Failed to start Transaction is destructive.
See system logs and 'systemctl status' for details.
schiptsov@Ideapad-300-15ISK:~$ systemctl status 
● - Reboot
   Loaded: loaded (/lib/systemd/system/; disabled; vendor preset: d
   Active: inactive (dead)
     Docs: man:systemd.special(7)

The world has been taken over by fucking idiots.

Major Cleanup

It seems that I am finally ready for a major cleanup of these pages in order to make them more comprehensible.

I hope I could be able to emphasize (there is never enough) the importance to attention to details, deep understanding of whys not just hows, and some passion and zeal.

It is all about a subtle balance, which it seems, underlies everything in the Universe. The balance is appropriate to everything, including passion and zeal. Lack of it will lead to ruin, like all these Zen zealots have ruined the very idea of Zen (which is a practice of not misusing of the mind or using it the way it was evolved - as a tool, not as a cause of suffering).

I would like to show the important difference between what might be called a crafted masterpiece and a dump. The best example of a dump I can think of is these bookshelves in guest houses, where they keep the books abandoned by tourists - the collection of crap to be never looked back again (this is what 98% of Java code is).

Emacs, for example, is a masterpiece, while Eclipse is a garbage dump. Scheme, Haskell or Erlang are a masterpiece, while Common Lisp, Java or C++ are dumps (given that Common Lisp is a truly masterpiece compared to C++).

I would like to talk about artistic sense and deep personal involvement of an artist, which makes code of guys like bbatsov, kennethreinz, sysoev, antirez, to name a few, so beautiful.

I hope I would be able to convey the importance of big ideas and vanity of popular buzzwords. That tables-driven approach as in pandas is a big old idea, and, for example, "reactive" is just nonsense.

So, lets try.


Is there already a proposal to add that wonderful Type? syntax from Swift instead of ugly Maybes, at least as a standard syntac sugar?

It is so beautiful because it reflects a good tradition of naming predicates in Sheme and few other languages.

Destructuring is by pattern matching, as usual.

Docker, Kubernets, Mesos, etc.

There is nothing extraordinary, profound or even innovative in so-called Containerization, Orchestration and other silly memes.

It is a way to tightly pack applications into a data-center to extract more "value" from hardware, or simply put - to make more money by selling slices of servers with per-hour basis.

All other blah-blah about benefits of containers is nonsense. The more complex system you make, the more inefficient and fault-prone it becomes, compared to running the same service on a dedicated hardware.

The reasoning is quite simple. Suppose you have some Java pile of crap, which is, basically, a java.exe process which uses sockets for communication and, probably, some remote storage, which is also communicated via IP protocol. This kind of crappy app could be run in a chroot-based environment under some hypervisor. So, one isolates it into a "container" which is could be think of as a FS snapshot. You could isolate a Rails app, for sure, or some REST-ful service at a cost of losing I/O efficiency - basically, you are running in an emulator with para-virtualization (Xen, KVM+qemu).

This exactly what FreeBSD Jails has been designed for. The ideas came from IBM Mainframes.

Docker gives you way to describe in a declarative way (which is good) your images. Kubernets is a cluster management. It is all clever and saturated with a lots of sophisticated blah-blah full of long words, so the crowd is very excited.

But this does not solve any fundamental problems, it just squeezes a few more profit-driven middle-men between your code and hardware. The claims that it eliminates the costs of system administration is nonsense. Unless you are running a guest-book with a few html-forms Rails example, everything will become even more messy. Think what would happen when a some replications (Redis or MySQL or whatever) will fail. Or, my favorite example, your java.exe crashes, leaving your data in inconsistent state and cause a data lose.

But, of course, all this it is very cool. Especially to isolate these Apache Spark nodes, which are utilizing literally hundreds of thousands of lines of code, consuming gigabytes of memory to hold mutable, locked data to perform map-reduce operations on read-only, pre-sorted, partitioned data, which could be done in a few thousand of lines of Erlang or Common Lisp or even Scheme.

Blah blah

Yeah, is it such a fine set of ideas, or rather intuitions about the strict similarity between high-level programming and what is going on in what we call living beings.

There are some big molecules, made out of atoms in an almost uniform ways (I am oversimplifying, of course) they are chains of amino-acids (in case of proteins). These molecules have a structure, which determines its physical shape and hence its electrical and chemical properties. Some of these we call proteins, some enzimes, some act as a data, some as high-order procedures - they perform transportation of one physical forms (structures) into another.

In some sense, the ingenious intuition behind the original Lisp was that the same uniform chains of data (list structures) could represent the code and the data, and that there is no fundamental difference among them. Moreover, the internal representation and human-readable notation could be also uniform, and reflect and express this uniformity in the syntax - that's why we have all these parentheses and write in ASTs.

The structure is what lifts a "dumb" matter into a higher level. This is Yin. The procedures - the algorithms - are the second half. It is Yang. The list structure is what binds them together.

Here it is captured not just the essence of programming as a data-processing discipline, but also something of a higher level. An intuition, which, I believe, illuminated the famous minds behind many early Lisps.