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

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
Channel created
Types
Array — Sequential Container
Box — Unique Pointer
Exception — Exception Object
File — Operating System File
Filter — Filtered Iterable
Float — Floating Point Object
Function — Function Object
GC — Garbage Collector
Int — Integer Object
List — Linked List
Map — Apply Function to Iterable
Mutex — Mutual Exclusion Lock
Process — Operating System Process
Range — Integer Sequence
Ref — Shared Pointer
Slice — Partial Iterable
String — String Object
Table — Hash table
Thread — Concurrent Execution
Tree — Balanced Binary Tree
Tuple — Basic Collection
Type — Metadata Object
Zip — Multiple Iterator

Classes
Alloc — Memory Allocation
Assign — Assignment
C_Float — Interpret as C Float
C_Int — Interpret as C Integer
C_Str — Interpret as C String
Call — Callable
Cast — Runtime Type Checking
Cmp — Comparison
Concat — Concatenate Objects
Copy — Copyable
Current — Implicit Object
Doc — Provides Documentation
Format — Read or Write with Format String
Get — Gettable or Settable
Hash — Hashable
Help — Usage information
Iter — Iterable
Len — Has a length
Lock — Exclusive Resource
Mark — Markable by GC
New — Construction and Destruction
Pointer — Reference to other object
Push — Pushable and Popable object
Resize — Object can be resized
Show — Convert To or From String
Size — Type Size
Sort — Sortable
Start — Can be started or stopped
Stream — File-like
Swap — Swapable
Why not to use eval?

Almost never put code in a constant string then eval it.
1. No compile-time error check
2. No bytecode optimization at compilation.
3. No syntax highlighting.
4. Messy if you have quoted strings
5. Messy if you have comments

You can use a lambda alternatively, for the sake of brevity.
DRY vs. WET

Don't repeat yourself

We enjoy typing or Write everything twice

Nile, unlike the river, is definitely DRY.
HTML

Browsers automatically add an empty line before and after a paragraph.

Superscript and subscript

It is not recommended that you use headings just to make the text big or bold, because search engines use headings to index the web page structure and content.

br means new line
hr mean rule

HTML documents consist of nested HTML elements. In the example below, the body element includes the <p> tags, the <br /> tag and the content, "This is a paragraph".
REWRITING THE CHANNEL
#Programming_paradigms : Declarative versus Imperative

#Declarative
All about relations.

Does not state the order in which operations execute.

Focuses on what the program should accomplish without specifying how the program should achieve the result.
Expresses the logic of a computation without describing its control flow.

Common declarative languages include those of database query languages (e.g. #SQL, #XQuery), regular expressions (#Regex), logic programming, functional programming, and configuration management systems.

e.g. #Haskell, #Kanren (a dialect of #Scheme), #Prolog, #Wolfram_Language

#Imperative
Uses statements that change a program's state.
1. they state the order in which operations occur, with constructs that explicitly control that order

Allows side effects, in which state can be modified within one unit of code, and then read inside a different unit of code.

Imperative programming focuses on describing how a program operates.
an imperative program consists of commands for the computer to perform.
Many imperative programming languages (such as #Fortran, #BASIC, and #C) are abstractions of assembly language.
#Programming_paradigms : #Logic programming
Based on formal logic.
Any program is a set of sentences in logical form, expressing facts and rules about some problem domain.
Major logic programming language families include #Prolog, Answer set programming (#ASP) and #Datalog.

In all of these languages, rules are written in the form of clauses:
H if B1 and … and Bn.

H is called the head of the rule and B1, …, Bn is called the body.

Facts are rules that have no body.
Loading images takes time. Using large images can slow down your page, so use them with care.
Microsoft Compiled HTML Help (#chm)
CHM is an #HTML help file for online helps. It is proprietary format from #Microsoft. In CHM file a number of HTML help files are compressed, compiled and indexed. CHM files are used mostly as software manual. #LZX compression technique is used to compress files in CHM format. There is a search option in this file. Moreover multiple CHM files can be added together.

Portable Document Format (#pdf)
PDF is a document file format that contains text, images, data etc. This document type is Operating System independent. It is an open standard that compresses a document and #vector graphics. It can be viewed in web browsers if the PDF plug-in is installed on the browser.
To avoid any confusion while working with #regex, we would use raw strings as r"expression".
Raw strings don't escape anything, which makes use of regular expressions easier.
A List comprehension is a syntactic construct used to create a list:

• based on existing lists.
• in an easy natural way like a mathematician is used to do.
• whose contents obey a simple rule.

en.wikipedia.org/wiki/Set-builder_notation
#Programming_paradigms : #Functional programming

Seeks to use pure functions.

Pure functions:
• have no side effects
• return a value that depends only on their arguments. e.g. sin(x) will, for the same value of x, always return the same result.
• are easier to reason about and test.
• are more efficient. Once the function has been evaluated for an input, the result can be stored and referred to the next time the function of that input is needed, reducing the number of times the function is called. This is called #memoization.
• are less confusing to run in parallel (See #concurrent programming).

Using only pure functions complicates the otherwise simple task of IO since this appears to inherently require side effects.
#Anonymous_functions

While def assigns the created Function object to a variable, lambda creates it on the fly, mostly used when passing a simple function as an argument.

Syntax : consists of the lambda keyword, a list of arguments, a colon, and the expression to be evaluated and returned.
More like the musing of a crazed crazy learning actual programming
Forwarded from Mahdi
A compliment?