[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: 335
Thread images: 39

File: Gries.jpg (16KB, 316x499px) Image search: [Google]
Gries.jpg
16KB, 316x499px
What are you working on, /g/?

Previous thread: >>59197137
>>
First for Java
>>
>>59204122
First for seppples
>>
STM32 SysTick
>>
>>59204122
working on a program that organizes different stocks in a nice format from a txt file
>>
from sys import argv, stdin

cdef char cells[30000]
cdef short int cellPos = 0, filePos = 0
cdef list stack = []

cdef inline void move():
cdef int i = 1
while i != 0:
cChar = input.read(1)
if cChar == '[':
i += 1
elif cChar == ']':
i -= 1

with open(argv[1]) as input:
while True:
cChar = input.read(1)
if cChar == '':
break

if cChar == '>':
cellPos += 1
elif cChar == '<':
cellPos -= 1
elif cChar == '+':
cells[cellPos] += 1
elif cChar == '-':
cells[cellPos] -= 1
elif cChar == '.':
print(chr(cells[cellPos]), end = "")
elif cChar == ',':
cells[cellPos] = ord(stdin.read(1))
elif cChar == '[':
stack.append(input.tell())
if cells[cellPos] == 0:
stack.pop()
move()
elif cChar == ']':
if cells[cellPos] != 0:
input.seek(stack.pop() - 1)
else:
stack.pop()
>>
Thanks for NOT using an animu picture, OP.
>>
>>59204122
My irq handling code seems to work now, so I can move on to implementing rs-232 as std::iostream.
>>
File: py.png (24KB, 800x800px) Image search: [Google]
py.png
24KB, 800x800px
>>59204162
>elif
gross desu
>>
File: 1464699636920.png (125KB, 640x651px) Image search: [Google]
1464699636920.png
125KB, 640x651px
>>
>>59204258
what the fuck?
>>
>>59204196
Are you writing a kernel? What platform and so on?
>>
>>59204397
Writing a low-level library for DOS (x86) in C++14.
Next up is trapping cpu exceptions, then implementing the gdb interface so I can actually debug this stuff.
>>
/g/, please help.
I'm learning C and I have to make a recursive function that takes a pointer as an argument, but then, when I call it inside itself like this:
void f(int* x, int* y) {
y = f(x + n);
}

x changes values. Why does it happen and how can I prevent it?
>>
>>59204337

this isnt even javascripts final form

look up JSFuck
>>
>>59204337
He's getting various values like NaN and undefined and casting them to strings with
string + anything
. After that you index and concatenate to produce words. The rest is obfuscation.
>>
>>59204184
Don't forget to take pills.
>>
>>59204511
As far I can tell, your function is an infinite loop?, aslo why are you assigning f's result even if its result is void.
>Why does it happen and how can I prevent it?
Because you're assigning to x, either not do it, or have a const parameter.
>>
network programming project due Sunday. TCP/UDP listening. Not difficult, just tedious in the specific requirements the prof has...
>>
File: 1469583171814.png (350KB, 621x393px) Image search: [Google]
1469583171814.png
350KB, 621x393px
>>59204511
What the fuck are you doing
>>
>>59204511
Y shoud be dereferenced
*y = f(...)
>>
>>59204627
>>59204589
>>59204634
That is not the actual function... Geez
>>
>>59204397
>>59204450
dpmi::irq_handler asdf { [&](auto ack) 
{
std::cout << "hello world!\n";
ack();
}, dpmi::no_auto_eoi | dpmi::always_chain };
asdf.set_irq(1);
asdf.enable();

This is what an irq handler looks like now, using my library. Supports nested interrupts, stack length is variable (it's in a std::vector), and I wrote some custom allocators to use STL containers without risking page faults. Also got multi-tasking and coroutines going, using a similar syntax.
>>
>>59204645
oh wait, I fucked up.
I still can't make it work, but the problem is not what I thought it was.
>>
>>59204685
Oh, and I forgot to mention irq sharing. That's a thing too.
>>
>>59204645
Still, if you assign to a pointer you need the *, otherwise you change the pointer, not the memory pointed at by the pointer
>>
How is Perl for making a textboard?
>>
>>59204756
Use vibe.d

http://vibed.org/
>>
File: 1480099975661.gif (996KB, 500x475px) Image search: [Google]
1480099975661.gif
996KB, 500x475px
I have a general question

Just for sake of simplicity, let's say I'm making a game in Unity.
How does the game handle the logic/systems/etc... behind the game? For example, Unity has a native scripting language, but what if I wanted something more robust? Could I get the engine to run a python or a c++ program and have it give and receive data from the other program?

What's the preferred method for handling complex systems that run tandem to the game?
>>
>>59204756
Do you know Kareha?
>>
>>59204830
http://www.lua.org/
>>
>>59204830
>What's the preferred method for handling complex systems that run tandem to the game?

You write your own engine that serves as a lightweight wrapper for OpenGL and then you handle your logic separately.
>>
File: 1471306202574.jpg (900KB, 1616x2889px) Image search: [Google]
1471306202574.jpg
900KB, 1616x2889px
>>59204850
>http://www.lua.org/
are you trying to say that lua is a compatible scripting language robust enough to handle whatever I throw at it?
>>
>>59204921
>scripting
>robust
>>
>>59204921
Unity doesnt give you access to the source code. If you really want to use an engine and do core things on it you should rather user Cry or Unreal since its at least documented. Otherwise you'll have to bear with Unity''s scripting, which is probably still fine for what you'ré trying to do.
>>
I always have difficulty finding a good name for a new program. You guys got any tips?
>>
>>59205101
Yes, I'm touching it right now
>>
>>59205101
what does your program do?
>>
>>59205065
The problem is the crux of my system involves implementing a specific api that I can use in python, c++, and a few others. Without that api, the system won't be able to do what I want it to do. And writing my own version of that api is so far beyond my skills that it's literally not an option.

and (prepare to vomit) the game (which isn't really a game per se) is planned to run on SteamVR/Oculus and Unity has the most streamlined VR development process that I've seen.
>>
>>59205115
xd
Good one anon :^)

>>59205118
For now? Nothing yet. In the future it'll try to compile code and see if it works.
>>
>>59204122
If I have some string str (represented as a char array with a null byte) in c and I call strcpy like so:
strcpy(str, "");

Why doesn't str become empty? In fact it stays the same for me. How do I get around this?
>>
>>59204258
#include <stdio.h>
int main(void){char C[1][1][1][1][1][1][10]={{{{{{"\x4F\x6E\x6c\x79\x20\x69\x6E\x20\x43"}}}}}};int O,n,l,y,i;O=n=l=y=i=0;printf("%s\n",((O+n+l+y)+(i+n))[C]);return 0;}

>Only in C
>>
>>59204797
>High-level declarative
Stopped reading there.
>>
>>59205197
Great argument, idiot.
>>
>>59205240
Great shitpost, retard.
>>
>>59205240
It is the only valid response, moron.
>>
>>59205167
Kill yourself.
>>
printf("test\n");

or
puts("test");
>>
>>59205351
Like most of C's functions, printf("text\n") has no security concept. puts() is an better option but you can't plug in variables.
>>
>>59205351
An optimising compiler will likely optimise trivial printf calls to puts calls.
puts in better for these sorts of things, but printf is fine.

>>59205395
>security concept
Sure it does. As long as the format string is a string literal, printf is perfectly safe.
>>
>>59205442
>As long as the format string is a string literal
Doesn't look like anything robust
>>
>>59205395
>>59205351
And when you are trying to use printf() for pluging in variables you realise what a piece of shit C actually is.
>>
>>59205465
>If something doesn't have megabytes of runtime checks, it's not "safe".
As long as you don't violate the preconditions of the standard C functions, they are all perfectly safe.
There is only a single thing with printf which is deemed "unsafe": %n. If a user is able to modify the format string and manipulate the arguments in some way, it can lead to an exploit.
However, if the format string is a string literal, there is no way they can do this. Compilers will even warn if the argument is not a string literal.
>>
>>59205524
Nice undefined behaviour, fuckface.
Go learn what a sequence point is.
>>
>>59205524
you incurred a side effect which can be executed at any point before the printf function call.
>>
I wrote a lightweight scripting language, and now I'm testing it for bugs, and try to come up with useful features to add.
>>
#include <stdio.h>

int main()
{
printf("%d %d %d");
return 0;
}
>>
>>59205541
>Hello world producing undefined behavior
C(ancer)
>>
>>59205541
Urnary increment was a retarded decision.
>>
C BTFO once again
>>
>>59205524
Jesus Christ. Not even Java has this problem
>>
>>59205630
>>59205644
>>59205650
>>59205663
I can conclude that you are all retarded, or at least pretending to be retarded.
You can't even call yourself a programmer if you don't even know what a side effect is.
>>
>>59205697
>Blindly defending poorly made features
Literal (C)uck
>>
why don't you guys program something useful and make money?
>>
>>59205541
Just works
>>
>>59205697
see >>59205738

God I hate C
>>
Why do C shills sound like Archfags?
>>
>today /dpt/ learns undefined behavior does unexpected things
>>
>>59205738
>>59205743
So Deadlang has a sequence point between arguments to a function. What is that supposed to prove?
All you seem to be showing is that you don't know the semantics of C or C++.
Also, use -Wall you fucking idiot.
>>
>blogpost
Currently studying for my oop exam tomorrow (in java, lol).
If I fail this third try I can say bai bai to my Bachelor.
>>
>>59205802
include my post in the screencap XDDD
>>
>>59205810
>The way it is is good, because that's how C does it
Good argument. Which fallacy is this again?
>>
>>59205810
>What is that supposed to prove?
C is trash.
>>
>>59205810
>you don't know the semantics of C or C++.
Oh I know them full well. And C is pure garbage, C++ inherited some of the cancer induced from C
>>
What is the most autistic language?
>>
>>59205916
D
>>
>>59205916
brainfuck
>>
Excuse me, I got a question.


How will C.ucks ever recover?
>>
>>59205877
>hurr durr C is shit, because i don't know how it works beneath

>>59205893
Not an argument,

>>59205912
Not an argument
>>
>>59205951
>This denial
>>
>>59205951
You yourself have no argument. Considering C#, Java, D etc does not break in hello wolrd programs
>>
>>59205916
javascript
>>
>>59205644
Rust doesn't have this problem :^)
>>
>>59205976
C does not break in hello world programs. sweetie.
>>
>>59206001
see >>59205738 honey. Sad your 80's retro language smells like garbage bin
>>
File: 1487550646729.jpg (84KB, 648x720px) Image search: [Google]
1487550646729.jpg
84KB, 648x720px
>>59205351
>>59205395
>>59205395
>>59205524
>2017
>Using C for anything but programming micro-controllers
>>
>>59206037
>2017
>Using C for anything
>>
>>59206048
>>59206037
For programming low level shit like PALs I'd just use VHDL
>>
Akari-bbs anon, where did you go?
>>
>>59206037
It's good for juniors in order to get strong understanding.
>>
>>59206071
This.

Even though I hate C I want AkariBBS anon to come back
>>
>>59206071
I'm still here, I just haven't done anything in a while.
>>
File: 1439648511159.jpg (116KB, 469x469px) Image search: [Google]
1439648511159.jpg
116KB, 469x469px
All of the fervent C haters just make me want to use it more.
Acting like a retard and posting deliberately misinformed arguments is not a way to make people agree with out.
>>
>>59206133
Pls implement capta
>>
File: 1482209151825.jpg (174KB, 1083x720px) Image search: [Google]
1482209151825.jpg
174KB, 1083x720px
>>59206133
was worried, you haven't posted in a while
gtp kept saying you died
>>
>>59205197
That's actually really easy to see if you aren't retarded. The other is beyond wtf.
>>
>>59206172
cringe
>>
>>59206133
Why aren't you implementing a google captcha system?
>>
>>59206172

It was a joke.
>>
File: 1486592438864.gif (124KB, 480x270px) Image search: [Google]
1486592438864.gif
124KB, 480x270px
>>59206280
it wasn't funny
>>
>>59206287
xD
>>
>>59205524
kek
>>
can i implement a queue without knowing the rear and only the head?
send help
>>
>>59206444
that's what you're going to find out
>>
>>59206473
yeah i figured
>>
>>59206444
IDK, your mom implemented a queue but she uses her rear and her head at the same time.
>>
>>59206485
jokes on you, i was raised by two men (my parents are gays)
>>
>>59206444
Sure, but knowing where the tail is is a much better idea.
>>
There is literally nothing wrong with Java
>>
>>59206529
Proof that queer parents lead to retarded children.
>>
>>59205738
>15
>one less than 14
>>
>>59206598
Proof C really is backwards.
>>
>>59206749
that's not C, honey
>>
>>59206766
I fucked up.
>>
>>59205524
arguments are evaluated before the function is called
>>
File: 2817548511.jpg (109KB, 539x410px) Image search: [Google]
2817548511.jpg
109KB, 539x410px
>>59205738
but that's the nature of using pre decrements, D got it wrong (though using printf in D prints 14 14 too)
>>
What are some fun programming problems solving websites these days? topcoder, codeforces?
>>
>>59206860
>topcoder
>codechef
>hackerrank
>codejam
>codeforces
>>
>>59206140
The C vs Rust example posted earlier makes it even more retarded because that's exactly how the ABI mentions arguments should get passed.
But obviously people who hate on C don't know low level programming.
>>
>>59204122
Making a Articifial Intelligence.
>>
Why do all the guys here who are good at programming just shit post endlessly instead of post what programs they are working on
>>
>>59207021
The guys who are good at programming don't shitpost.
t. Shitposter
>>
>>59207021
The guys who are good at programming don't browse /g/.
t. Shitposter
>>
>>59207066
How did I manage to double post without filling the captcha?
>>
>>59207021
because they don't work on anything
>>
While I don't like C myself you're really not doing yourselves or your preferred languages any favours by being blatantly retarded in your "criticism".

I don't understand how something as straightforward as implementation-defined argument evaluation order manages to get this general in a tizzy every time.
>>
>>59207021
Working on a compiler but taking time off since I'm ill and need to eat something
>>
>>59207100
>implementation-defined
Not to detract from what you're saying, but you're using that term incorrectly. Order-of-evaluation is actually unspecified behaviour.
Also, multiple uses of the same variable with side effects in the same sequence point is just undefined behaviour.
>>
>>59206948
>expecting Rust shills to know how computers work
Those so-called "programmers" wouldn't know what ABI means even if it sat on their faces and peed a little.
>>
>>59207223
Forth > C
We don't have any of these problems as execution/evaluation order is clear
>>
>>59207360
Yeah, okay buddy. Call me when Forth beats C in the benchmarks.
>>
>>59207360
ASM >Forth
>>
>>59207200
Right, my mistake.
>>
>>59207223
Literally my fetish
>>
>c burdens the user with design decisions chosen to ease the compiler's job
>C shills defend it, as if we're in 1979
>>
>>59205743
Yeah i don't like all the gay string operations they do. Go does it too.
>>
File: Turing_logo.gif (9KB, 192x132px) Image search: [Google]
Turing_logo.gif
9KB, 192x132px
I'm new to programming, currently programming in turing.
>>
Can someone explain why the below doesn't work? I'm going through SICP. This exercise wants you to make a function that counts the pairs of a structure.

pair-in-struc-n checks whether pair is in a structure. eq? checks to see whether something is exactly the same (so if t = (1 1) it isn't equal to any (1 1), only a particular one.

I try to simply append every pair to the traversed-pairs list and then go through the branches but it just doesn't work for some reason. I use append so that traversed-pairs gets changed and updated through each "branch".

(define (count-pairs x)


(define (pair-in-struc-n pair lis)
(if (null? lis)
false
(or (eq? pair (car lis))
(pair-in-struc-n pair (cdr lis)))))


(define (count-pair-wrap x traversed-pairs)
(display "new") (newline) (display x) (newline)
(display traversed-pairs) (newline)

(begin (append! traversed-pairs x)
(if (or (not (pair? x)) (pair-in-struc-n x traversed-pairs))
0
(+ (count-pair-wrap (car x) traversed-pairs)
(count-pair-wrap (cdr x) traversed-pairs)
1))))


(count-pair-wrap x (list)))
>>
>>59207441
>>design decisions chosen to ease the compiler's job
This does not bother me. Are you the type of person who would actually defend languages like C++ with their ridiculous complexity for compilers and programmers alike?
You literally need to solve to halting problem to be able to parse C++.
>>
>>59207452
Learn something that will get you a job. Normie shit like javascript, java, c#, c, c++, not php
>>
>>59207477
I never mentioned c++, but yes, c++ has a factually bad grammar.
>>
>>59207452

https://en.wikipedia.org/wiki/Turing_(programming_language)

cool the only big canadian programming langua...

>Turing features special functions for drawing maple leaves to allow easier drawing of the Canadian flag.

A
>>
>>59207535
FUCKING
>>
File: 1466559848718-fs8.png (40KB, 469x428px) Image search: [Google]
1466559848718-fs8.png
40KB, 469x428px
>>59207480
is a computer a Turing machine?

it doesn't have infinite memory (infinite tape) though...
>>
>>59207545
LEAF
>>
>>59207535
I wonder how do you write a Binary Search Leaf function in that language.
>>
>>59207441
>c burdens the user with design decisions chosen to ease the compiler's job
Nothing to back this claim. C is still the lowest friction language out there.
>>
Can you guys stop with the C vs the World arguments? It's unproductive and you won't change the state of the industry by shitposting on an anime image board anyways.
>>
>>59207608
You sound ignorant, but thanks for your input, anon.
>>
>>59207627
what about my karma points?
>>
>>59207535
Move aside, Ontario.
http://www.mathstat.dal.ca/~selinger/quipper/
>>
>>59207640
I'm glad you shared your opinion too senpai
>>
>>59207640
Still no argument.
>>
>>59207627
but we did elected trump on pol, so
 we are yet to C who's right 
>>
>>59207480
I was thinking about learning Python or Java next. Thoughts?
>>
>>59207652

sellinger wrote a nice vectorizer too

http://potrace.sourceforge.net/
>>
>>59207693
Who's arguing?
>>
>>59207725
>Quantum algorithm
That's what Trudeau was working on all this time. No wonder he's such an expert on the topic.
>>
The best of both worlds is that you have a type/effect system strong enough to allow the amount of compiler autonomy that C has while preventing the programmer from being able to observe it. E.g. having unspecified argument evaluation order, but using an effect system to ensure that the programmer specifies the order of side effects that depend on one another. If the effects are disjoint then they can be evaluated in any order and it won't make a difference.
>>
How do you read ⊢ in a CS related context?
>>
>>59207774
very slim penis
>>
>>59207774
implies
>>
>>59207774
A ⊢ B means B can be proved using A as the premises.
>>
>>59207774
It's a binary operator. The left symbol is a premise, the right a conclusion. I usually say "infer" but implies works fine as >>59207791 mentions.
>>
why is video game programming the most difficult kind of programming even harder than assembly low level programming
>>
>>59207774
turnstile
>>
can i reduce the number of chars in this statement (make the one-liner shorter)?
{col+=leng; if (flag) {puts("LBRANCH");} else {return VOID;}}
>>
>>59207791
so is it "implies" or "proves"? isn't "implies" also used for another symbol?
>>59207794
I know, but how do you read it?
>>
>>59207899
>I know, but how do you read it?

A ⊢ B" says that, in the logical system, if you start with the assumptions A, you can prove the statement B.
>>
>>59207899
http://www.cap-lore.com/MathPhys/Turnstile.html
>>
>>59207922
That's not what he asked.
>>59207899
I just say "then" or "therefore".
>>
>>59207944
>That's not what he asked.
too bad
>>
>>59207774
Assumptions ⊢ Conclusion

Similar to the idea of implication, not quite the same. Implication is like "given these are true, this is true" whereas turnstile is "these are true therefore this is true".
>>
>>59207922
I know what it means. Are you claiming that you really say "if you start with the assumptions A, you can prove the statement B" every time you want to say A ⊢ B ?
>>59207958
Why do you think this answers the question?
>>
>>59205524
Working as expected
>>
>>59207990
>Are you claiming that you really say "if you start with the assumptions A, you can prove the statement B" every time you want to say A ⊢ B ?
Yes.

Because A ⊢ B" says that, in the logical system, if you start with the assumptions A, you can prove the statement B.
>>
>>59208010
Do you also say "binary addition operator" instead of "plus"?
>>
>>59207990
Why don't you answer the question?
>>
File: 1488447325842.jpg (113KB, 1204x1203px) Image search: [Google]
1488447325842.jpg
113KB, 1204x1203px
>>59208051
Yes.
>>
>>59208068
Why would I be answering my own question?
>>
>>59208075
Why aren't any of these answers good enough?
>>
>>59208074
(((Ruberg)))
>>
>>59208086
No. i need *good* answers for my homework.
>>
>>59208086
I need to know the general and most common way of pronouncing it. which doesn't seem to exist since everyone here reads it differently.
>>
>>59208108
http://imgur.com/a/gMhU8
>>
>>59207375
It does if you treat dup, swap, rot, ect... as hints for selecting which registers to use rather than directly running them. Also I'm on about non-threaded Forth which does beat C since optimization is near assembly level. Oh and it's your job to make it run fast... not the compiler's.

But that's not all! Forth is also easier to develop in and faster.

Forth is like a low level lisp as you can easily do meta-programming in it (something C can't do).
You can define new syntax if you don't like the forth way (even emulate lisp easily).
It takes less space!
Easy to get running in under 1000 lines of assembler.
Direct, Indirect, Subroutine, ect... threaded and compiled! No other language comes even close to the choices forth offers.
You can test your code Live! easily see if your `30 DEG ROBOT ARM MOVE' is doing what it should.
The smallest thing is a Word! want to redefine IF? You can! I'll even bet my house that it's not possible in C.
Type safety? just import a vocabulary with type overlay and you've got it in your runtime! Don't want it? Remove it and your code works fine.
Need a language aware editor? Write one in forth and you'll have direct access to the dictionary!
AST? Who needs it?

>>59207380
every decent forth embeds an assembler so... can ignore the stack and just use it as if it was a macro lang making it an incremental assembly compiler.
>>
>>59208122
The symbol itself is called "turnstile". There's no way to say "A ⊢ B" in English like "A <something> B" though, at best you have "assuming A, B", which is subtly different from "A implies B".
>>
>>59208136
Are you that guy who is writing a compiler or something in Forth for Windows?
>>
never forget the day /g/ defended project from the ruby invaders of indeterminate sex

https://github.com/opal/opal/issues/941
>>
File: 1488321566939.jpg (8KB, 247x248px) Image search: [Google]
1488321566939.jpg
8KB, 247x248px
>>59208134
>this lack of spacing
>that layout design
>these texts
Was /pol/ right?
>>
>>59208168
welcome newfriend
>>
>>59208134
Is this real?
>>
>>59208136
>it's your job

Actually the compiler writers are much better versed in the heavy wizardry of processor instruction set performance and will pretty much always best whatever "hand optimized" code you put out.

You're better off writing semantically clear code that lets compilers infer as much as possible, as globally as possible, as speculatively and aggressively as possible.
>>
File: 1488448829552.png (301KB, 602x689px) Image search: [Google]
1488448829552.png
301KB, 602x689px
>>59208211
>>
>>59208159
Targeting x86 OpenBSD, Linux, Windows, and arm (because why not).
>>
>>59208225
These people are fucking idiots
>>
>>59208136
>Forth is like a low level lisp as you can easily do meta-programming in it
can you show some examples? i'm thinking of learning it pretty soon. i'm not familiar with lisp though.
>>
File: 1483353423237.png (285KB, 720x720px) Image search: [Google]
1483353423237.png
285KB, 720x720px
>>59208244
>people
>>
>>59208219
Have you seen the horror most compilers spew out? Hand written assembler by anyone past beginner level will beat most compilers without really trying.

Pick up arm or x86 and you'll almost instantly see what I mean.
>>
>>59208296
For a big program certainly not, you're guaranteed to kill yourself before you get anything done. However local optimization of output in assembly is a rather common practice.
>>
>>59208296
What's the best resource/book for starting out with x86?
>>
File: 1393889235160.png (247KB, 760x572px) Image search: [Google]
1393889235160.png
247KB, 760x572px
>>59208296
>Hand written assembler by anyone past beginner level will beat most compilers without really trying
I would like to see you write vectorised code for an entire non-trivial program that beats a modern C compiler.
>>
>>59208144
>There's no way to say "A ⊢ B" in English
I refuse to believe this.
>>
>>59208328
"x86" doesn't exist, you'll use different languages depending on which assembler you pick (yasm and gas have an active userbase, don't know about others). If you wanna know about the instruction codes etc, read AMD/Intel's developer manuals.
>>
>>59208352
Not in the same way to can translate "A -> B" to "A implies B", no.
>>
>>59208144
B given A
>>
>>59208402
Not "given", "assuming". There's a difference. But yes, that works.
>>
>>59208134
Is this the same kind of retards which call Stallman opinion on Lisp a political statement?
>>
>>59208369
What should I read it as then? I can't be the only person bothered by the inability to pronounce it while knowing what it means.
>>
>>59208369
There is literally nothing wrong with reading "A ⊢ B" as "A implies B"
>>
>>59208436
"Assuming A, B"
>>
>>59208416
>Not "given", "assuming". There's a difference. But yes, that works.
It's the same thing.
>>
>>59208416
kys
>>
>>59208445
"A implies B" is a true, closed statement of its own. "Assuming A, B" is on a different level. Maybe there's not much of a difference in classical logic but in constructive logic (type theory) it's quite significant.
>>
>>59208479
if the diffrence is so subtle you cant explain it it doesnt exist
>>
>>59208517
This is blatantly false. I don't know how one could think that this could possibly be true.
>>
>>59208074
>Trumb is fashism!

I need this meme to end.
>>
>>59208356
>"x86" doesn't exist,

Of course it does. What fucking drugs are you on? You literally mentioned the notion of instruction encoding in your post. Any retard can come up with assembler syntax.
>>
>>59208596
you need to shut the fuck and stop shart in mart.
>>
Wrote an evolutionary hello world in Haskell:
    module Genes where

import System.Random
import Control.Monad

main = do
putStrLn "Target:"
target <- getLine
let len = length target
putStrLn "Population size: "
population <- read <$> getLine
initp <- randString len
evolve (dist target) population len initp 1

dist :: String -> String -> Int
dist t = length . filter (/=EQ) . zipWith compare t

randChar :: IO Char
randChar = getStdRandom $ randomR (' ', 'z')

randInt :: IO Int
randInt = getStdRandom $ randomR (1, 10)

randString :: Int -> IO String
randString l = forM [1..l] $ const randChar

randStrings :: Int -> Int -> IO [String]
randStrings c l = forM [1..c] $ \_ -> randString l

offsprings :: String -> [String]-> IO [String]
offsprings p os =
forM os $ \o -> zipWithM (\a b -> do
x <- randInt
case compare x 3 of
LT -> return b
_ -> return a) p o

bestEvolution :: (String -> Int) -> String -> [String] -> String
bestEvolution f p os = fst $ foldr (\(wa,a) (wb,b) -> if a < b then (wa,a) else (wb,b) ) (p, f p) os'
where os' = zip os $ map f os

evolve :: (String -> Int) -> Int -> Int -> String -> Int -> IO ()
evolve f pc wl p gen = case f p of
0 -> putStrLn "Evolution completed."
_ -> do
pool <- randStrings pc wl
ofs <- offsprings p pool
let p' = bestEvolution f p ofs
putStrLn $ "Gen: " ++ show gen ++ " | Fitness: " ++ show (f p') ++ " | " ++ p'
evolve f pc wl p' $ gen+1


pls r8 :^)
>>
>>59208607
>Any retard can come up with assembler syntax.
Even you?
>>
>>59208621

No!
>>
>>59208607
apparently assembler syntax is something difficult going from the x86 doesn't exist guy... intel and at&t are just in the opposite order with at&t looking like garbage with %$# in front of everything
>>
>>59204122
first for windows is the best environment for software development
>>
>>59208688
if you use the MonadRandom package, you can instead do

getRandomR (' ', 'z')
getRandomR (1, 10)

since you've imported Control.Monad, you can use
replicateM l a
rather than
forM [1..l] $ const a
>>
>>59208692
I'd bet even YOU could do it. Maybe if you jack up on the amphetamines instead of LSD.

>>59208721
Yeah assembling is just accumulating an output vector. You can literally build an assembler out of easy-to-use function calls and a "context" object. But then it'd not be as "dense", "terse" or 1337 as the asm hackers like it to be.
>>
>>59208767
Thank you
>>
File: file.png (90KB, 680x482px) Image search: [Google]
file.png
90KB, 680x482px
>>59208767
>
forM [1..l] $ const a


Is Haskell the new Perl?
>>
>>59208785
if you're using the latest GHC, there's also
readLn = read <$> getLine

>>59208807

forM [1..l] $ const a is like this:

for (auto _ : range(1,l))
a;


where _ means you don't care about it
>>
>>59208826
>is like this:
>[shit code]
>a is undefined

Is Haskell the new Perl?
>>
>>59208782
My approach was to define the registers and mnemonics as words as lazy
>>59208807
yes
>>59208245
https://www.reddit.com/r/Forth/comments/5wsbgr/forth_is_just_fast_lisp/
How to get it to act like lisp
>>
>>59208859
>a is undefined
So is l, but you didn't complain about that, because you were smart enough to infer that it meant some number.
Similarly, a means some action.

I actually got this a bit wrong, because it's actually like

for (auto _ : range (1,l))
yield a;
>>
>>59208859
>a is undefined
are you fucking moronic?
>>
>>59205912
>>59205893
>>59205766
>>59205743
>>59205722
>>59205650
>>59205630
samefag, rust SJW hating on C.

kys
>>
>>59207549

A computer is equivalent to a Turing machine with a sufficiently large but nevertheless finite amount of tape. Though we will never have the ability to have an infinite amount of memory, we do have the ability to address a fuckload of it.

A 64-bit processor can address 16 Exbibytes of data (18,446,744,073,709,551,616 bytes). Less on x86_64, but it's not the only instruction set on the market. Right now, RAM with the best bandwidth I can find seems to be DDR4-4000, which has a theoretical maximum bandwidth of 35.5 Gigabytes per second (we'll assume decimal is implied here, so 35,500,000,000 bytes). If we had 16 Exbibytes of DDR4-4000 RAM and the fastest possible 64-bit processor, it would take 519,626,593 seconds, or about 16.47 years, to access each memory address once.

Of course, while all CPUs in current use can address no more than 64 bits of data, we do have specifications for some 128 bit CPUs in the form of RISC-V. Assuming we were to create a RISC-V 128 CPU, and we had the had a full 340.2 billion yottabytes (340,282,366,920,938,463,463,374,607,431,768,211,456 to be exact) of DDR4-4000 RAM, it would take a grand total of 303 quintillion (303,743,592,241,023,044,526) years to access each memory address once. While this is certainly be before the heat death of the universe (we'd need to be able to address at least 389 address bits give or take to beat out the heat death), it will be much longer than the time it takes for the sun to explode, enveloping the machine in its burning hot plasma before it has a chance to finish its computation.
>>
@59208863
leave. now.
>>
>>59208886
>Literal projecting
Wow
>>
File: 0a1.jpg (78KB, 643x820px) Image search: [Google]
0a1.jpg
78KB, 643x820px
>>59208890
>>
Anyone can suggest a book to learn about programming principlies/designs/theory/logic?
>>
File: _~.jpg (2MB, 3024x4032px) Image search: [Google]
_~.jpg
2MB, 3024x4032px
>>59208890
>this whole post
bravo
>>
>>59208920
>>59208920
http://www.templeos.org/Wb/Doc/HolyC.html
>>
>>59207458
(define (pairs lis)
(filter pair? lis))
>>
>>59208969
xD
>>
>>59208969
>>>/g/tosg
>>
>>59208890
>it will be much longer than the time it takes for the sun to explode
I'd like to interject for a moment. What you refer to as an explosion is, in fact, not an explosion but as I came to call it an ignition.
>>
File: 1488497073805.png (149KB, 828x801px) Image search: [Google]
1488497073805.png
149KB, 828x801px
>>
First for Python
>>
>>59208890
>a Turing machine with a sufficiently large but nevertheless finite amount of tape
This is not a thing. A Turing machine by definition has an infinite tape.

You're thinking of a finite state automaton.
>>
>>59209054
He's thinking of a Von Neumann machine architecture, which is a cost-effective realization of the Turing machine. I literally don't know why people are even obsessed with this entire Turing machine thing. It's only ever useful for proving shit.
>>
>>59209021
This can't be what I think it is can it?
>>
>>59209054
>infinite
I think "limitless" or "unbounded" is a better word to use here.
In principle, there is nothing stopping you from manually switching the "tape" (RAM/Disk) out and replacing it with a new one when you run out.
A Turing machine which requires infinite tape will not halt.
>>
>>59209073
>cost-effective realization of the Turing machine
No.

Face it, no real machine is a Turing machine or equivalent to one in computing power, yet real machines get shit done, thus proving that Turing completeness is not necessary for getting shit done.
>>
>>59209089
You can't get an unbounded tape by doing that. There's not enough matter in the universe.
>>
software engineering student that mainly uses Java and C here. trying to learn a lisp variant. I was thinking Racket, but what does /dpt/ think?
>>
>>59209101
>computing power
>""get shit done""
>"""proving"""
use words correctly and try using less buzzwords next time if you want your posts to be taken seriously.
>>
>>59209117
Sure, but in _principle_ it works.
I don't know why I can't reply to a very abstract problem with a very abstract solution.
>>
>>59209054

What I am suggesting is that a program that would run on a turing machine will run equivalently on a RISCV-128 machine, because by the time it would take for that program to access all of the finite tape, the machine would be destroyed by the sun.
>>
>>59209101
Whatever, I don't care about Turing machines either way. Some author faggots write obfuscated computer "science" papers where they say their O(n3) algorithm requires a Turing machine as opposed to some finite state automata, and to me it's just "this fucking shit is literally useless and I'm basically wasting everybody's time".
>>
>>59209129
>words and concepts I don't understand are buzzwords
>>
>>59209138
>literally meaningless and retarded words are somehow not buzzwords
ok, i believe you.
>>
>>59209148
>words I don't understand are meaningless
>>
>>59209127
Learn Common Lisp.
>>
>>59209148
>computing power
>a buzzword

Found the pajeet who parses HTML with regex.

>get shit done
>a buzzword

Found the mathematician who mentally masturbates to shit that will never, ever be used and publishes papers nobody cares to read.

>proving
>a buzzword

It's relevant since you can easily identify which problems you shouldn't even attempt to solve. Problems whose solutions are fucking impossible to compute.

It lets you recognize the basic fact that it's extremely valuable to achieve a < 100% general solution and accept some small, literally irrelevant probability of error. And make fucking money on top of that shit.
>>
>>59209162
reread the post you replied to until you get it.
>>59209207
>reddit spacing
Didn't even read your post. it's worthless.
>>
File: aneurysm.jpg (317KB, 640x624px) Image search: [Google]
aneurysm.jpg
317KB, 640x624px
>>59209217
>>reddit spacing

...
>>
>>59209239
>complaining about being called a redditor by giving a reddit style caption meme referencing a reddit series consisting of unfunny reddit humour made by redditors
>>
>>59209239
>>>
yeah, definitely a redditor.
>>
>>59209239
>This entire post
Jesus fucking christ. Get the fuck out of here.
>>
>>59209207
>It's relevant since you can easily identify which problems you shouldn't even attempt to solve.
spotted the brainlet
>>
File: hmm.png (63KB, 200x211px) Image search: [Google]
hmm.png
63KB, 200x211px
>>59209248
>>59209251
>>59209254

>some random pic I have in my 4chan folder triggers people this hard

This is how trolls are born.
>>
>>59209302
Everything in your posts reek of reddit.
Seriously: piss off. Your kind is not welcome here.
>>
@59209302
The redditors seem to be out in force at the moment.
>>
>>59209251
>>59209254
>>59209272
>>59209341
samefagging hard
>>
File: 1479072296915.png (6KB, 480x280px) Image search: [Google]
1479072296915.png
6KB, 480x280px
>>59209341
>>59209379

Tell me about it.
>>
>>59209381
1/4
you got me good
>>
File: 1483025880149.png (56KB, 364x271px) Image search: [Google]
1483025880149.png
56KB, 364x271px
>>59209388
>>
>>59209381
>Posts links to a reply chain
>Calls samefag
You have such excellent perception, you fucking moron.
>>
>>59209341
are you 14? Why do you even care? This is a programming thread... reddit is just a resource like unlambda, mailing list archives, ect...
>>
>>59209404
I just looked at it and it's fucking trash.
Why do """""""""people""""""""" use this?
>>
File: 1487987816210.png (826KB, 731x727px) Image search: [Google]
1487987816210.png
826KB, 731x727px
>>59209404
>not letting the stupid tard keep shitposting
>>
>>59209404
Board quality and community guidelines is important.
Redditors are extremely low-quality posters and just shit the place up.
>>
>>59205916
>What is the most autistic language?

https://esolangs.org/wiki/Brainfuck
and derivatives
https://esolangs.org/wiki/Ook!
https://esolangs.org/wiki/Unary

https://esolangs.org/wiki/Whitespace

https://esolangs.org/wiki/Chef

https://esolangs.org/wiki/Verbose

https://esolangs.org/wiki/Malbolge
>>
>>59209430
>is important
are important*
I reworded the sentence and forgot to change that.
>>
>>59209404
This community is important, please leave.
>>
Java isn't even all that bad that you guys make it out to be you can still make pretty good software in Java especially with JavaFx
>>
>>59209430
>Board """quality""" and (((community guidelines))) is important.
>>>/r/ibbit
>>
File: it never ends.gif (718KB, 500x384px) Image search: [Google]
it never ends.gif
718KB, 500x384px
>>59209430
>>
>>59209443
no, java is trash redditor. leave. just fucking leave and spare yourself from further embarrassment.
>>
>>59209450
Fuck off back to >>>/b/, newfag.
You clearly don't know anything about this place, or even communities in general if you haven't realised this place actually has community "rules".
You can't just come here and act however the fuck you want, without people calling you a fucking faggot and telling you to piss off.
>>
>>59206860
>What are some fun programming problems solving websites these days?

http://rosettacode.org/wiki/Category:Programming_Tasks
>>
>>59209480
>communities
>>>/p/lebbit
This isn't a place where your kind is accepted. On your way now, plebbitor.
>community "rules".
Yes, unwritten "rules". Not (((community guidelines)))
>>
>>59209479
What language do you think is good?
>>
>>59209485
>using reddit style spacing
nobody cares redditor. this community has GUIDELINES and you are shit posting. you have to go back.
>>
>>59209513
D
>>
File: 1484298874454.gif (443KB, 400x296px) Image search: [Google]
1484298874454.gif
443KB, 400x296px
>>59209479
>>59209480
>>59209511
>>
>>59209430
>board quality
This thread turned into shitposting after one person mentioned something they dislike about C... so what quality?
>>
>>59209513
Any procedural language.
>>
>>59209439
Why? I'm one of the only ones here actually doing something other than hello world programs and fizzbuzz. This is pretty much university intro to programming 101 rejects
>>
>>59209439
Fuck off, redditor. Don't spread your bullshit here.
>>
>>59209537
No, it turned to shit after people tried to defend C with the age old fallacy of "you just don't understand"
>>
>>59209547
spotted the guy who has never had to work on an enterprise grade system in his entire life
>>
>>59209565
>>59209511
>4chan is not a community
You're also part of the cancer. I bet you come here because of "le ebin shitposting" or whatever.
"Anything goes because it's le 4chan XDD".
>>
File: 1456007784488.gif (18KB, 340x340px) Image search: [Google]
1456007784488.gif
18KB, 340x340px
>>59209572
>""""""""""enterprise grade""""""""""
>>
>>59209585
Dumb animuposter
>>
>>59209579
Wrong. I never claimed anything of the sort. Don't bring your fucking reddit "community" bullshit here. It's not welcome.
>>
File: 1484251473423.jpg (78KB, 600x600px) Image search: [Google]
1484251473423.jpg
78KB, 600x600px
>>59209565
It's OK you can show daddy where the 'reddit' touched you.
>>
>>59209587
i wonder which website this retard is from.
>>
File: meta.jpg (152KB, 900x675px) Image search: [Google]
meta.jpg
152KB, 900x675px
Are there any good books purely on Software Development/Engineering? There's countless books on Design Patterns and language specific books, but where do I learn what makes for good software engineering/development? Or is a meme, and you actually learn from experience?
>>
>>59209579
that's where you are wrong kiddo. this is our secret dark place of the internet, us outcasts of society. I hate when normies and le redditors SHIT the place up!
>>
File: 1487975696346.png (564KB, 1000x1573px) Image search: [Google]
1487975696346.png
564KB, 1000x1573px
>>59209587
Daily reminder that asuka is best girl.
>>
>>59204958
>double free buffer overflow null pointers
>robust
>>
New thread:
>>59209636
>>59209636
>>59209636
>>
File: 1479232378905.contentawaresatan.jpg (63KB, 600x450px) Image search: [Google]
1479232378905.contentawaresatan.jpg
63KB, 600x450px
>>59209622
>this is our secret dark place of the internet, us outcasts of society.
>>
>>59209613
"The Pragmatic Programmer: From Journeyman to Master" is a decent book, which also isn't mired the whole """design patterns""" shit.
>>
>>59208890
underated
>>
>>59209585
aaaaand confirmed for being a NEET with a superiority complex
>>
>>59209571
Turned to shitposting in the end so doesn't really matter exactly where it went wrong.

And with post like this:
>>59209585
>>59209579
>>59209572
>>59209565
>>59209547
>>59209560
ect...

This was supposed to be a programming thread but ended up like /b/

>>59209613
thinking-forth

It focuses on forth but can be applied to pretty much any language and extends to oop if you get the reprint (online source and pdf are free).
>>
>>59209649
>design patterns are shit
somebody is missing the entire point of design patterns
>>
>>59209686
>Design patterns
Don't mix up what I said. I said """design patterns""" which is a different thing: referring to https://en.wikipedia.org/wiki/Design_Patterns.
I think there are definitely typically patterns of stuff you should do to write good software.
"""Design Pattterns""" however, are just overcomplicated, overengineered shit made up to overcome shortcomings in Java.
>>
>>59209686
Design patterns are completely unnecessary in a non-shit language.

They're an attempt to impose some semblance of order on the hot garbage that is OOP.
>>
File: unknown.png (162KB, 500x300px) Image search: [Google]
unknown.png
162KB, 500x300px
>>59208969

Who needs Thompson and Ritchie when you have Terry and Terry?
>>
>>59209515

I'm not even the guy who spergs have been REEEing at.

Oh noes! I used newlines. The horror!

Oh noes! I gave an answer to anon's question. The horror!
>>
>>59209761
>Oh noes!
Are you 12?
>>
>>59209809
>implying 12yos even know about oh noes

Here. I used a newline again. Are you triggered yet, Mr. Autismo?

A U T I S M O
U
T
I
S
M
O
>>
>>59209861
Why are you sperging?
>>
>>59208969

> no single precision float
>>
>>59209809
>>59209761
>>59209861
Calm down children.

What do you think about functional programming?
also have you seen factor?
>>
>>59209880
This thread is dying. Only shit can come now.
>>
>>59210328
It went wrong the moment you submitted your post and thought that anyone gives a shit.
>>
>>59210416
meanie
>>
I have to learn c# for a job.
I spent two semesters using java about 2 years ago now. How long should i expect it to take to learn c# reasonably well?
They look pretty similar syntactically, any weird caveats i should know?
>>
>>59207705
Java will teach you oop fundamentals that python wont. Learn both honestly they are both marketable, java moreso
>>
Why do I see so many programmers use apple computers for their setups?
>>
>>59211841
so they can spend time programming instead of wasting time setting up arch?
>>
>>59204162
Is this a brainfuck interpreter or some shit?
Thread posts: 335
Thread images: 39


[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.