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
trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

fast fourier something or another

Adbot
ADBOT LOVES YOU

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
what have you done

salted hash browns
Mar 26, 2007
ykrop
why should i learn how to do any of these algorithms by hand if i can just call some library in tyool 2012 and not worry about it

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

trex eaterofcadrs posted:

fast fourier something or another

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

salted hash browns posted:

why should i learn how to do any of these algorithms by hand if i can just call some library in tyool 2012 and not worry about it

a library of graph algorithms is either really constraining or crazy unwieldy (cf. boost.graph)

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
does anyone here actually enjoy working with libboost for the sake of working with libboost

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

salted hash browns posted:

why should i learn how to do any of these algorithms by hand if i can just call some library in tyool 2012 and not worry about it

that knowledge means the difference between boiling the oceans trying to find a solution vs realizing you did dumb and choosing a better method

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Paracetamol Boy posted:

does anyone here actually enjoy working with libboost for the sake of working with libboost

that turkey story

Opinion Haver
Apr 9, 2007

salted hash browns posted:

why should i learn how to do any of these algorithms by hand if i can just call some library in tyool 2012 and not worry about it

i had to manually implement BFS a while ago at work

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.

yaoi prophet posted:

i had to manually implement BFS a while ago at work

what was it for?

(in case you don't lecture algorithms)

Zombywuf
Mar 29, 2008

Police Academy III posted:

what's ur fav A* variant mine is jump point search

This is really awesome. First the prisoners dilema and now this, I wonder what other solved-ish problems are going to be destroyed soon.

gangnam reference
Dec 26, 2010

shut up idiot shut up idiot shut up idiot shut up idiot
had to handwrite bfs :smithicide:

Opinion Haver
Apr 9, 2007

drat that's neat, might look into that for ~*my roguelike*~


Paracetamol Boy posted:

what was it for?

(in case you don't lecture algorithms)

can't say

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.

Zombywuf posted:

prisoners dilema

uh are you referring to tit-for-tat ipd because yeah that is really old

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.

ZYNGA STOCK CRASHER posted:

had to handwrite bfs :smithicide:

if i could choose which shortest-path alg to handwrite i'd probably go with bfs

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
graph traversal algorithms are not even a little bit hard to write, please stop complaining that you had to write one

Zombywuf
Mar 29, 2008

Paracetamol Boy posted:

uh are you referring to tit-for-tat ipd because yeah that is really old

I mean this: http://www.pnas.org/content/early/2012/05/16/1206569109.full.pdf

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
depends which one but the big 3 are write-offs

Shaggar
Apr 26, 2006

Otto Skorzeny posted:

a library of graph algorithms is either really constraining or crazy unwieldy (cf. boost.graph)

the one i used in java was ez and worked great.

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.

hehe pnas


(that is a nice paper, although it just seems like applied ipd strategies)

gangnam reference
Dec 26, 2010

shut up idiot shut up idiot shut up idiot shut up idiot
handwritin code just sucks is what im gettin at here

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
oh i thought you were working out the algorithm
but code is easy too
just a pain in the rear end

lovely third-world high school had a power failure during one of the final exams, so we had to code on paper
that was kind of sad

homercles
Feb 14, 2010

maybe i'll dig out CLR from my packed pile of books and look up fibonnaci trees again

actually no gently caress that

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
algorithms is a programming language

homercles
Feb 14, 2010

Lysidas posted:

make a genome read simulator/assembler

make a random string of 1000 A, C, G, T characters, pick 200 random locations in the first 950 characters of that string, and grab the next 50 characters from each of those locations

now put those 50-base pieces together into the origingood luck with that al sequence

figure out a way to measure how close your solution is to the original sequence

now make a new sequence that's 400 random nucleotides, 100 random nucleotides, the same 100 nucleotides that you just used, repeated and then 400 random bases

now read this into pieces and assemble them again and see how much worse you did


there's a lot of CS theory involved in this problem and the various ways to approach it. everyone should experience the sinking feeling of "i don't know enough theory to solve this problem effectively" at least once; makes you appreciate material that you might not otherwise find interesting

yeah suffix tries are drat hard. good stuff though. drat hard. if one wants to stop loving around with wankwork js bingo and learn some Hard Comp Sci this is a good problem to tackle

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
programming thread too heady today; have a joke program

code:

open MOVIES,"<","movies.txt" or die;

my @movies = <MOVIES>;
my @finishedflicks;

foreach (@movies) {
	chomp;
	my @flick = split(/ /,$_);
	foreach (@flick) {
		if (length($_) == 4){
			s/$_/Grok/;
			last;
		}
	}
	my $doneflick = join(" ",@flick);
	push(@finishedflicks, $doneflick);
}
foreach (@finishedflicks) {
next unless ($_ =~ m/grok/i);
s/\..*$//;
print "$_\n";
}

qntm
Jun 17, 2009

Jonny 290 posted:

programming thread too heady today; have a joke program

code:

open MOVIES,"<","movies.txt" or die;

my @movies = <MOVIES>;
my @finishedflicks;

foreach (@movies) {
	chomp;
	my @flick = split(/ /,$_);
	foreach (@flick) {
		if (length($_) == 4){
			s/$_/Grok/;
			last;
		}
	}
	my $doneflick = join(" ",@flick);
	push(@finishedflicks, $doneflick);
}
foreach (@finishedflicks) {
next unless ($_ =~ m/grok/i);
s/\..*$//;
print "$_\n";
}

stopped reading at the bareword filehandle

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
:supaburn: oh god he didnt use strict and warnings!!!!! :supaburn:

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
YOU MONSTER

jooky
Jan 15, 2003

nice grok

EVGA Longoria
Dec 25, 2005

Let's go exploring!

Jonny 290 posted:

:supaburn: oh god he didnt use strict and warnings!!!!! :supaburn:

jonny nooooo :(

use strict
use warnings

every time

homercles
Feb 14, 2010

Jonny 290 posted:

programming thread too heady today; have a joke program

code:
Perl code that I dislike

Line 1: global typeglobs, is he for real? this isn't 1995

Line 3: ok use a slurp lib, File::Slurp or Perl6::Slurp

Line 8: there's 2 things wrong with this line. You really want to be splitting on all whitespace, so C<split ' ', $_> is the preferred form. This is a SPECIAL form of split, it splits out multiple whitespace and fucks off the newline at the end rendering the chomp at line 7 superfluous. The form you want though is just plain C<split>, that uses $_ and splits on the special ' ' pattern (perldoc split, read it). Also, why the unnecessary brackets? This isn't lisp, you're kirk coding with all this unnecessarily punctuation (just made that term up)

Line 11: Not a good approach, most performant is to useuse substr+index. If you don't want to and prefer to be lazy, you're still critically wrong. If $_ contained special regex patterns (like '(') your program would die. If you really want to do that, use the form C<s/\Q$_\E/Grog/> or more simply C<s/\Q$_/Grog/>. Furthermore you're compiling new regexes with every iteration so if you care about performance (oh wait it's perl no-one cares) one would be using substr with index

Line 12: what's with your 8tab whitespace fetish, you could compress that to C<s/\Q$_/Grog/, last if 4 == length;>

Line 8-15: This entire block can be replaced with a regex. C<s/ \b \S{4} \b /Grok/x>

There's more, the entire file is quite broken. You're programming Perl like it was C. You need to learn more Perl!

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
everyone needs to learn more perl imho

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
works fine on my end bro, that's cool though
i know i can golf it down but wanted to make a joke post in a joke forum as fast as i could. :)



oh also its not 1995

its 1998


code:
This is perl, version 5.004_05 built for PA-RISC2.0

Copyright 1987-1998, Larry Wall

Jonny 290 fucked around with this message at 20:33 on Sep 20, 2012

Shaggar
Apr 26, 2006

rotor posted:

everyone needs to learn more perl imho

this but java or c# and never a p language. not even once

homercles
Feb 14, 2010

Shaggar posted:

this but java or c# and never a p language. not even once
this but scala

homercles
Feb 14, 2010

Jonny 290 posted:

i know i can golf it down but wanted to make a joke post in a joke forum as fast as i could. :)
golfing is about reducing code size at the possible cost of understandability. you're doing the anti-golf by increasing code size while definitely reducing understandability. what's that called, java'ing?

itt i get emotional about perl

Bird Priest
Jun 22, 2009

I have free will to do what I want but I choose to oscillate.
its called compiling

EVGA Longoria
Dec 25, 2005

Let's go exploring!

jonny for the simple stuff you're doing with that array, try map.

Perl code:
#!/usr/bin/env perl
use strict;
use warnings;
use Modern::Perl;

open my $MOVIES,"<","movies.txt" or die;
my @finishedflicks; 

for my $movie (<$MOVIES>) {
	my @holding = split(/ /, $movie);
	my @results = map { length($_) > 4 ? 'Grok' : $_ } @holding;
	push(@finishedflicks, join(" ", @results));
}

for (@finishedflicks) {
	$_ =~ s{\..+$}{};
	say $_;
}

Adbot
ADBOT LOVES YOU

EVGA Longoria
Dec 25, 2005

Let's go exploring!

ps you can remove modern::perl and use "print "$_\n" but gently caress that noise

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