ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
“Let it first blossom, then bear fruit, then ripen.”
— Epictetus
Quantifier operators
• All: checks if all the elements satisfy a condition
• Any: checks if any of the elements satisfy a condition
• Contains: checks if it contains a specific element

#CSharp, LINQ
#toRead

📚 A case against syntax highlighting
by Linus Åkesson

http://www.linusakesson.net/programming/syntaxhighlighting/
“Syntax highlighting is juvenile. When I was a child, I was taught arithmetic using colored rods. I grew up and today I use monochromatic numerals.”
— Rob Pike
Regular expression based syntax highlighting is often wrong
“No syntax highlighting isn’t really what I wanted, I wanted nearly none. Still like string backgrounds to be tweaked and comments to be faded.”
― Robert Melton
List := ordered collection of homogeneous items
#regex
Regex Cheatsheet
All the rules apply to all of the three languages: #Python, #Perl (PCRE) and #JavaScript, unless stated otherwise.
Source: debuggex.com

Basics
.: Any character except newline
a: The character a
ab: The string ab
a|b: a or b
a*: 0 or more a's
\: Escapes a special character

Quantifiers
*: 0 or more
+: 1 or more
?: 0 or 1
{2}: Exactly 2
{2, 5}: Between 2 and 5
{2,}: 2 or more
(,5}: Up to 5 (Python only)
⚠️ Default is greedy. Append ? for reluctant.

Groups
(...): Capturing group
(?:...): Non-capturing group
\Y: Match the Y'th captured group
Python and PCRE:
(?P<Y>...): Capturing group named Y
(?P=Y): Match the named group Y
(?#...): Comment
PCRE only:
(?>...): Atomic group
(?|...): Duplicate group numbers
(?R): Recurse into entire pattern
(?Y): Recurse into numbered group Y
(?&Y): Recurse into named group Y
\g{Y}: Match the named or numbered group Y
\g<Y>: Recurse into named or numbered group Y

Character Classes
[ab-d]: One character of: a, b, c, d
[^ab-d]: One character except: a, b, c, d
[\b]: Backspace character
\d: One digit
\D: One non-digit
\s: One whitespace
\S: One non-whitespace
\w: One word character
\W: One non-word character

Assertions
^: Start of string
$: End of string
\b: Word boundary
\B: Non-word boundary
(?=...): Positive lookahead
(?!...): Negative lookahead
Python and PCRE:
\A: Start of string, ignores m flag
\Z: End of string, ignores m flag
(?<=...): Positive lookbehind
(?<!...): Negative lookbehind
(?()|): Conditional
PCRE:
\G: Start of match

Flags
i: Ignore case
m: ^ and $ match start and end of line
Python and PCRE:
s: . matches newline as well
x: Allow spaces and comments
L: Locale character classes
u: Unicode character classes
(?iLmsux): Set flags within regex
JavaScript only:
g: Global Match

Special Characters
\n: Newline
\r: Carriage return
\t: Tab
\YYY: Octal character YYY
\xYY: Hexadecimal character YY
JavaScript and PCRE:
\0: Null character
\cY: Control character Y
Hexadecimal character YY (\uYY for JavaScript and \x{YY} for PCRE)

Replacement
Python only:
\g<0>: Insert entire match
\g<Y>: Insert match Y (name or number)
\Y: Insert group numbered Y
JavaScript only:
$$: Inserts $
$&: Insert entire match
$`: Insert preceding string
$': Insert following string
$Y: Insert Y'th captured group

Escapes
PCRE only:
\Q..\E: Remove special meaning

POSIX Classes
PCRE only:
[:alnum:]: Letters and digits
[:alpha:]: Letters
[:ascii:]: Ascii codes 0 - 127
[:blank:]: Space or tab only
[:cntrl:]: Control characters
[:digit:]: Decimal digits
[:graph:]: Visible characters, except space
[:lower:]: Lowercase letters
[:print:]: Visible characters
[:punct:]: Visible punctuation characters
[:space:]: Whitespace
[:upper:]: Uppercase letters
[:word:]: Word characters
[:xdigit:]: Hexadecimal digits
#toRead

📚 Writing a TextMate Grammar
by Matt Neuburg

https://www.apeth.com/nonblog/stories/textmatebundle.html
Idea: "wizard" as an app template
Why returns a causal link.
How returns a causal tree, which is comprised of causal links.
There is no creation, only allocation.
Nile, the language of formalization of ideas
steepness of TreeView
Operator precedence leads to quasi-balanced parse tree.
#AI
AI-completeness
The most difficult problems are informally known as AI-complete or AI-hard, by analogy with NP-complete and NP-hard in complexity theory, implying that the difficulty of these computational problems is equivalent to that of solving the central artificial intelligence problem—making computers as intelligent as people, or strong AI. Since many AI problems have no formalisation yet, conventional complexity theory does not allow the definition of AI-completeness. To call a problem AI-complete reflects an attitude that it would not be solved by a simple specific algorithm. They include:
• Computer vision (and subproblems such as object recognition)
• Natural language understanding (and subproblems such as text mining, machine translation, and word sense disambiguation)
• Dealing with unexpected circumstances while solving any real world problem, whether it's navigation or planning or even the kind of reasoning done by expert systems.
• Peer Review
Bongard problems
• Automatic speech recognition
#HCI
Baby duck syndrome
- denotes the tendency for computer users to "imprint" on the first system they learn, then judge other systems by their similarity to that first system. The result is that "users generally prefer systems similar to those they learned on and dislike unfamiliar systems". The issue may present itself relatively early in a computer user's experience, and it has been observed to impede education of students in new software systems or user interfaces.
#Design
Software archaeology
- is the study of poorly documented or undocumented legacy software implementations, as part of software maintenance. It includes the reverse engineering of modules, and the application of a variety of tools and processes for extracting and understanding program structure and recovering design information.
#toRead #AI

📚 Index of Bongard Problems
by Mikhail Bongard, Douglas Hofstadter, Harry Foundalis, ...

http://www.foundalis.com/res/bps/bpidx.htm