Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
FamDav
Mar 29, 2008

horse mans posted:

you don't have it because there's no way to diagnose it

dont you only have impostor syndrome if youre actually good at something

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008

echinopsis posted:

can't pointers to pointers to pointers be used for some fancy efficient tricky code?

also I still can't even get my head around how even the most simple quine works... I need baby's first Quine written in basic and then run a debugger at 3 lines per hour just to follow it

pointers to pointers could be useful if for some reason you want to pass a pointer through an algorithm which modifies it. i would discourage you from doing this.

The simplest form of a quine is having a string version of the program with a blank spot where the stringified version ought to be. The body of the program just outputs that stringified version twice, once without quotes and once with quotes in the correct spot.

FamDav fucked around with this message at 08:38 on May 8, 2013

FamDav
Mar 29, 2008

tef posted:

i have no qualifications to do programming. most programmers have no idea what they are doing.

if you can write a for loop, and can count you are doing better than many people i've interviewed.


it is much easier to be a programmer if you stop caring about the quality of work you produce. if you get more money and have more fun doing code, just do it and drink yourself into oblivion to deal with the insecurity and ennui

tef seriously you just need to find something that excites you. are there no jobs in the uk that you would find stimulating?

FamDav
Mar 29, 2008
we encounter so much mediocrity in our day to day lives that it infuriates and depresses us that people who do not put in a sincere effort can be rewarded as well or even better than us. we have to accept that our reward for hard work and persistence is the knowledge that we took the more difficult path and succeeded.

only then will you find happiness and comfort.

FamDav
Mar 29, 2008

Zlodo posted:

this, this a million times
embrace the darkness of templates, stop caring about "omg this is crazy obfuscated poo poo" and go all out implementing crazy compile time algorithms and you'll enjoy c++ a lot

also generally stop caring about whether ur a bad programmer if u want to enjoy programming

c++ is the lisp of imperative programming languages, and that makes it awesome

FamDav
Mar 29, 2008

Orbi posted:

dumb c++ question: can i overload extraction/inserion operators for fstream as well as for regular iostreams?

e.g. can i have
code:
friend istream& operator>>(istream&, Class&);
friend ifstream& operator>>(ifstream&, Class&);
in a class? i figure since fstream inherits from iostream it would but im not really in a position to test it right now and i don't wanna waste my time if i cant

yes

FamDav fucked around with this message at 06:22 on May 10, 2013

FamDav
Mar 29, 2008

gucci void main posted:

it's not really that weird after about an hour. just read stephen kochan's programming in objective c book, as it's basically the bible for the language. it's not too hard to learn, the real difficulty is in getting used to using the cocoa framework as objc itself is completely useless without it.

this is probably the least offensive post sulk has made in months

FamDav
Mar 29, 2008
The easiest way to learn vim is to learn enough to move around, insert, and delete. Then whenever something annoys you assume there is a better way and google for it.

FamDav
Mar 29, 2008
i ski in winter
and go to concerts a lot
you broken people

FamDav
Mar 29, 2008
Wouldn't you rather either instead of option.

FamDav
Mar 29, 2008
if you job a computer these are the representations of numbers you should know

1) binary
2) 2-adic
3) some kind of arbitrary-precision type
3) IEEE floats/doubles
4) church numerals

FamDav
Mar 29, 2008

prefect posted:

is this a religious thing, or was there some guy named church who thought them up?

nah its encoding numbers in lambda calculus.

i made my list in order of importance btw

FamDav
Mar 29, 2008

nrook posted:

wait, what's the difference between p-adic numbers and p-ary numbers except that you get cool algebraic properties from p being a prime

like, 13.5 in binary is

code:
1 * 2^3 + 1 * 2^2 + 0 * 2^1 + 1 * 2^0 + 1 * 2^-1
and 13.5 as a 2-adic number is...

code:
(1 * 2^4 + 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0) * 2^-1
which... seems pretty similar

this poo poo is cool though

2's complement is just restricting 2-adic integers to a finite number of bits and considering the leftmost bit infinitely many repetitions of that bit.

edit: which sounds like a really douchey thing to say but really those are the rules, its how it works, blah blah blah

Ronald Raiden posted:

I feel like floating point should be higher on the list. Its probs more important than arbitrary precision, since for a lot of common applications arbitrary precision doesn't matter and floating point math is a thing computers do better. Like graphics and poo poo.

probably

FamDav fucked around with this message at 19:05 on Jun 9, 2013

FamDav
Mar 29, 2008
http://www.madore.org/~david/math/padics.pdf is a paper

FamDav
Mar 29, 2008
if you do any kind of scientific computing or graphics work, knowing how to write numerically stable code makes you less awful.

and church numerals are:

0 = \x.\f.x
1 = \x.\f.f x
2 = \x.\f.f (f x)

etc.

FamDav
Mar 29, 2008

Bloody posted:

what the gently caress is this

do you really consider that a valid explanation

lmao

how about they are an embedding of the integers into the lambda calculus using the properties of function application

lets describe the number N as the result of N applications of a function f to a value x. so

0 = λf.λx.x
1 = λf.λx.f x
2 = λf.λx.f (f x)

i even looked up the lambda symbol so it looks nice

lets write another function λa.λb.λf.λx.a f (b f x), which is plus. this works because if a is f applied A times and b is f applied B times, then this applies f A+B times. wow, whoa

we can write multiply by λa.λb.λf.λx.a (b f) x because this is the application of b (which is the application of f B times) A times

i leave exponentiation and subtraction as an exercise to the reader

FamDav
Mar 29, 2008
The correct answer is to make a blog post about it and throw it up on Hn.

FamDav
Mar 29, 2008
why are they talking about syntax highlighting in terms of colors when you want to talk about groups of lexemes. and isn't it basically

parens
keywords
numbers
strings
operators?

i guess you could split it into exposed identifiers vs internal, lol

FamDav
Mar 29, 2008

Nomnom Cookie posted:

perl can parse differently depending on BEGIN blocks. the one proof i've seen relied on conditionally defining a sub in a begin block. thats not so bad compared to c++. c++ is undecidable except that the standard requires compilers to limit template expansion depth. you have to either be ok with using ambiguous parses for syntax highlighting or you have to instrument the compiler

i think tef said a toy language is one where the most complex software written in the language is its compiler. c++ is a toy language

template expansion has nothing to do with syntax highlighting. that just makes c++ compilation undecidable.

while c++ has some wonky context sensitive issues (object instantiation vs function declaration), there's really nothing worse about highlighting it than python or haskell.

also, what more do people want out of syntax highlighting?

FamDav
Mar 29, 2008

Zlodo posted:

this is exactly the kind of thing where people tend to go "lol c++" because #include whereas the real problem is the awful architecture with everything and the kitchen sink stuffed into some base class
and also from your article the guy reinventing a bad linked list instead of using the stl (which is something you could do in any other language too with equally bad outcome)

i thought this was the one where they implemented intrusive linked lists but nopeeee

FamDav
Mar 29, 2008
i honestly just like vim more than i like other text editors and i get irl pissy if i cant do every single vim command i use when editing text

FamDav
Mar 29, 2008

Symbolic Butt posted:

I don't do that but I know what you're saying, it's like this silly guy here: https://www.youtube.com/watch?v=YhqsjUUHj6g

i skimmed but he basically set up a vimrc and has a couple of plugins.

guy doesnt even have fugitive/git-gutter on there

FamDav
Mar 29, 2008
oh then lol.

i was put in charge of the default vimrc for work and it amounts to

the syntax highlighting/indenting/stuff on
tabs to spaces so you dont gently caress up our bespoke codebase
comma leader
double-j for exiting insert mode
semicolon to colon
unmap arrows :getin:

and if people get bored and want help then i show them how to set up vundle and go hog wild.

FamDav
Mar 29, 2008

It's like when they teach kids to ski without poles - if you never give them a crutch then they'll never learn to use it.

FamDav
Mar 29, 2008

Werthog 95 posted:

post ur vimrc

in fact somebody make a vim thread already

there's a vim thread in the CoC.

but sure

code:
" Environment {

   " Initialization {

      set nocompatible
      filetype off
      set rtp+=~/.vim/bundle/vundle/
      call vundle#rc()

   " }

   " Bundles {

      if filereadable(expand("~/.vimrc.bundles"))
         source ~/.vimrc.bundles
      endif

   " }

" }

" Settings {

   " Enable syntax and plugins
   syntax on
   filetype plugin indent on

   " Define colorscheme
   set background=dark
   colorscheme molokai

   " Convert tabs to spaces
   set expandtab

   " Do not create swap files
   set noswapfile

   " Use UTF for character encoding
   set encoding=utf-8

   " leave 3 lines between cursor and screen edge when scrolling
   set scrolloff=3
   
   " Copy indent from previous line
   set autoindent

   " Current mode appears at bottom of window
   set showmode

   " Show information about current command at bottom of window
   set showcmd

   " Show hidden characters
   set hidden

   " Completes to longest common command prefix and then allows
   " tabbing through commands
   set wildmenu
   set wildmode=longest:full,full

   " No audio bell
   set visualbell

   " Highlight current cursor line
   set cursorline

   " Helps with draw speed (?)
   set ttyfast

   " Gives cursor location in bottom-right-hand corner
   set ruler

   " Makes backspace work over auto-inserted indents and over line breaks
   set backspace=indent,eol,start

   " Always show status line
   set laststatus=2

   " Show invisible characters (?)
   "set list

   " Sets the list of invisible characters
   "set listchars=tab:▸\ ,eol:¬

   " Save files when focus is lost
   au FocusLost * :wa
   
   " Fold based on syntax of filetype
   set foldmethod=syntax

   " Auto-fold starting at the 8th ply
   set foldlevelstart=8
   
   " Text wrapping {

      " Automatically wraps texts after {textwidth} characters
      set wrap

      " Do not break mid-word
      set nolist
      set linebreak
      
      " Number of characters on a line before a line wrap is automatically
      " inserted
      set textwidth=79

      " q -> Allow formatting of comments with "gq"
      "
      " r -> Automatically insert current comment leader after hitting
      "        <Enter> in insert mode
      "
      " n -> When formatting text, recognize numbered lists.  This actually 
      "        uses the 'formatlistpat' option, thus any kind of list can be
      "        used.  The indent of the text after the number is used for the
      "        next line.  The default is to find a number, optionally followed 
      "        by '.', ':', ')', ']' or '}'.  Note that 'autoindent' must be 
      "        set too.  Doesn't work well together with "2".
      "        Example: >
      "           1. the first item
      "              wraps
      "           2. the second item
      "
      " 1 -> Don't break a line after a one-letter word.  It's broken before 
      "        it instead (if possible).
      set formatoptions=qrn1

      " Visualizes where textwrap will occur
      set colorcolumn=80

   " }

   " Search {

      " Ignore case in search when pattern is all lowercase
      set smartcase

      " Default to subsitute multiple times per line. Use g to
      " disable this behavior
      set gdefault

      " Highlights search results
      set hlsearch

      " Search as search string is typed
      set incsearch

      " Show search results as search string is typed
      set showmatch

   " }

   " Specifically for higher versions of VIM {

      if version >= 703
         " Default to relative numbering
         set relativenumber

         " Set absolute numbering in insert mode
         autocmd InsertEnter * :set number

         " Set relative numbering otherwise
         autocmd InsertLeave * :set relativenumber

         " Use an undo file
         set undofile
      endif

   " }

   " Plugin Settings {

      if filereadable(expand("~/.vimrc.plugins.settings"))
         source ~/.vimrc.plugins.settings
      endif

   " }

" }

" KeyBindings {

   " Global Leader Key
   let mapleader = ","

   " Rebind for leaving insert mode
   inoremap jj <ESC>
   
   " Rebind search to use magic mode
   nnoremap / /\v
   vnoremap / /\v

   " Removes highlighted search results
   nnoremap <leader><space> :noh<cr>


   " Unmap arrows {

      nnoremap <up> <nop>
      nnoremap <down> <nop>
      nnoremap <left> <nop>
      nnoremap <right> <nop>
      inoremap <up> <nop>
      inoremap <down> <nop>
      inoremap <left> <nop>
      inoremap <right> <nop>

   " }

   " Remap j/k to move by displayed lines {

      nnoremap j gj
      nnoremap k gk

   " }

   " fold ply
   nnoremap <leader>ff za
   
   " Strip trailing whitespace
   nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>

   " Shortcut for opening .vimrc in a new split
   nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>


   " Shortcut for new vertical split
   nnoremap <leader>w <C-w>v<C-w>l

   " Moving around splits {

      nnoremap <C-h> <C-w>h
      nnoremap <C-j> <C-w>j
      nnoremap <C-k> <C-w>k
      nnoremap <C-l> <C-w>l

   " }

   " have semicolon default to colon in normal and visual mode
   nnoremap ; :
   vnoremap ; :

   " Plugin Keybindings {

      if filereadable(expand("~/.vimrc.plugins.keybindings"))
         source ~/.vimrc.plugins.keybindings
      endif

   " }


" }

" Filetype Presets {

   " General {

      au BufRead,BufNewFile *.* set tabstop=3
      au BufRead,BufNewFile *.* set shiftwidth=3
      au BufRead,BufNewFile *.* set softtabstop=3

   " }

   " pro*C presets {

      au BufRead,BufNewFile *.pc set filetype=esqlc

   " }

   " YACC presets {

      au BufRead,BufNewFile *.ypp set filetype=yacc

   " }

   " Haskell presets {

      au BufRead,BufNewFile *.hs set tabstop=4
      au BufRead,BufNewFile *.hs set shiftwidth=4
      au BufRead,BufNewFile *.hs set softtabstop=4
      au BufEnter *.hs compiler ghc

   " }

   " OCAML presets {

      autocmd FileType ocaml source /Users/EddardFuckingStark/.opam/system/share/typerex/ocp-indent/ocp-indent.vim

   " }

" }
EDIT: There's at least one mislabeled setting. Can you find it?

FamDav fucked around with this message at 17:44 on Jun 24, 2013

FamDav
Mar 29, 2008

Symbolic Butt posted:

be consistent, use au or autocmd, not both

and there's no reason whatsoever for using these short not self-explanatory 2 letters commands in a loving config file.


also I'm Eddard *loving* Stark

i probably just copied those from configs for a plugin. also extra letters means extra time means closer to death

FamDav
Mar 29, 2008

Werthog 95 posted:

hey idiots just install the vim plugin for ur ide and ur set

i actually really hate these because they dont have full support for all vim commands and its like why reimplement what is already perfect

i do use vs for c# and id probably use idea for java if i coded java.

FamDav
Mar 29, 2008
whenever someone is having compiler issues in CoC and they mention they're using vs i just roll my eyes into the back of my head and imagine i'm on a beach

FamDav
Mar 29, 2008
I really like jj to ESC, and I globally remap capslock to ctrl because i'd like to have a functional pinky when im 40 and smashing on yalls kids in they college years

FamDav
Mar 29, 2008

OBAMA BIN LinkedIn posted:

i think this every time i debug boost code and thinking about how people even code like that

didnt tts work for that boost consultancy or whatever

FamDav
Mar 29, 2008
rip tts

FamDav
Mar 29, 2008

Nomnom Cookie posted:

it even has language support for maps (that's a computer scientist way of saying "hash table" for you p-langers) so if you're coming from a bad language you can just dive right in and poo poo out code like nobody's business

a) what language implements an associative container and calls it an hash table instead of a map?

b) all hash tables are maps, but not all maps are hash tables

c) i was curious what go's underlying implementation for map is and the spec doesnt even give algorithmic complexity for its operations. thanks rob.

FamDav
Mar 29, 2008
why cant they put that in their spec? i realize that the implementation of their map type is changing every day but i would appreciate it if i could just go read through the spec and have a general understanding of the performance characteristics of basic types.

FamDav
Mar 29, 2008

tef posted:

because it might be a property of the implementation, rather than the design :q:

FamDav
Mar 29, 2008
Can't you just use prolog

FamDav
Mar 29, 2008

just a butt posted:

I probably should have read the PL thread before post post posting cause they were literally talking bout cucumber which was what I was thinking about

green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke green as a cuke

FamDav
Mar 29, 2008
gently caress all of you

FamDav
Mar 29, 2008

Slaughterhouse-Ive posted:

i've dashed the hopes of many a self-proclaimed java expert with an h1-b by asking about type erasure

lol

they probably sewing nikes now

yospos bicth

FamDav
Mar 29, 2008
Lisp is a homo lang

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008
if i did it i would use c so i could just goto theEnd.

  • Locked thread