What is the difference between [ ] and ( ) brackets in Racket (lisp programming language)?

According to the Racket documentation, there is no difference — there is only a convention to use [ and ] for cond clauses (and use your judgement for the rest, as far as I understand): The use of square brackets for cond clauses is a convention. In Racket, parentheses and square brackets are actually interchangeable, … Read more

Curly Brackets in Arrow Functions

The pair of braces forms a block, containing a list of statements. You need to use a return statement explicitly to make the function return something: (one) => { return oneTodo(one, action); // ^^^^^^ } If you omit the braces, the arrow function has a concise body, which consists solely of a single expression whose … Read more

What is the difference between square brackets and single quotes for aliasing in SQL Server?

To answer the question “is there any preference/difference”: Yes, there are as many preferences as there are opinions, but be careful whose preferences you adopt. As a best practice, it is advisable to write portable SQL if it doesn’t require any extra effort. For your specific sample, it is just as easy to write a … Read more

Different meanings of brackets in Python

Square brackets: [] Lists and indexing/lookup/slicing Lists: [], [1, 2, 3], [i**2 for i in range(5)] Indexing: ‘abc'[0] → ‘a’ Lookup: {0: 10}[0] → 10 Slicing: ‘abc'[:2] → ‘ab’ Parentheses: () (AKA “round brackets”) Tuples, order of operations, generator expressions, function calls and other syntax. Tuples: (), (1, 2, 3) Although tuples can be created … Read more

How to prevent Sublime Text 2 from swallowing closing brackets, quotes and parentheses?

add this to your user keybindings file { “keys”: [“)”], “command”: “insert”, “args”: {“characters”: “)”}, “context”: [ { “key”: “setting.auto_match_enabled”, “operator”: “equal”, “operand”: true }, { “key”: “selection_empty”, “operator”: “equal”, “operand”: true, “match_all”: true }, { “key”: “following_text”, “operator”: “regex_contains”, “operand”: “^\\)”, “match_all”: true } ] } it will override the one keybinding that instead … Read more

Automatic closing brackets for Vim [closed]

For those of us, who want a vanilla vim: inoremap ” “”<left> inoremap ‘ ”<left> inoremap ( ()<left> inoremap [ []<left> inoremap { {}<left> inoremap {<CR> {<CR>}<ESC>O inoremap {;<CR> {<CR>};<ESC>O This autocomplete in insert mode, provided set paste is not set. Keep it in the vimrc to avoid typing it every time and when we … Read more

tech