[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 316
Thread images: 40

File: kumiko3.jpg (97KB, 1280x720px) Image search: [Google]
kumiko3.jpg
97KB, 1280x720px
old thread: >>56190217

What are you working on, /g/?
>>
>>56196196
First for D
>>
Second for D#
>>
Third for E
>>
Fourth for F
>>
File: 1459027139487.jpg (648KB, 1500x2023px) Image search: [Google]
1459027139487.jpg
648KB, 1500x2023px
Is there a smaller encoding than ascii? I want to create a file as small as possible. The file contains integer sequences.
>>
>>56196253
Gzip.
>>
>>56196255

You could always create one.
>>
>>56196255
>is there a smaller encoding than 1 byte encoding.

Honestly, if you only care about retaining letters and newlines, you could probably compress 2 letters per byte by bitwise ORing them together.
It certainly wouldn't be worth your time tho.
>>
>>56196294
How would that work?
>>
Can you cast the generic of a List in java?

Let's say I have an ArrayList<Player> and Player implements the interface Character, can I cast it into and ArrayList<Character>?
>>
File: spain.png (2KB, 402x402px) Image search: [Google]
spain.png
2KB, 402x402px
Post the last piece of code you wrote
>>
>>56196255
I guess you are having a brainfart. Ever heard of compression?
>>
>>56196442
I can't under NDA
>>
Please teach a retard how to vim. I'm trying to copy a line and paste it 10 times. I copy it with ^v$y which works fine, but as for pasting it on a new line here are my best guesses:

o<esc>p10. -- Doesn't work because o and p are separate commands so i can't simply use . to repeat.
qqo<esc>p10@q -- Doesn't work, gives o^[p 10 times instead of the text I have copied.

I'd love some guidance of how I can make either of these work.
>>
>>56196442

>>
>>56196371
You could turn the most essential ASCII symbols into a base 36 number

you know what nevermind, that'd take 6 bits.
>>
>>56196255
if there are only integers don't encode it as text at all you schmuck, use integer types
>>
>>56196410
No.
>>
>>56196466
vimtutor
>>
Curious what people think of this function.

//Assumes ASCII and C-style string
std::string get_extension(char* &string, bool make_upper = false) {
int length = strlen(string)-1;
auto read_pos = length;
for (;read_pos >= 0; --read_pos) {
if (string[read_pos] == '.') {
++read_pos;
break;
}
if (string[read_pos] == '\\' || string[read_pos] == '/') {
read_pos = -1;
break;
}
}
std::string ext;
if (read_pos == -1)
return ext;
ext.resize((length + 1) - read_pos);
int write_pos = 0;
//maybe make into one loop again
if (make_upper) {
for (; read_pos <= length; ++write_pos, ++read_pos)
ext[write_pos] = string[read_pos]^0b00100000;
}
else
{
for (;read_pos <= length; ++write_pos, ++read_pos)
ext[write_pos] = string[read_pos];
}
return ext;
}
>>
>>56196520
The file size was over two times smaller, you idiot. With ascii, I don't need to store spaces, because every number is a single character.
>>
>>56196466
yy10p
>>
What is the result of 14 AND 13 and why is it 12?
>>
>>56196571
strlen is
 size_t 
not int
>>
>>56196586
>The file size was over two times smaller
If you use the right integer types according to the size of your values, it can't be
>With ascii, I don't need to store spaces
er, what?
>>
>>56196591
Cheerios m8. That makes a lot of sense, copies the \n so it's just a matter of pasting 10 times.
>>
>>56196606
14 = 1110b
13 = 1101b
14 & 13 = 1100b = 12
>>
File: 1470886525874.jpg (74KB, 720x783px) Image search: [Google]
1470886525874.jpg
74KB, 720x783px
>>56196196
I'm trying to do the second exercism.io challenge in C, which is an anagram finder, here is one of the tests they provide:

void test_detect_simple_anagram(void) {
int x;
char inputs[][MAX_STR_LEN] = {
"tan",
"stand",
"at"
};

char outputs[][MAX_STR_LEN] = {
"tan"
};
int outputs_len = sizeof(outputs)/MAX_STR_LEN;

struct Vector vin = {
inputs,
sizeof(inputs)/MAX_STR_LEN
};

struct Vector vout = anagrams_for("ant", vin);

TEST_ASSERT_EQUAL(outputs_len, vout.size);
for (x = 0; x < vout.size; x++) {
TEST_ASSERT_EQUAL(strlen(outputs[x]), strlen(vout.vec[x]));
TEST_ASSERT_EQUAL_MEMORY(outputs[x], vout.vec[x], strlen(outputs[x]));
}

free(vout.vec);
}


And here is my code so far
#include <stdio.h>
#include <string.h>
#include "anagram.h"

struct Vector anagrams_for(char *word, struct Vector list)
{
int len = strlen(word), begin = 0, counter = 0, k = 0;

for (int i = 0; i < list.size; ++i)
strlen(list.vec[i]) == len ? begin = i : 0;

for (int i = 0; i < strlen(list.vec[begin]); ++i)
{
for (int j = 0; j < len; ++j)
{
if (word[k] == list.vec[begin][j])
{
++counter;
++k;
}
}
}

if (counter == len)
{
puts(word);
puts(list.vec[begin]);
}

return list;
}


I'm pretty sure I can find anagrams, but every time I try to modify list.size to set it to the answer, it segfaults.
Wat do?
>>
>>56196571
Could be a whole lot shorter my friend.
>>
>>56196608
The result can be assumed to fit in an int, and I'm using the unlikely (but possible) event of a negative number, later on.
>>
>>56196571
Calling a parameter string is just confusing in context of C++, use str or something else.

I would just return a pointer to the start of the suffix, or to the null terminator if none is found.
Avoids making unnecessary copies.

Making the suffix uppercase seems redundant, just do a case insensitive compare.

Use string::substr.
>>
>>56196699
How?
>>
>>56196571
Can't it be simplified like this?

std::string get_extension(char * &str, bool upper = false)
{
auto len = strlen(str) - 1;
auto ptr = strchr(str, '.');
if (!ptr) {
return {};
}

std::string ext{ptr};
if (upper) {
std::transform(ext.begin(), ext.end(), ext.begin(), [](unsigned char c) {
return std::toupper(c);
});
}

return ext;
}
>>
Fuck I thought C++11 wasn't a meme, but <random> gives me a similar first random number every time I run this program. Any way to make sure the first number is more random?

http://pastebin.com/9TgtGfcG
>>
>>56196787
Are you running it more than one second apart? Do you have hardware RNG? Could try seeding with ns/ms from chrono as well.
>>
>>56196442
Small finite state machine for my purposes.
import {SetMap} from './util'

type StateHanler = (arg?: any) => void

// Finite State Machine
export default class FSM<S, E> {
stateHandlers: SetMap<StateHanler> = new SetMap<StateHanler>()
transitions: {[transition: string]: (arg?: any) => S} = {}
wilds: {[event: string]: (arg?: any) => S} = {}
state: S

// Create a new finite state machine with the supplied start state
constructor(start: S) {
this.state = start
}

// Assign a handler to be execute on arrival to a new state
on(state: S, handler: StateHanler) {
this.stateHandlers.add(state as any, handler)
}

// Specify state transition and a handler to execute on it. The hendler must
// return the next state of FSM.
act(start: S, event: E, handler: (arg?: any) => S) {
this.transitions[this.transitionString(start, event)] = handler
}

// Specify an event and handler, that will execute, when this event is fired
// on any state.
wildAct(event: E, handler: (arg?: any) => S) {
this.wilds[event as any] = handler
}

// Generate a transition string representation
transitionString(start: S, event: E): string {
return `${start}+${event}`
}

// Feed an event to the FSM
feed(event: E, arg?: any) {
let result: S
if (event as any in this.wilds) {
result = this.wilds[event as any]()
} else {
const transition = this.transitionString(this.state, event)
result = this.transitions[transition]()
}
this.stateHandlers.forEach(result as any, fn =>
fn(arg))
this.state = result
}

// Returns a function that executes FSM.prototype.feed with the passed
// argument
feeder(event: E): StateHanler {
return arg =>
this.feed(event, arg)
}
}

>>
>>56196836
What language is that?
>>
>>56196442
#!/bin/env python
string = input("Type some words: ")

print("Now to reverse your words...")

print(string[::-1])


It was an exercise. I haven't touched Python2 in a long time, and have only slightly dabbled with Python3.
>>
>>56196802
This is just a short code snippet to show my problem. I am calling the random method several times a second. Seeding different numbers manually resulted in marginally different first randoms, but I will try using ns.
>>
>>56196787
#include <algorithm>
#include <iostream>
#include <random>

std::mt19937 RandomlySeededMersenneTwister ()
{
// Magic number 624: The number of unsigned ints the MT uses as state
std::vector<unsigned int> random_data(624);
std::random_device source;
std::generate(begin(random_data), end(random_data), [&]() {
return source();
});
std::seed_seq seeds(begin(random_data), end(random_data));
std::mt19937 seededEngine (seeds);
return seededEngine;
}


int main()
{
auto rng = RandomlySeededMersenneTwister();
for (int i = 0; i < 10; ++i) {
std::cout << rng() << "\n";
}
}
>>
>>56196845
TypeScript.
>>
>>56196777
Wouldn't strchr return the wrong result if there's a . in the path? That's why I'm reading backwards from the end and stopping at "." "/" or "\".

I'm trying to remember why I had the upper conversion being done during the copy. All the reads and writes will probably be performed on one cache line, or at worst have to be fetched from another cache level. I don't know, I'll think about that.
>>
>>56196923
Then you can use strrchr.
>>
>>56196571
incorrect since a linux file can have many extensions
>>
>>56196836
>
StateHanler

m80
>>
>>56196965
Thanks for the catch.
>>
>>56196634
Just tried, size is still two times smalles. '14' is two characters decimal, while it is only one in ascii.
>>
>>56196586
You know you can store an array of integers directly to file right?
>>
>Learning my first programming language (c#)
>Try to follow book
>Nothing working out
>Decide to start with very fundamentals, try hello world program
>fail
I've never felt so stupid and out of my element in my life. Is learning your first language supposed to be this hard from the very get go?
I don't even know what the fuck I'm doing with the IDE
>>
>>56196688
Where are you modifying the list size?
>>
>>56196923
Actually, as I write this I realize I ought to just return a pointer and skip the copy to string entirely, as it's just discarded shortly afterwards.

Checking if it's empty is just a simple nullptr check.
>>
>>56196951
What do you mean?
>>
File: 1453729782379s.jpg (3KB, 125x125px) Image search: [Google]
1453729782379s.jpg
3KB, 125x125px
>>56197068
The first time is always the most painful, but it starts to hurt less after a while.

Just keep at it.
>>
>>56196951
Sure but any sane program would deal with only one extension.
For example gzip does not care about .tar and tar does not care about .gz
>>
>>56197137
tar calls the appropriate compression utility if you add a flag.
>>
>>56197068
learning your first programming language with an IDE is not a good idea, and im pretty sure c# is pretty heavily oriented towards IDE use..

maybe try learning how to use a command line first, then try something like python for programming fundamentals

it might seem like youre wasting your time at first but i think itll make the process easier overall and you wont be a slave to a single platform/IDE
>>
>>56197068
C# can be pretty complex at times. Just don't give up.
>>
>>56197118
>>56197165
thanks anons, I'll keep at it
>>
>>56197164
True.
If you really need to handle multiple extension just call the function multiple times.
>>
>>56196442
trait Foo {
fn foo(self) -> Self;
}

impl Foo for u64 {
//Can also write fn foo(self) -> Self
fn foo(self) -> u64 {
self + 1
}
}

fn main() {
let x = 1u64.foo();
println!("{}", x) // 2
}


I was explaining an anon in a different thread the difference between self and Self.
>>
>>56197043
we are clearly talking about the same thing, you are just a bit confused. ASCII is a text encoding, not a number encoding
>>
>>56196255
Just write it out as is, as binary data.
>>
I really want to know the ins and outs of computer hardware and programming.

Is C sufficient for this or would I benefit more from Assembly?
>>
What's a good SQL/database design book? I know the basics (CRUD SQL statements and stuff) but want to go a little more intermediate.
>>
>>56197068
no. Start with some simple language like Logo, Haskell or BASIC instead of a pile of compatibility layers.
>>
File: there.gif (136KB, 447x437px) Image search: [Google]
there.gif
136KB, 447x437px
>>56196442
>>
>>56196442
branch    : KW_IF expr stmt                {$$ = new if_stmt($2, $3);}
| KW_IF expr stmt KW_ELSE stmt {$$ = new if_stmt($2, $3, $5);}
;
>>
>>56197187
Should I be using base64 or something else?

>>56197214
How do I seperate the values that way?
>>
File: 1471477689849.png (311KB, 652x669px) Image search: [Google]
1471477689849.png
311KB, 652x669px
>>56196442
gfgfg
>>
>>56197216
If you haven't learned basics of C you shouldn't try to learn Assembly.
>>
>>56196255
...just encode them in binary coded decimal. 1 byte is 2 digits

0000 : 0
0001 : 1
0010 : 2
...
1001 : 9
1010 : 10

Of course, if you're just using integers....just save them as bits. To store a 32 bit integer, you require 4 bytes normally, but 5 bytes with BCD. To store a 64 bit integer, you require just 8 bytes. Or 10 bytes with BCD.
>>
File: 1468950166190.jpg (37KB, 480x360px) Image search: [Google]
1468950166190.jpg
37KB, 480x360px
>Program bugged, search almost an hour for cause
>Simply forgot to include the breaks in a switch
>>
>>56197256
You made a calculator on top a bloated interpreted scripting language?
>>
File: 9ewzVi3.jpg (43KB, 500x402px) Image search: [Google]
9ewzVi3.jpg
43KB, 500x402px
>>56197068
just learn Python, it's not even programming, it's like writing english

here's a good book to get you started:
>http://python.swaroopch.com/

it's free and all that
>>
>>56197293
no, it's an interview question or something

in this pic >>56197279

I'm still a noob so
>>
>>56196442
>>
File: 094748b2d3.png (24KB, 910x374px) Image search: [Google]
094748b2d3.png
24KB, 910x374px
>>56196442
Pic related, LINQ is GOAT.
>>56196196
I need a template to build my CV, anyone got one? I can't find one that doesn't looks like shit.
>>
>>56196571
Simplified version, for the hell of it. The calling function either figures out what to do with a given extension, or if there isn't one, checks the file for known headers.

char* get_extension(char* &str) {
char* ext_pos = nullptr;
int length = strlen(str)-1;
auto read_pos = length;
for (;read_pos >= 0; --read_pos) {
if (str[read_pos] == '.') {
++read_pos;
ext_pos = &str[read_pos];
break;
}
if (str[read_pos] == '\\' || str[read_pos] == '/')
break;
}
return ext_pos;
}


Thanks for the feedback.
>>
>>56197277
>How do I seperate the values that way?
Depending on how your values are layed out, if you have fixed number of integers per row, you could just include as the first integer in the file how many integers per row there is.
Alternatively, you could have your integers in chunks of variable size, like this but in binary:
<size-specifier> <array of ints ..>

where the array of ints contains size-specifier number of ints for that row.
Only 1 or 2 bytes of overhead, depending on how many integers per row you can have, if you don't expect row sizes over 255, you can get away with having the size specifier be a single byte, otherwise 2 bytes (16 bit) is probably your best bet, unless you expect row sizes over 65535, in which case you'd have to go with 4 bytes (32bits) or even 8 bytes (64bits).
>>
Are there any good interpreted (JIT or parsing), procedural languages without OOP cancer? Also no lisps because of the syntax.

Do I have to write my own?
>>
>>56197403
Lua.
>>
File: 1362290875714.jpg (2MB, 1920x1080px) Image search: [Google]
1362290875714.jpg
2MB, 1920x1080px
>>56197292
>his language does not include breaks by default
>>
File: 21 1.jpg (8KB, 300x300px) Image search: [Google]
21 1.jpg
8KB, 300x300px
>>56196442
import requests
import random
import os, os.path
from time import sleep
import stat
import pyautogui

x = 1

user = os.environ['USERPROFILE']
desktop = user + '\desktop'

#Deletes all files
def rmtree(top):
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
try:
filename = os.path.join(root, name)
if user + '\\AppData' in filename:
continue
else:
os.chmod(filename, stat.S_IWUSR)
os.remove(filename)
print('file removed')
except:
print('Permission denied...')
sleep(1)
continue
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(top)

#Downloads random pics, puts ten randomly on desktop
def createFile(x):
#these were links but 4chins thinks it's spam
pics = [r'link 1',
r'link 2',
r'link 3',
r'link 4',
r'link 5',
r'link 6',
r'link 7',
r'link 8']
os.chdir(desktop)
with open(str(x) + '.jpg', 'wb') as f:
f.write(requests.get(random.choice(pics)).content)
print('pic made')
x += 1

#moves the mose and holds it down
def mClick(x, y):
pyautogui.moveTo(x, y)
pyautogui.mouseDown()


>>
>>56197356
BUILD WALL
>>
>>56197290
>binary coded decimal
>1010 : 10
fial.
10decimal: 0001 0000
>>
>>56197419
Do you need your hand held through everything in life?

I bet you like femdom.
>>
>>56197417
Lua has OOP cancer. Same as PHP. Without OOP they would be great languages.

AFAIK the only good languages that fit this category are interpreted or JIT'd C languages, like fucking holyc.
>>
>>56197426
It's not like I wanna live in the US.
>>56197403
>procedural languages without OOP cancer
Why so autist?
>>
>>56197423
>dem indentations
kys
>>
>>56197419
Why does anyone need that many smug anime faces?
>>
>>56197320
Oh, rate mine
int product(int a, int b){
char sign = 1;
if(a<0 ^ b < 0)
sign = -1;
int prod = 0;
for(int i = 0;i<abs(b);i++)
prod+=abs(a);
return prod/sign;
}


They didn't say anything about the / operator.
>>
>>56197450
Sorry to break it to you but C has OOP.
And Lua has OOP about as much as C has OOP.
>>
File: 1468778079286.jpg (195KB, 804x720px) Image search: [Google]
1468778079286.jpg
195KB, 804x720px
Who OOP masterrace here?
>>
>>56197450
Also, neither C or Lua force you to use OOP, neither do most scripting languages.
You're just a fucking retarded autist.
>>
>>56197444
It simply makes no sense to have breaks by default. In most cases you do not want to fall through. In cases when you do, it can be stated explicitly.

And yes, I like femdom.

>>56197468
That image is around 5 years old. There are probably a lot bigger versions by now.
>>
>>56197459
>Why so autist?
I learned programming via Java, but C taught me everything I knew was fucking wrong when it came to program design. When I look back, OOP is a fucking cluttered mess and I don't want it.

Functional programming languages and "le eliminating the state" meme are all right, but what I really want is a down to earth interpreted or JIT C, where I can eval and apply.
>>
>>56197450
>Without OOP they would be great languages
>Lua arrays start from 1
>>
>>56197501
Are we talking optional OOP or one of those curry languages that force everything to be a class?
>>
>>56197506
Sure, they don't force you to do anything. But the fucking pooinloos who write libraries for Lua and say, Python, really like to fuck you over with the OOP.
>>
File: 1426216174250.gif (2MB, 320x362px) Image search: [Google]
1426216174250.gif
2MB, 320x362px
>>56197523
You need to go all the way dude
Never go half retard
>>
>>56197279
a = int(input('Enter first int: '))
b = int(input('Enter second int: '))
answer = 0
for i in range(b):
answer += a

print(answer)

For anyone who wants to know how to do it
>>
>>56197508
Didn't you just mock someone for not using a language that includes breaks by default? And now you're saying there really is no reason to have them by default.
>>
>>56197501
OOP is a nice meme, why don't you write a real program using OOP. We'll see if your code is left with a God object or some spaghetti intercalling mess that goes against all principles of OOP.
>>
>
function qsort(xs) {
if (xs.length == 1) return xs;
var x = xs[0],
smaller = xs.filter(a => a < x),
bigger = xs.filter(a => a >= x);
return qsort(smaller) + [x] + qsort(bigger);
}

>too much recursion

ahhahahahahaahaha, js is shit lmao
>>
>>56197551
Sorry, missed a "not" in that sentence. It's late or some other similar retardation excuse.
>>
File: zilcmre.jpg (73KB, 640x480px) Image search: [Google]
zilcmre.jpg
73KB, 640x480px
Lemme ask this again because the .NET indians shat all over my question:

Are there any good interpreted (JIT or parsing), procedural languages without OOP cancer? Also no lisps because of the syntax.

Do I have to write my own?
>>
>>56197463
What do you mean? That's the only way it can be indented you fucking cuck, don't talk shit unless you know what the fuck you are talking about
>>
>>56197546
Doesn't work if b is negative.
>>
>>56197579
Tail call optimization soon.
>>
>>56197584
JavaScript. Prototypical OOP + functional is comfy.
>>
>>56197587
>hurr durr hadooken indentation is the only way
kys
>>
File: pygame.png (197KB, 1904x1012px) Image search: [Google]
pygame.png
197KB, 1904x1012px
Is python finally done killing itself with the 2/3 split and the yet another packaging system?
>>
>>56197508
>And yes, I like femdom.

Who doesn't?

>>56197558
>God objects are bad

That's a meme.
>>
File: 1407168530486.gif (82KB, 500x404px) Image search: [Google]
1407168530486.gif
82KB, 500x404px
S-Someone pls rate my code
http://pastebin.com/Vci9AQRB
>>
>>56197660
tl;dr
>>
File: 1424373679482.jpg (19KB, 160x160px) Image search: [Google]
1424373679482.jpg
19KB, 160x160px
>>56197668
I-It's a battleship game
>>
File: stabbers.jpg (109KB, 650x650px) Image search: [Google]
stabbers.jpg
109KB, 650x650px
QUICK, MAKE A PROGRAM THAT REVERSES THE WORDS IN A STRING OR STABBY THE BIRD IS GUNNA FUCK YA
>>
>>56197654
>bad program design is a meme
okay.
>>
>>56197660
overly complicated, have you even heard about object oriented programming?
>>
>>56197660
>Python
Stopped reading there.
>>
>>56196442
Console.WriteLine("Hello, World!");
>>
>>56197546
If you want the job john it has got to support any real number, that include fractional numbers
>>
>>56197702
#!/bin/bash
echo $@ | rev
>>
File: Screenshot_2016-08-21_15-06-31.png (146KB, 501x261px) Image search: [Google]
Screenshot_2016-08-21_15-06-31.png
146KB, 501x261px
>>56197702
>>
>>56197584
Julia, its blazing fast, psuedo-code like syntax (ie like Python, Ruby), has a strong set of system level libraries, doesnt tie you down to any kind of OO
>>
>>56197702
fn reversed(s: &str) -> String {
s.chars().rev().collect()
}

fn main () {
println!("{}", reversed("!drib ybbats ,em bats t'nod esaelP"));
}
>>
>>56197702
' '.join([a[::-1] for a in str.split(' ')])
>>
>>56197702
Just use php.
It's so bloated that there's probably already a function to do that.
Just googled it, literally just strrev();
>>
>>56197709
ok NEET
>>
>>56197741
I think he means reverse the word order.

So "a b c" would become "c b a".
>>
any language that isn't a meme?

>>56197702
reverse  = foldl (flip (:)) []
>>
>>56197660
use docstrings. Document which directions on screen means increasing the first/second indexes in your arrays.
>#changes refcoor
that's not a useful comment. Which direction? What does it mean in the user's language?
>#same
lol save yourself the typing

also tldr
>>
>>56197761
Well that can be done too.
' '.join(str.split(' ')[::-1])

t.
>>56197751
who apparently has to write his own programming language
>>
File: Screenshot_2016-08-21_15-10-30.png (179KB, 867x182px) Image search: [Google]
Screenshot_2016-08-21_15-10-30.png
179KB, 867x182px
>>56197702
>>56197761
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *stack[500];
int top = 0;

void push(char *str)
{
stack[top] = (char *) malloc(strlen(str) + 1);
strncpy(stack[top], str, strlen(str) + 1);
++top;
}

char * pop()
{
return stack[top--];
}

int main(int argc, char *argv[])
{
FILE *file = fopen(argv[1], "r");
char str[50], ch;
int x = 0;

while(fscanf(file, "%c", &ch) == 1)
{
if(ch != ' ' && ch != '\n')
{
str[x++] = ch;
}
else
{
str[x] = '\0';
push(str);
if(ch == '\n')
{
top--;
while(top >= 0)
{
printf("%s%c", pop(), top < 0 ? '\n' : ' ');
free(stack[top + 1]);
}
top = 0;
}
x = 0;
}
}

fclose(file);

return 0;
}


I have that too
>>
>>56197702
$str="die bad woman";
echo reverseWords($str);

>live good man
>>
>>56197785
forgot pic
>>
>>56197788
copied from somewhere / 10
>>
>>56197808
I wrote this for CodeEval awhile ago though
>>
>>56197788
That's a really shitting program.
>>
File: 1393796383102.jpg (12KB, 203x200px) Image search: [Google]
1393796383102.jpg
12KB, 203x200px
>>56197788
>Deathconsciousness
>>
>>56197817
sure you did
just tell me where u copied it from
>>
>>56197660
I skimmed it. Looks like battleship. some anon said it was python, i never coded in it. Looks clean i like it, but its long. OOP would make it nicer if thats possible in python.
>>
>>56197788
Why not just replace the space with a null char and point the stack pointer at that?
>>
>tfw can't visualize
fibs = zipWith (+) fibs (tail fibs)
>>
>>56197702
Oops, I forgot mine, can't have stabby the fucker fucking me
s = input('Enter a string ya fuck: ')
l = s[::-1]
v = ''

l = l.split()
print(l)
for i in l:
v += i[::-1]
v += ' '
print(v)
>>
>>56197820
I don't know a better way in C
>>56197821
Stop following me
>>56197855
No idea, I might spend a bit of time seeing if I can clean this up a bit now that I'm looking at it.
>>
>>56197877
idk if this is shitty programming or a horrible attempt at obfuscation
>>
>>56197702
Will also handle punctuation.
s =>
s.split(" ")
.map(word =>
word.split("")
.map(char =>
/\w/.test(char) ? char : {char})
.reduce((prev, cur) =>
typeof cur === "string"
? cur + prev
: prev + cur.char, ""))
.join(" ")
>>
File: notepad++_2016-08-21_153027.png (58KB, 1048x706px) Image search: [Google]
notepad++_2016-08-21_153027.png
58KB, 1048x706px
Good afternoon.
>>
>>56197903
#include <stdio.h>
#include <string.h>

void print_reverse(char *string){
char *stack[50];
int top = 0;
for(char *tok = strtok(string," \n");tok;tok=strtok(NULL," \n"))
stack[top++] = tok;
while(top--)
printf("%s ", stack[top]);
putchar('\n');
}

int main(int argc, char **argv){
FILE *fp = fopen(argv[1],"r");
char line[100];

while(fgets(line,100,fp)){
print_reverse(line);
}

fclose(fp);
return 0;
}
>>
File: 1465158959049.jpg (85KB, 1080x1080px) Image search: [Google]
1465158959049.jpg
85KB, 1080x1080px
>>56197668
>>56197707
>>56197709
>>56197786
>>56197842
hehehe this was just the first thing I ever coded on my own I know it's total shit
>>
>>56198131
>stack[50];
>line[100];
>fgets(line,100,fp)

nice assumptions, bro
>>
>>56197079
The test expects my function to return a
struct Vector
and then it tests if list.size is the correct value here:
TEST_ASSERT_EQUAL(outputs_len, vout.size);


How am I supposed to give it the right value without changing it?
>>
>>56197702
>>56197746

Wait fuck, i'm retarded

use std::iter::once;

fn reversed(s: &str) -> String {
s.split_whitespace()
.flat_map(|s| s.chars().rev().chain(once(' ')))
.collect()
}

fn main () {
println!("{}", reversed("esaelP t'nod bats ,em ybbats !drib"));
}
>>
>>56197702
oops, its words in a string, not string
ok
revStr = unwords . map reverse . words
main = putStr "string: " >> getLine >>= putStrLn . revStr
>>
>>56198078
https://github.com/Bigjoos/U-232-V4/blob/master/forums/new_topic.php
>>
>>56198131
strtok would always be nice for these CodeEval challenges, but I never remember it
>>
>>56196442
Sorry! The NSA doesn't like it when people leak their secrets, so I can't do as you asked.
>>
File: 006.png (235KB, 506x658px) Image search: [Google]
006.png
235KB, 506x658px
>>56197419
>Picture doesn't include the smug master
Anon...
>>
>>56197584
Racket has OOP, but you basically never have to do anything with OOP.
>>
>>56198353
Sorry, new_firend. I have not been to /a/ in many years.
>>
>>56197702
(string-reverse str)
>>
File: 1438058695838.gif (260KB, 266x207px) Image search: [Google]
1438058695838.gif
260KB, 266x207px
>>56197419
Why is everyone screencapped, except for meduka?
Is there no smug meduka in meguka?
>>
>>56198427
kys
>>
>>56198427
This was before the movies, so I think so.
>>
>>56198195
In your code you posted earlier you omitted the part where you modify the list so it's hard to tell what you're doing wrong.
>>
>>56197632
the only thing going over yonder is Python 2 finally dying.
>>
>>56197702
>>56198406
Okay, fine. I guess I was being snarky when I posted that first one. Do you mean reverse the letters in only the words or do you mean reverse the ordering of just the words?
; reverse the letters in only the words
(require (only-in srfi/13 string-reverse))

(define string "A string with multiple words in it.")

(define (reverse-words str)
(define lst (string-split str " "))
(define reversed-lst (map string-reverse lst))
(string-join reversed-lst " "))

; reverse only the words
(define (reverse-words2 str)
(define lst (string-split str " "))
(string-join (reverse lst) " "))

(reverse-words string) ;=> "A gnirts htiw elpitlum sdrow ni .ti"
(reverse-words2 string) ;=> "it. in words multiple with string A"
>>
>>56198479
I just modify it by doing list.size = result.
Is this wrong?
>>
>>56198567
Do you mean the begin variable? There's nothing named result in the code you posted
>>
>>56198495
was supposed to post itt
>>
>>56198615
You're right, but that's what I'll do when I have a result :(
Anywho, changing list.size gets me a segfault no matter what I change it to, so I'm totally unsure how to proceed.
>>
>>56198636
>taking a photo of your monitor instead of a screenshot
>posting said photo without fixing its rotation
>posting a thread instead of a comment
>>
>>56196442
I was bored, so i tried some Haskell
import Control.Monad
import Control.Monad.Free

data Instruction a n = Push a n | Pop (a -> n) | IsEmpty (Bool -> n) deriving Functor
type Computation a b = Free (Instruction a) b

Pop :: Computation a a
push :: a -> Computation a ()
isEmpty :: Computation a Bool
pop = liftF $ Pop id
push x = liftF $ Push x ()
isEmpty = liftF $ IsEmpty id

runComp stack (Free f) = case f of
Pop n -> runComp (tail stack) (n $ head stack)
Push a n -> runComp (a : stack) n
IsEmpty n -> runComp stack (n $ null stack)
runComp stack (Pure y) = stack

main = print . head . runComp [5,6,7] $
do
x <- pop
y <- pop
z <- pop
push (x + y + z)
>>
>>56196410
No. Generics are invariant in Java, because of this problem:
void foo(ArrayList<Player> players) {
ArrayList<Character> characters = players;
characters.add(new Enemy());
}


Arrays are covariant in their type parameter, so you can cast Player[] to Character[]. However, if you try to add a non-Player, it's detected through reflection and you get an exception. Java is weird.

Scala, for instance, does much less mutation, so you can designate variance of generics.
>>
>>56198703
Monads are free because if you had to pay for them nobody would use them
>>
File: 1459619457253.jpg (72KB, 543x549px) Image search: [Google]
1459619457253.jpg
72KB, 543x549px
Which hex editor should I use?
>>
>>56198653
Take a look again at the
test_detect_simple_anagram
.
The function expects the content of the Vector returned by the
anagrams_for
to to be
dynamically allocated because it does a free() on it afterwards.
I'm guessing you need to create a copy of the input list with malloc.
>>
>>56198828
>anon in charge of abstract algebra
>>
File: 3.png (31KB, 550x550px) Image search: [Google]
3.png
31KB, 550x550px
>>56198828
>>
>>56198837
hexedit or vim
>>
>>56198828
>>56198850
I would give all my money away if it means using monads

(I still don't understand them)
>>
>>56198839
More specifically the line
 free(vout.vec);
>>
>>56198850
There are more monad tutorials than atoms in the universe.
>>
>>56196410
just make an interface that Player and Character both implement then use that as the type parameter for ArrayList
>>56197611
JavaScript has never been functional
>>56197744
this or Dylan
>>
>trying to assign meaning to the concept of a monad
>>
File: 1.png (10KB, 550x550px) Image search: [Google]
1.png
10KB, 550x550px
>>56198903
>>
>>56198927
nv do you like Scheme?

Each day I find myself more and more frustrated with the limitations of most static type systems.
>>
>>56198959
>tfw don't even know what a monad formally is
>inb4 monoid in the category of endofcuntors
>>
>>56198963
In terms of unsolved problems in physics, monads are probably the most important right now. We have evidence that points toward their existence, but we probably won't know for another 500 years.

Of course, even if they do exist we will never be able to use them, just as we will never leave our galaxy.
>>
>>56199017
A monad is an instance of a typeclass that satisfies certain laws.
>>
>>56199047
And what laws those might be? :^)
>>
>>56199017
Anything that implements the monad operations and obeys the monad laws is a monad.
>>
>>56199055
https://wiki.haskell.org/Monad_laws
>>
>>56199078
Actually thanks, I was memeing, but I learnt something useful today.
>>
>>56199078
>>56199055
>>56199047
>>56199017
>>56198959
>caring about irrelevant shit

kys
>>
>>56199141
I deposited your 500 rupees of the day, Java pajeet.
>>
>>56199200
Thanks you, Sir
>>
Is there any appetite for a LISP thread?
>>
I made a thing that converts Fahrenheit to Celsius and the other way around! It's my first time using GitHub as well.

https://github.com/BKristian/FahrenheitAndCelsiusConverter
>>
>>56197795
Font name?
>>
>>56199342
Well done anon!

If you wanted to extend it, you could add support for kelvin
>>
>>56199342
That is some enterprise fizz buzz level code.
>>
>>56199355
termsyn
>>
>>56199342
You should put Hello World! on github too!!!!!!!!!!!!
>>
>>56199408
xDdddddd
>>
>>56199342
protip: It would make more sense to have a Coversions class and include the two coversions there instead of having seperate classes.
>>
>>56199425
>coversions
fuck I cant spell
>>
>>56199017
>>inb4 monoid in the category of endofcuntors
That's true, though.
>>
Monads are programmable semicolons.
>>
>>56199505

Bonus fact: Comonads are just comonoids in the category of endofunctors, and there is nothing you cannot do with comonads.
>>
File: e024d76acb.png (15KB, 526x395px) Image search: [Google]
e024d76acb.png
15KB, 526x395px
Daily reminder.
>>
>>56199576
explane comonads to me
>>
>>56199576
Very clever post.
>>
>>56198839
>>56198894
Hmm, okay, I've done this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "anagram.h"

struct Vector anagrams_for(char *word, struct Vector list)
{
int len = strlen(word), begin = 0, counter = 0, k = 0;

struct Vector vout = {NULL, 0};
vout.vec = malloc(list.size * MAX_STR_LEN);

printf("string to match is %s\n", word);

for (int i = 0; i < list.size; ++i)
{
printf("%s\n", list.vec[i]);
strlen(list.vec[i]) == len ? begin = i : 0;
}

printf("Beginning with %s\n", list.vec[begin]);

for (int i = 0; i < strlen(list.vec[begin]); ++i)
{
for (int j = 0; j < len; ++j)
{
if (word[k] == list.vec[begin][j])
{
++counter;
++k;
}
}
}

if (counter == len)
//possible anagram?

return list; //can't return correct vector yet
}


So how can I copy a string into vout.vec?
The Vector struct is, pathetically enough, declared like so:
#ifndef ANAGRAM_H
#define ANAGRAM_H
#include <stdio.h>

#define MAX_STR_LEN 20

struct Vector
{
char (*vec)[MAX_STR_LEN];
int size;
};

struct Vector anagrams_for(char*, struct Vector);
#endif /* ANAGRAM_H */
>>
>>56199593
Reverse the arrows in the definition of a monad
>>
>>56199611

Thanks.

>>56199593

They are effectively the inverse of monads.
>>
>>56199576
>there is nothing you cannot do with comonads.
Please justify this claim
>>
>>56199640
I think I'm seeing a joke in the post, at least.
>comonads can do everything
>comonads can be seen as objects
>OSGTP semi-ironically praises functional programming but mostly likes object-oriented programming
>>
>>56199640
explain more
im a haskell noobie
>>
>>56199627
This is getting to a point of spoonfeeding...
strncpy()
>>
>>56199665

Truthfully, I'm only semi-shitposting because I haven't got a real project to work on.
>>
>>56199712
You should learn Idris
>>
I don't like that the Monad typeclass is defined in terms of (>>=) and not join. At least allow either, like how you can define Eq with either (==) or (/=). Or both.
>>
>>56198974
yes, scheme is a favorite
I don't use it all that often but every 6 months to a year I get burnt out on static typing and switch back to Scheme exclusively
like earlier this year I just stopped working on all my existing projects in other languages because i wasn't in the mood to write anything but Scheme
>>56199324
yes please, I miss the Lisp generals. those used to be so much higher quality than /dpt/, and now they're only on lainchan
>>
>>56196461
t. James Bond
>>
File: url.jpg (12KB, 225x225px) Image search: [Google]
url.jpg
12KB, 225x225px
So the other day I got talking to this management type guy at a party and he went of talking about this "test driven development" and how it's the best thing since sliced bread.
I'm a pretty novice programmer I've only been at it for little over a year so felt way in over my head at that point.

So I went to look in to it and it's pretty much exception throwing every single piece of code.

Is this a real thing or did just get meme'd on hard?
>>
>>56196196
How is that image related to programming?
>>
>>56199785
It's definitely a meme. Unfortunately it's very popular
>>
>>56199790
He's a programmer.
>>
>>56199785
Tests only prove the existence of bugs. They cannot prove their absence.

Tests compensate for failures of the type system.
>>
>>56199694
That doesn't work though.
strcpy(vout.vec[0], list.vec[0]);

This segfaults.
>>
How can I style my website so it isn't just plain text?
>>
>>56199826
>he
>>
>>56199756
>!nv.0k6WoTc
>WoT
Play me in WoT fgt.
>>
>>56199936
CSS
>>
>>56199936
>>>/g/wdg/
>>
>>56199928
>strcpy takes a pointer to the destination and the pointer to the source
>you give it the value of the first element
wewewewewewewew
>>
>>56199833
A type system won't help you for testing I/O operations.
>>
>>56200134
Maybe I should say "most tests". Tests are useful for ensuring your "business logic" is sound, but they're not a great tool for preventing worse bugs.
>>
>>56200134
It can do. Use the free monad.
>>
File: 131245646342313.jpg (20KB, 334x393px) Image search: [Google]
131245646342313.jpg
20KB, 334x393px
>>56199999
What a waste of quints linking to that thread full of front end spergs.
>>
>>56200157
Can your monads prove the client received the expected response or the results of a database query?
>>
>>56197702
alias reverse = (string s) => s.length > 0 ? s[$-1] ~ s[0..$-1] : [];
>>
>>56200178
It's not as bad, if you filter React and PHP.
>>
>>56200180
You're not testing the database or the network connection though, are you? You're testing your program. Dipshit.
>>
>>56200054
list.vec has type
char (*vec)[MAX_STR_LEN]
so it has the correct type.

>>56199928
Looks correct to me, are you sure that the error is caused by it?
>>
im sick and tired of being a lowly web developer. i make a decent salary but have plateaued. I was thinking of learning a functional language like Haskell but I am unsure what kind of job would use that? Where should I pivot my career? anyone else been in this position?
>>
>>56200191
I need to verify that the program constructs a query that produces the correct results, hasktard.
>>
>>56200217
Java/C# would probably be of more immediate help in getting a non-webdev job.
>>
>>56200180
Tests have nothing to do with that. If you need the response to be guaranteed, you use acks.

>>56200229
Ah, that can be done statically.
>>
>>56200229
Then yes, a type system can help you test that.

Your post made it sound like you were asking for something to test that the network connection wouldn't go down.
>>
>>56196255
you could store each decimal digit as a hex value. 4 bits per digit, two digits per byte.
>>
>>56200234
all java and C# jobs are web dev jobs, and i already make more than that average. what jobs pay the big bucks (150k+)? Big data?
>>
File: Screenshot_2016-08-22_02-06-51.png (35KB, 448x385px) Image search: [Google]
Screenshot_2016-08-22_02-06-51.png
35KB, 448x385px
>>56200217
JavaScript can be pretty functional, if you want it to be.
>>
>>56200281
>all java and C# jobs are web dev jobs
wrong. a lot of them are CRUD which is borderline web dev, but there are other jobs as well
>>
>>56200281
Do you think you have time to get into big data before it goes the way of law jobs?

Fintech might be an option. Some companies will be interested if you have some FP ability.
>>
tfw the language you liked a while back didn't pick up as much traction as all of the other hip languages

;_;
>>
>>56197279
hey im a complete noob learning java atm, what would be a better way of doing that without using *?
>>
What generally recommended as a first programming language? Also I remember there was some sort a chart that helped with this. Any anons have it?
>>
>>56200330
java

python is the hottest new meme but it's SHIT, whatever you pick don't start with python
>>
>>56200318
A fucking for loop.
>>56200330
Python or JavaScript, if you want to webdev.
>>
>>56200318
sum it in a loop
>>
>>56200348
lol, who would have thought, the fag that keeps talking shit about python is a pajeet
>>
>>56200330
C
>>
>>56200351
I'm more interested in pursuing something in security or like networking if that matters
>>
>>56196196
>Unrelated cartoon image
>no link to previous thread
I'll just wait till an actual programmer makes the next thread, thank you.
>>
>>56200330
start with learning web dev man, watch this https://www.youtube.com/watch?v=sBzRwzY7G-k incrementally, first learn the HTML, CSS and a bit of Javascript like he says, then move on.

i did that exact thing back in 2014 with his old video, and now i make a very decent salary and am decent at programming many languages
>>
I wish there was a vocal cord parasite, but for Java.
>>
>>56200362
shart in mart
>>
>>56200388
completely self taught or did you go to school?
>>
>>56200388
kill yourself you certainly don't have to learn web dev before programming
>>
>>56200376
C, C++ and Go.
>>
>>56200404
100% self taugh. i did get an associates degree in comp sci from a community college but i cheated my way through it and didnt learn jack shit. that was 2012-2014, once i got my degree i figured i should actually learn so i began with that video. your interest and passion only grows. web dev has good salaries right now and is pretty easy, there is a lot of things to learn and it may intimidate you, but its honestly really not that hard. now that i am very good at web dev im learning functional languages and also plan to dive into embedded programming if not for a job then just for fun.
>>
Usually only matters what you're interested in. Which is...?
>>
>>56200395
>eat Indian food
>die
>>
>>56200409
oh absolutely you do not, just sharing my experience
>>
>>56200437
Which functional languages?
>>
>>56200442
To whom are you replying?
>>
>>56200460
if you're new to programming, a functional language is just a different way to program. again, there are lots of terms like these that may through you off, look up everything you dont know

if you're not new, im learning haskell
>>
>>56200473
Fuggg

>>56200376
Well I guess this answers it. Security or networking? Neither are really tied to one language. But if you end implementing libraries for either, it will probably end up being in C.
>>
>>56199936

Make a Javascript function to make letters randomly swap every second, forcing people to read through it quickly before the text becomes completely incomprehensible.
>>
>>56200516
I'm learning towards security
>>
>>56199957
It's explained in the LN.
>>
Havent programmed in a bit, drawing a blank on the command for this,
all im trying to do is have it be like
if choice = multiply
do this
i just forget how to write it
>>
yes i read the sticky. and i've googled my fingers off. but i still have a specific question, maybe you guys can help me out.

i really want to do android app dev. and i've ready several books on java, android, programming basics, and even ruby for some reason.

the app i'm trying to build will require a web storage of profiles and also a database of colleges, including their locations, costs, teacher to student ratio, completion %, and job placement %.

i THINK i want to use SQL based on all the references to it, but i know nothing about it.

what's the best way to learn SQL as if i'm a retarded 5 years old with A.D.D. who's never even heard of computers?

resources, tips, mindset, analogies, learning games, etc...
>>
>>56201207
if(choice.equals(multiply)){
// do thing
}
>>
Found some free time so I've decided to try a functional programming language. Currently working through the Learn You a Haskell book.
>>
>>56201244
Yeah, definitely sounds like you want to use a database. SQL is actually pretty easy to pick up, and easy to use if your database isn't a fuckawful mess like the one at my workplace is.

To be honest, the easiest option for starting to learn SQL would be CodeAcademy just for a run-through of the basics and syntax. It's probably the only course there that's actually worth a damn outside of the HTML one.
>>
>>56201504
thanks, you beautiful Anon!
codecademy i had written off as being shit for all else too, but i'll check the SQL there.

*if any others, i'm still here and would be greatful for other resources*
>>
Need a project to work on /g/. I've been working full time all summer and have done NO programming. Need some practice to get back into the swing of thing
>>
>>56201388
Enjoy your wasted time.
>>
>>56201582
grab a list of dog breeds and traits and their lineage
based on that, create a program to simulate cross breeding various breeds and what traits should result
***bonus round: make it graphical
>>
>>56201578
SQL basics took 20 minutes for me to pick up. Don't sweat it too much since from what I'm guessing, you're not gonna be doing things like performing complex table joins. App development isn't something I'm familiar with at all but it's relatively easy to connect to a local database in Java iirc, similarly with C#. I imagine that you just want to have a user look up a certain college and then spit out some results based on what you've stored in the table.

Lrn2google because you sound like you need to learn that before anything else.
http://www.cga-pdnet.org/Non_VerifiableProducts/CourseNotes/2010/ms1/module03.pdf

I dunno why you read up on Ruby, either, but whatever. I suggest you spend your time actually writing out each individual step of what you need the user to do in order for them to get what they need.
>>
>>56200134
yes it can, in fact that's what my language is focused on
>>
File: taylorweb08.jpg (56KB, 360x480px) Image search: [Google]
taylorweb08.jpg
56KB, 360x480px
if Taytay were a programmer:

"But I've got a %20, baby
And I'll type your name"
>>
File: taylt.gif (3MB, 500x262px) Image search: [Google]
taylt.gif
3MB, 500x262px
>>56201773
>>
>>56201773
>>56201904
Taylor Swift sucks
>>
>>56201904
i have such a raging harddrive right now
>>
File: tayprog.gif (401KB, 473x266px) Image search: [Google]
tayprog.gif
401KB, 473x266px
>>56201917
thanks for letting me know. i was wondering if she was prudish. does she spit or swallow?
>>
>>56201917
this
>>
File: taypc.jpg (19KB, 480x360px) Image search: [Google]
taypc.jpg
19KB, 480x360px
>>56201964
>>56201917
>>
>>56197186
Can you explain to me?
>>
>coworker writes code in German and uses umlauts and that weird capital B thing
>they show up as missing glyphs in my font
>get fed up and write a script to replace ä, ö, ü, ß with a, o, u, ss respectively
>set it to run once a day at midnight and commit and push the changes it makes
>boss calls me into his office about a week later and chews me out for making pointless commits
Should I quit?
>>
>>56196196
Hello /dpt/. I have a question.

I am an amateur working on a tiny project which will call a few shell commands based on one string entered by the user. Now, all I want to do is make a small graphic interface that will prompt the user to enter the text. I want to avoid command lines as I want to deploy this widely to people who might have never seen one before and would be expectedly intimidated by it. So what I'm looking for is a way to make a small, portable Windows executable that opens a dialog box and then runs the script. Ideally, I wouldn't require the user to install Java, Python or any dependency. Just double click the executable and that's it.

What would be the known ways of doing this? I'm not asking how to code it, of course, just the kind of language/interface/compile/IDE that would allow me to do this.

Thanks.
>>
>>56202067
Have you told your boss that your coworker is an annoying idiot?
>>
>>56196466
>^v$
Please just use V
>>
>>56202067
Should have changed them to ae, oe, ue desu. Also, talk to your coworker and see if you can find a way around it.
>>
>>56202075
VBScript
>>
>>56202067
you should've just explained why they weren't pointless and that you're not wasting time because they're automated by a script
>>
>>56202087
That would not go down well.

>>56202094
Perhaps. I'd prefer that he write code in English. I've discussed it with him but he says he's too slow at typing English.
>>
>>56202099
He's the sort that doesn't realise you can automate that sort of task, and accuse you of lying if you try to correct him.
>>
NEW THREAD!

>>56202150
>>
>>56196442
static void
compute_piece(struct pt out[4], enum mino m, int x, int y, int rot) {
int b, r;

for (b = 0; b < 4; ++b, ++out) {
out->x = b && mino_pt[m-1][b-1].x;
out->y = b && mino_pt[m-1][b-1].y;
for (r = rot; r; --r) {
int out_x = out->x;
out->x = out->y;
out->y = -out_x;
}
out->x += x + (rot && rotshift[m-1][rot-1].x);
out->y += y + (rot && rotshift[m-1][rot-1].y);
}
}
>>
>>56197332
case compare i n of {EQ -> _; LT -> _; GT -> _}
Thread posts: 316
Thread images: 40


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.