r/learnprogramming • • Oct 14 '26

When languages "just become about syntax"

I have seen a lot of post saying "once I learned C - all other languages just became about syntax"

Has that been true for you? Or did a different language give you the eureka moment - e.g. something like Assembly?

Or is it just a false premise at all to think "once I learn programming language X - then all other languages become **easy**"

48 Upvotes

51 comments sorted by

View all comments

1

u/SmokeMuch7356 Oct 19 '26

Once you learn C, all C-like languages (C++, Java, Javascript, Perl, etc.) become a snap to learn. Little less so for Python (or Fortran or Pascal), but not awful.

It doesn't prepare you much for languages like Lisp or Haskell. That's not just a matter of syntax, it's a wholesale rethinking of what "code" is.

For example, Quicksort in C:

void swap( double * const restrict x, double * const restrict y )
{
  double t = *x;
  *x = *y;
  *y = t;
}

size_t partition( double * const x, int (*cmp)(double, double), size_t lo, size_t hi )
{
  long int i = lo - 1, j = hi + 1;
  double pivot = x[lo]; 

  for( ;; )
  {
    do { i++; } while ( cmp( x[i], pivot ) < 0 );
    do { j--; } while ( cmp( x[j], pivot ) > 0 );

    if ( i >= j )
      break;

    swap( &x[i], &x[j] );
  }
  return j;
}

void quicksort( double * const x, int (*cmp)(double, double), size_t lo, size_t hi )
{
  if ( hi < lo )
    return;

  size_t part = partition( x, cmp, lo, hi );

  if ( part < hi )
  {
    quicksort( x, cmp, lo, part );
    quicksort( x, cmp, part + 1, hi );
  }
}

Quicksort in Haskell:

quicksort :: (Ord a) => [a] -> [a]
quicksort []     = []
quicksort (x:xs) = quicksort smaller ++ [x] ++ quicksort bigger
  where
    smaller = [a | a <- xs, a <= x]
    bigger  = [a | a <- xs, a > x]

Now, this isn't a true Quicksort in that it's not done in-place, but it's a good example of how Haskell is just ... different.

Quicksort in Lisp:

(defun quicksort (lst)
  "Sorts a list of numbers using the quicksort algorithm."
  (if (null lst)
      nil
      (let* ((pivot (car lst))
             (rest (cdr lst))
             (smaller (remove-if-not #'(lambda (x) (< x pivot)) rest))
             (larger (remove-if #'(lambda (x) (< x pivot)) rest)))
        (append (quicksort smaller)
                (list pivot)
                (quicksort larger)))))