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.
 
  • Post
  • Reply
text editor
Jan 8, 2007

Dr. Honked posted:

drat i never thought about it that way.. all those great programmers who have slipped through my fingers....

if i can typing at 105wpm then any one-liner i write is just letting my typist skills languish

Adbot
ADBOT LOVES YOU

text editor
Jan 8, 2007
the best programming language is all of them, because anyone who has mastered the magic of CORBA can freely write his individual services in whatever language sounds good right now

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



objective c best c

GameCube
Nov 21, 2006

i liked objective c in school but i feel like i wouldn't have understood it as well if i didn't already know c

Inverse Icarus
Dec 4, 2003

I run SyncRPG, and produce original, digital content for the Pathfinder RPG, designed from the ground up to be played online.

Werthog posted:

welp have fun working at best buy again

abraham linksys
Sep 6, 2010

:darksouls:
horns.aiff

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Anal Tributary posted:

_.each(string.split(""), function(char) { counts[char] = counts[char]+1 || 1 }); is a cool one-liner but it's not like there's anything with just using a for loop

one liners are masturbation

code:
_.chain("abcaddaaaa".split(""))
 .groupBy(_.identity)
 .each(function (v,k) { 
	console.log(k+' = '+v.length); });

NeoHentaiMaster
Jul 13, 2004
More well adjusted then you'd think.
code:
my $string = "sdfk2kfjdsk4jdofidvlb"; my $char_counts = {}; $char_counts->{$_}++ for split("", $string); print Dumper $char_counts
Can I have a programming job now this sysadmin things getting old.

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

Anal Tributary posted:

_.each(string.split(""), function(char) { counts[char] = counts[char]+1 || 1 }); is a cool one-liner but it's not like there's anything with just using a for loop

stop trying to shoehorn imperative code into fp


_.map(
  _.groupBy(s.split(''), _.identity),
  function(e){
    return {letter:e[0], count:e.length};
  }
)


or u can chain it like what t-rex said yea

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Shaggar posted:

oh yeah? whats the difference?
a map is implemented using trees (typically binary)

a dictionary is implemented using hash tables

both a map and a dictionary are associative containers.

there is no such thing as an "associative array".

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Janin posted:

there is no such thing as an "associative array".

there is in php.

That Turkey Story
Mar 30, 2003

I like C++.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Janin posted:

a map is implemented using trees (typically binary)

a dictionary is implemented using hash tables

both a map and a dictionary are associative containers.

there is no such thing as an "associative array".

i'm sure you are aware that java has treemap and hashmap for those distinctions

That Turkey Story
Mar 30, 2003

Anal Tributary posted:

i don't get java and c++ folks

i mean if its web stuff just use python or ruby?

if its local stuff that has to go fast use go, or maybe rust?

it boggles teh mind

lol yeah, okay

Sneaking Mission
Nov 11, 2008

That Turkey Story posted:

I like C++.

check his post count guys i think hes trolling

coaxmetal
Oct 21, 2010

I flamed me own dad

Janin posted:

a map is implemented using trees (typically binary)

a dictionary is implemented using hash tables

both a map and a dictionary are associative containers.

there is no such thing as an "associative array".

Wikipedia says all of them are the same thing owned

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
The thing that most boggled my mind when i learned basic C++ is what you do if you want to define special behaviour of the postincrement and preincrement operators for your custom datatype.

you can define both, but because just writing "function ++ ()..." or whatever (i cant remember the syntax and dont care) would be ambiguous which one you meant, they are distinguished by the rule that for one of them you pass the method no parameters and for the other one you pass an unused integer parameter.

i want to know who in the gently caress came up with that and was it a joke that got taken seriously.

tef
May 30, 2004

-> some l-system crap ->
code:

$ echo -n 'lolbtuts' | sed -e 's/\(.\)/\1\
/g'| grep -v '^$' | sort | uniq -c
   1 b
   2 l
   1 o
   1 s
   2 t
   1 u
uniiiiiiixixixixixiixix

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



NSString *bah = @"figvdfivdafvdafv fd gvdair fgeifv sivfs fuwf FUAS ";
NSMutableDictionary *counts = [NSMutableDictionary dictionary];

[bah enumerateSubstringsInRange:NSMakeRange(0, [bah length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
NSUInteger val = ([counts objectForKey:substring] != nil ? [[counts objectForKey:substring] intValue] : 0) + 1;
[counts setObject:[NSNumber numberWithInt:val] forKey:substring];
}];

NSLog(@"counts: %@", counts);

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
php:
<?
foreach (str_split($thestring) as $letter) $pieces[$letter]++;
var_dump($pieces);?>

That Turkey Story
Mar 30, 2003

It's amazing how many bad programmers get upset you break it to them that C++ is actually a great language.

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

every criticism of c++ is literally "bloo bloo syntax"

coaxmetal
Oct 21, 2010

I flamed me own dad

Carthag posted:

NSString *bah = @"figvdfivdafvdafv fd gvdair fgeifv sivfs fuwf FUAS ";
NSMutableDictionary *counts = [NSMutableDictionary dictionary];

[bah enumerateSubstringsInRange:NSMakeRange(0, [bah length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
NSUInteger val = ([counts objectForKey:substring] != nil ? [[counts objectForKey:substring] intValue] : 0) + 1;
[counts setObject:[NSNumber numberWithInt:val] forKey:substring];
}];

NSLog(@"counts: %@", counts);

hahaha



I was gonna try to do it in prolog for shits and giggles but then I decided I didn't really want to remember how to do prolog.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Sweevo posted:

every criticism of c++ is literally "bloo bloo syntax"

its a legitimate complaint in cases where the syntax literally makes no goddamn sense at all

coaxmetal
Oct 21, 2010

I flamed me own dad
yea I don't know C++ very well but if a language has lovely syntax thats a pretty good reason not to like it, just in general.

coaxmetal
Oct 21, 2010

I flamed me own dad
like php, it has confusing and inconsistent syntax

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Sweevo posted:

every criticism of c++ is literally "bloo bloo syntax"
same as perl

it turns out that some syntaxes are bad and c++ and perl have bad syntaxes

ppp
Feb 13, 2012

by angerbot
perl has good syntax

tef
May 30, 2004

-> some l-system crap ->
c++ is great it makes tts write effort posts apologising for the state of generic programming

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy
did u know: template metaprogramming is turing-complete

code:
#include <iostream>

template <int N> struct Factorial
{
    enum { val = Factorial<N-1>::val * N };
};

template<>
struct Factorial<0>
{
    enum { val = 1 };
};

int main()
{
    // Note this value is generated at compile time.
    // Also note that most compilers have a limit on the depth of the recursion available.
    std::cout << Factorial<4>::val << "\n";
}

post hole digger
Mar 21, 2011

Ronald Raiden posted:

Wikipedia says

Dr. Honked
Jan 9, 2011

eat it you slaaaaaaag
html is the best programming language. whenever i get a resume with "Programming languages known: HTML" written on it i just get my cock out then and there and jizz all over the place and hire the person

post hole digger
Mar 21, 2011

HTML5.....the future is now....

coaxmetal
Oct 21, 2010

I flamed me own dad

nightwheat stalker posted:



u got teh joek

post hole digger
Mar 21, 2011

Ronald Raiden posted:

u got teh joek

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

i barely GNU her! posted:

did u know: template metaprogramming is turing-complete


so is the haskell type inference algorithm, but i don't have a cool proof program to show off

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Dr. Honked posted:

html is the best programming language. whenever i get a resume with "Programming languages known: HTML" written on it i just get my cock out then and there and jizz all over the place and hire the person

html is a programming language

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Tiny Bug Child posted:

html is a programming language

holy poo poo

ppp
Feb 13, 2012

by angerbot
nice i figured out how to make synergy work on debian so i can log in "remotely"

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

i barely GNU her! posted:

did u know: template metaprogramming is turing-complete

man if only i could do that with other languages

code:
class Integer
  def factorial
    (1..self).inject(:*)
  end
end

cprog = <<EOF
#include "stdio.h"
int main() {
  puts("#{4.factorial}");
  return 0;
}
EOF

File.open('/tmp/prog.c', 'w'){|f| f.write cprog}
`cc -o /tmp/prog /tmp/prog.c`
File.delete '/tmp/prog.c'

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply