about summary refs log tree commit diff stats
path: root/4ed0a6.hot-takes.txt
blob: 7fb88be115d6f9e2ec1f2daeb3daff435e164c7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
ID: 4ed0a61b-6c3b-4c74-b8c4-a0051a8cf12a
Title: Hot takes on anything
Authors: Nova[有線魔女] <novaburst@envs.net>
Date: 2021-06-17T11:01:59-00:00
Topics: Off-topic

* OCaml as a programming language is not as cursed Rust is

* Rust's portability is so horrible that it doesn't even run on an Arduino board

* Rust is better than C++ but it's worse than C

* Rust's Cargo package manager is just as cursed as Node.js's NPM is

* Even Go is better than Rust

* Bootstrapping an OCaml toolchain is not too hard , or even a C or a Go one , when compared to Rust

* Using CMake on small projects is cursed

* Using CMake for bigger projects is even more cursed ~ metalune

* Bitbucket beats GitLab in uselessness

* Soydevs should get an actual job outside of computing

* Matrix is the best example of Suck in the instant messaging field

* Do you consider Windows as an insult to Computer users? ~ tronprogram

* Come back when it runs on POSIX ~ caskd

* C# is what happens when some kid learns java then looks at C and thinks "I can fix this" ~ Baobab

* Rust is the HTML5 of programming languages, as it lacks portability and a specification.

* Cryptocurrency it's only useful to those with money. ~ https://koyu.space/@Einhjeriar

* The idea of DeltaChat is good but the implementations are cursed

* JS programmers should not be called programmer as a sign of respect to other programmers ~ qorg11

* Don't rewrite $perfectly_functioning_program in Rust ~ shokara

* C# is like having Java and C++ combined but only leaving the bad parts. ~ shokara

* dude my phone is less spyware because it doesn't have an i in front of the name ~ Swim

* microsoft cant even use their own operating system to host their infrastructure ~ Diego

* GTK+3.0 is a theming nightmare

* It's like a fallacious thought that newer thing must have improvements. ~ ibn-Hajr

* Eyy I feel like being a conspiracist everytime bring up about things against the trend ~ PGP[x][m][p][p]

* Why does my keyboard keep suggesting the n word? ~ SLF[xmpp]

* I'm not using matrix because a lot of people use matrix ~ Baobab

* Rust is a decent C++ replacement if you have the same goals as C++, but if you don’t, the design has very similar drawbacks ~ https://drewdevault.com
eral.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
#
#            Nimrod's Runtime Library
#        (c) Copyright 2011 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module implements some common generic algorithms.

type
  TSortOrder* = enum   ## sort order
    Descending, Ascending 

proc `*`*(x: int, order: TSortOrder): int {.inline.} = 
  ## flips `x` if ``order == Descending``;
  ## if ``order == Ascending`` then `x` is returned.
  ## `x` is supposed to be the result of a comparator.
  var y = order.ord - 1
  result = (x xor y) - y

proc reverse*[T](a: var openArray[T], first, last: int) =
  ## reverses the array ``a[first..last]``.
  var x = first
  var y = last
  while x < y:
    swap(a[x], a[y])
    dec(y)
    inc(x)

proc reverse*[T](a: var openArray[T]) =
  ## reverses the array `a`.
  reverse(a, 0, a.high)

const
  onlySafeCode = false

proc merge[T](a, b: var openArray[T], lo, m, hi: int, 
              cmp: proc (x, y: T): int, order: TSortOrder) =
  template `<-` (a, b: expr) = 
    when onlySafeCode:
      a = b
    else:
      copyMem(addr(a), addr(b), sizeof(T))
  # optimization: If max(left) <= min(right) there is nothing to do!
  # 1 2 3 4  ## 5 6 7 8
  # -> O(n) for sorted arrays.
  # On random data this safes up to 40% of merge calls
  if cmp(a[m], a[m+1]) * order <= 0: return
  var j = lo
  # copy a[j..m] into b:
  assert j <= m
  when onlySafeCode:
    var bb = 0
    while j <= m:
      b[bb] = a[j]
      inc(bb)
      inc(j)
  else:
    CopyMem(addr(b[0]), addr(a[j]), sizeof(T)*(m-j+1))
    j = m+1
  var i = 0
  var k = lo
  # copy proper element back:
  while k < j and j <= hi:
    if cmp(b[i], a[j]) * order <= 0:
      a[k] <- b[i]
      inc(i)
    else:
      a[k] <- a[j]
      inc(j)
    inc(k)
  # copy rest of b:
  when onlySafeCode:
    while k < j:
      a[k] = b[i]
      inc(k)
      inc(i)
  else:
    if k < j: copyMem(addr(a[k]), addr(b[i]), sizeof(T)*(j-k))

proc sort*[T](a: var openArray[T], 
              cmp: proc (x, y: T): int = cmp,
              order = TSortOrder.Ascending) =
  ## Default Nimrod sort. The sorting is guaranteed to be stable and 
  ## the worst case is guaranteed to be O(n log n).
  ## The current implementation uses an iterative
  ## mergesort to achieve this. It uses a temporary sequence of 
  ## length ``a.len div 2``.
  var n = a.len
  var b: seq[T]
  newSeq(b, n div 2)
  var s = 1
  while s < n:
    var m = n-1-s
    while m >= 0:
      merge(a, b, max(m-s+1, 0), m, m+s, cmp, order)
      dec(m, s*2)
    s = s*2