Xah Programing Blog 2012-12
slightly updated: Concepts and Confusions of Prefix, Infix, Postfix and Lisp Notations. Also see comment at bottom of that page by David A Wheeler, who seems to have some success in introducing a alternative syntax to several Scheme Lisp implementations.
Ruby's Whitespace Issue
also, Ruby's whitespace issue is not so good. For example, this is valid:
# -*- coding: utf-8 -*- # ruby def ff ; 4 end p ff
How to explain that?
so far, what i see is just ad hoc. That is, there's no simple systemic rule. The key seems to be, that something (expression?) needs to end in semicolon, and semicolon can (often?) be omitted?
if so, but then if you look at the case def f; 4; end
, then that syntax design doesn't seem to make sense, as “def f” isn't a complete clause.
see previous article: What Does it Mean When a Programing Language Claims “Whitespace is Insignificant”?
new today.
- Ruby: Function Optional Parameter
- Python: Function Optional Parameter
- Perl: Function Optional Parameter
Intro to Lisp's Symbol concept. Emacs Lisp Symbol .
a piece of history. Perl: Sort Unstable
New for Ruby, updated for Python and Perl:
Added Ruby: Ruby: Map Function to List
see also Python: Map Function to List • Perl: Map Function to List
Keyboard Shortcut Design: Repeatable vs Non-Repeatable Commands and Keys
updated: git Tutorial
been using git for several months now. Before was svn. (and cvs before)
can't say i find git better (except being one of the distributed RCS). Git's man pages are totally incomprehensible. The MD5 for commit id is a pain. You have to type much more, using more than one command, to do routine commit. Then the concept of staging/cache/index is confusing. (why can't they stick with one term? or is there actual technical difference?)
git being perhaps most popular has a lot to do with tie to Linus celebrity.
was mentioning git on Google Plus, then [James Salsman https://plus.google.com/+jsalsman/posts] mentioned Bazaar.
Bazaar (software). Apparently, a few big companies are using Bazaar, including Launchpad, Ubuntu, MySQL, GNU Emacs.
[Why Switch to Bazaar? By Canonical. At http://doc.bazaar.canonical.com/migration/en/why-switch-to-bazaar.html , accessed on 2012-12-22 ]
What Does it Mean When a Programing Language Claims “Whitespace is Insignificant”?
Added Ruby: Ruby: Loop Thru List
see also Python: Loop Thru List • Perl: Loop Thru List
Updated: Unicode in Function Names and Operator Symbol
from this, you can see which language is better:
- Python: Dictionary
- Perl: Hash Table
- Ruby: Hash Table
- PHP: Hash Table Tutorial
- Emacs Lisp: Hash Table
Perl Folks Try to Erase History!
updated: W3C Proposed Icons for Internet before Unicode
New today: Python: List Basics
in past 3 hours, added Ruby to my Perl+Python tutorial. Completed the following pages.
Comparative Study
- Python: Print Version String from Script
- Python: Quote String
- Python: if then else
- Python: for, while, Loops
- Python: True, False
Invisible Character from Twitter
Functional Programing: Make Dependent Functions Explicit
In functional programing, a function's behavior should depend only on its arguments. However, there's another issue that's been bugging me for over a decade. That is, there's no list of what other functions this function depends on. In the past i've tried to pass all functions it calls as parameters in the function definition, but that's crazy. I haven't heard this issue mentioned anywhere.
Haskell people, any thoughts?
Ubuntu Bug: 「pydoc modules」 Core Dump
updated: Ergonomic Keyboard Layouts
updated. A efficient keyboard layout for Portuguese. pt-Nativo (Portuguese) Efficient Keyboard Layout .
Question to Readers: {Perl, Python, Ruby}, Together on One Page, or Separate?
I have a Python Tutorial There, each page, has both languages for comparative study.
My question is, should i also put my new Ruby Tutorial there for comparative study? Or, should Ruby by itself?
I can actually also put {Emacs Lisp, PHP} there for comparative study too. But then each page will be long. Alternatively, if each language is on separate page, with inter-links, then people could page between any two languages.
Which way do you prefer?
updated a bit. Added tuple and explanation of Python sequence types. Python in One Day
when you start to learn a new tech, often there's a sea of info. All the confusing terminologies, tools, structures, and tens of tutorials compete to confuse you.
been reading Ruby+Rails for the past 10 days. Now i finally have a pretty good grasp.
lots updates to my tutorial in parallel. In pretty good shape for a start. Ruby Tutorial
separated into new page: Linux: Sort Lines
minor update: git: Setting up GitHub, GitCafe, Google Code
software jargons and tech 2012: blackbox/whitebox testing, Jenkins, Puppet, Selenium
XML Syntax is Inferior Lisp Syntax?
updated: LISP Logo
alias l='ls -AlF --color --time-style=long-iso'
See also: Linux: Set Bash Shell Prompt to Color .
i think i start to dislike the rvm ruby installer. Because:
- None-standard install methods. For example,
\curl -L https://get.rvm.io | bash -s stable --ruby
. This directly download and run a script on your machine. Also, it uses curl instead of the more standard wget. You have to install curl on Ubuntu first. This directly running a script is a questionable practice. - After you install it, you see that it's a massive number of bash shell scripts. Today, bash scripts should never be written. Even if you have to, use perl. Even python is standard in linuxes and Mac OS X.
- Doesn't respect linux system standard ways.
- Doesn't work out of the box. After install, it asks you confusingly and questionably to run a shell script, and ask you to run it in a separate terminal.
- It add lines to your shell init file to load a massive shell script. Not simply append to your $PATH. This is questionable practice again. It slows down your shell startup.
- But when you restart, it doesn't work. Because it adds to “.bash_profile” but not to “.bashrc”
rvm
isn't a normal tool. It's not a script or binary. Instead, “rvm” is a bash function.- After install, when you
type gem
, it's also a shell function. Very annoying. It seems to have lots wrappers, and faakup standard ways of doing things. For example, when youtype rvm
to see what/where it is, pages scrolls thru.
the whole shebang smells bad.
It appears to me, the whole rvm is a one-man's project, and somehow got very popular. Doesn't respect standard ways. Written in 30 years old tech.
Addendum: thanks to ruby rvm dev Michal Papis who helped me solve a problem. When installing rvm, be sure to read rvm requirements
.
updated: Linux: Show Directory Size: du
updated: Unicode Full-Width Characters
A collection of software engineering pain. Complexity and Tedium of Software Engineering
Linux Problem: wmctrl, Documentation
worth reading again: Guy Steele Says: Don't Iterate, Recurse, and Get rid of cons!
a old site that quotes me:
The Contempt Page ~ By Mr. Schnada. At http://www.schnada.de/quotes/contempt.html
See also:
Learned Ruby in 2 days. Here's a draft version of tutorial. Ruby Language Basics
The next few days i'll be getting onto Ruby on Rails.
Ruby experts, please hit me with comment and suggestion.
If you have a question, put $5 at patreon and message me.