[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: 332
Thread images: 26

File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
What are you working on, /g/?


Previous Thread: >>58994655
>>
>>59001874
"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman
>>
>>59001882
s/Lisp/Javascript
>>
File: 2017-02-18-161315_419x47_scrot.png (4KB, 419x47px) Image search: [Google]
2017-02-18-161315_419x47_scrot.png
4KB, 419x47px
why isn't this allowed ?
>>
>>59001901
It pains me to say this, because it implies I have some knowledge of the worst and most cancerous language of all time, but I believe you forgot a colon
>>
>>59001907
oh right.
>>
Go is a cute
>>
File: 3.jpg (15KB, 300x200px) Image search: [Google]
3.jpg
15KB, 300x200px
where can i find test cases for my parser?

i mean, files full of integers, doubles, booleans to see if my parser is working correctly
>>
>>59001933
Go is a cute decompensated heart failure
>>
>>59001958
random open source code ?
Q3A for C etc ?
>>
new challenge when?
>>
It's 2017 why the fuck is compiling for android still so convoluted?
>>
>>59001989
yeah kinda

i just want text files that have for example
true
false
123132
5.2
9.0e+9
3555e9
...


or do i have to write it myself?
>>
>>59001994
I demand an AI themed challenge.
>>
>>59002011
It's 2017 and why the fuck are you compiling for android?
>>
>>59002011
Business.
>>
>>59002014
I answered you faggot what do you want
An already-parsed test to test your """"parser"""" ?
>>
>>59002011
what you mean?

you just have to click "Build"
>>
Solving P=NP in Haskell.
>>
>>59002069
>not just importing the solution in python
>>
>>59002045
>the client changes their requirements at the last second
what you mean?

you just have to click "Build"

>you ask your boss for a raise
what you mean?

you just have to click "Build"
>>
>>59002085
but i wrote the library
>>
File: 1473103017550.jpg (71KB, 359x391px) Image search: [Google]
1473103017550.jpg
71KB, 359x391px
>>59002069
P != NP

prove me wrong (you can't)
>>
Does anyone have experience with WebGL and plain JavaScript? How's the workflow compared to OpenGL (3.x) and C++? I've made some 2D on the Canvas with the simple Context2D before, and thought I would give WebGL a shot, but I know that browsers don't like complex code and may cause FPS drops which otherwise runs perfectly fine if it's in a standalone executable. Or was that only because I was only relying on the CPU before?

Any tutorials or documentation worth reading?

How mandatory/helpful would three.js be?
>>
File: 1454879539064.png (395KB, 827x681px) Image search: [Google]
1454879539064.png
395KB, 827x681px
>>59002069

I just felt like you could use this smug anime girl
>>
someone click this link and tell me if the free download for linux button works?

webpage won't load for me I've been trying for 45 minutes

> inb4 "le it's a viruse xDDDDD"

not asking you to download anything
>>
>>59002194

this link

https://software.intel.com/en-us/intel-opencl/download
>>
>>59002138
>How mandatory/helpful would three.js be?
it's THE lib for webGL but feel free to reinvent the wheel if you want to quit half way
>>
>>59002194
Does not load.
>>
>>59002069
Lambda calculus has no a sequential computational model to calculate a function of an input n, pajeet.
>>
Recommend me the best resource for learning laravel framework.
>>
>>59002194
>>59002200
nope
>>
>>59002098
what does that have to do with compiling? during development it's just a key shortcut or a click and doing release builds isn't something you should need to do very often but it's not that complicated you whiny babby
>>
Does Haskell support variadic functions? I was let down when this wouldn't work in GHCi
 (+) 1 2 3 
, because (+) takes an two numbers and returns a number.
>>
>>59002373
You can make variadic functions using type classes, but it's normally not a good idea.

Printf would be an exception.
>>
>>59002381
>but it's normally not a good idea
Why not? I'd rather write
(+ 1 2 3)
than
sum [1,2,3]
.
>>
>>59002409
Why?

And it'd cause havoc for the typing.

Remember that Lisp deals with lists, and that you are complaining about lists.
>>
>>59002420
Because the former looks cleaner.
>>
>>59002433
It sounds nice until you realise how nonsensical it would be syntactically
>>
it should just work but it doesn't
>>
>>59002373
aren't you supposed to use some fold or zip cancer
>>
>>59002069
>let n = 1 :DD
>>
>>59002495
sum = foldr (+) 0

>cancer
how?
>>
>>59002495
Besides sum, one could use
foldr1 (+) [1,2,3]
, but it still looks meh.
>>
>>59002504
what the fuck is wrong with
sum [1,2,3]
>>
>>59002206
May I ask what do you mean by reinventing the wheel without three.js? Is three.js something like GLEW?
>>
>>59002516
Nothing, but my point is that (+ 1 2 3) looks cleaner.
>>
>>59002538
No it doesn't.

Plus, what about operator sections?
>>
>>59002538
>>59002543
Should (+) be 0? How would you refer to addition?
Should (+ 1) be 1? Should people have to write (flip (+) 1)?
What should the type of (+) be?


It makes no sense whatsoever to do that, except in Lisp where everything is a list and dynamically typed

I think 1 + 2 + 3 looks a great deal cleaner than (+ 1 2 3)
>>
>>59002543
>No it doesn't.
Yes, it does.
>operator sections
As in partial application?
>>
>>59002566
Operator sections aren't just regular partial application, they're an extension of infix syntax

(x /) and (/ x) are two different things
(/) is its own thing

Your idea, which only sounds good to people who use lisp, and which would reach into and make every other part of the language worse, is not a good idea.

Just use

1 + 2 + 3

or

sum [1,2,3]
>>
>>59002594
OK, so no variadic functions for me.
>>
>>59002608
You can make them if you want, but the type inference is normally god awful and you may even need to write the type of every argument

http://stackoverflow.com/questions/3467279/how-to-create-a-polyvariadic-haskell-function

printf is an example of an excellent variadic function (Text.Printf)

90% of the time, you do not want a variadic function
>>
>>59002627
and even printf would be better dependently typed
>>
>>59002555
Not everything is a list in Lisp. While Lisp is also dynamically typed, the programmer can provide type annotations that can be checked at compile-time (SBCL, for instance, does static checking when it can, if declarations are made).
>>
>>59002608
>>59002631

In fact printf is even better than a variadic function, because it also doubles as sprintf
>>
File: kawaiipepe.jpg (33KB, 480x480px) Image search: [Google]
kawaiipepe.jpg
33KB, 480x480px
>>59001874
Is the for loop the most kawaii loop?
>>
>>59002726
What the fuck did I tell you, you stupid damn frogposter ape?
Go back to r9k and take your shitty C loop with you
>>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct result {
int64_t result;
uint64_t steps;
} result_t;

result_t fib1(uint8_t n)
{
result_t result;
result.steps = 1;

if (n <= 1) {
result.result = n;
return result;
}
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
result.steps += 1;
}

result.result = d;
return result;
}

result_t fib2(uint8_t n)
{
result_t result;
result.steps = 1;

if (n <= 1) {
result.result = n;
return result;
}

result_t r1 = fib2(n - 1);
result_t r2 = fib2(n - 2);

result.result = r1.result + r2.result;
result.steps = r1.steps + r2.steps + 1;

return result;
}

int main(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: %s <n>\n", argv[0]);
return -1;
}

int8_t n = atoi(argv[1]);

result_t r1 = fib1(n);
printf("Method 1: result = %ld, steps = %lu\n", r1.result, r1.steps);

result_t r2 = fib2(n);
printf("Method 2: result = %ld, steps = %lu\n", r2.result, r2.steps);

return 0;
}


Algorithmic complexity matters, /dpt/
>>
>>59002814
fibs = 0 : 1 : (zipWith (+) <*> tail) fibs


Computes fibs 100k pretty quickly
How fast does that?

>inb4 too big for int64s
>>
>>59002826
If you use arbitrary precision integers instead of 64-bit ones, then fib1 is logarithmic and fib2 is exponential. I guess your Haskell one is linear?
>>
>>59002726
yes
>>
Trying to organize my objects properly.


I have a "container" file object that is basically an interface to opening a zip-like file

Container.Open("blah.container")

and I want to be able to just read files from this container

should the "Container" have a "current file" context?
like Container.SetCurrentFile("/foldername/filename.txt")
Container.seek(0xbeef)
Container.read(0xbeef)

or should I have it produce some "ContainerEntry" type that stores a reference to the parent "Container" object

Entry Ent = Container.GetEntry("/filename.txt")
Ent.seek(0xbeef)
Ent.read(0xbeef)

What would GetEntry return if the file didnt exist?

would I be using a weak_ptr within the Entry type to point to the Container file that produced it?

Does the Entry-Type set "Container" as its friend class and hide its constructor so that "Container" is the only thing that can produce Entry instances?

Hell any resources involving knowing when to use certain OOP patterns in certain situations would help.

I always hear about the patterns but I never see proper case-studies of them being put to use.
>>
>>59002845
fib (10*100000) is definitely much more than 10x slower
>>
>>59002845
>>59002864
In fact it is probably 100 times slower.
Also this isn't memoized, a memoized array version would be much better.
>>
>>59002518
https://en.wikipedia.org/wiki/Three.js
>>
public class ConsoleMain
{
public static void Main()
{
double[] numbers = { 1, 2, 3, 2, 5 };
double m1 = M(numbers); // should return 3
double m2 = M(new double[] { 1 }); // should return 1
double m3 = M(new double[] { 3, 3 });
double m4 = M(new double[] { });
Console.WriteLine(m1);
Console.WriteLine(m2);
Console.WriteLine(m3);
Console.WriteLine(m4);
}
public static double[] M(double [] numbers, double M)
{

}
}


How do I return the number from this array that is closest to that array's average?
>>
>>59002845
Just found an insanely fast fib on the wiki
Effectively uses the matrix form

import Data.List
import Data.Bits

fib :: Int -> Integer
fib n = snd . foldl_ fib_ (1, 0) . dropWhile not $
[testBit n k | k <- let s = bitSize n in [s-1,s-2..0]]
where
fib_ (f, g) p
| p = (f*(f+2*g), ss)
| otherwise = (ss, g*(2*f-g))
where ss = f*f+g*g
foldl_ = foldl' -- '
>>
I'm looking for an online weather service I can request without making an account. I'm using NOAA right now, but I can't find one for outside of NOAA's scope. Does anybody know of any?
>>
>>59002936
so it's basically for making websites. i think anon just wants more of a plain opengl for games or something
>>
>>59002138
js and webgl runs like shit like what are you even trying to do
>>
>>59002957
Ugly.
>>
>>59002936
Thanks!

>>59002965
Yes, basically. I've done that before with plain JS on the canvas, and I'm experimenting with OpenGL for some time now, and wondered how the two looks like together.

>>59002993
Games.
Yeah, I've looked up some examples now, and for some reason I get a small freeze every 5-6 seconds for no real reason.
>>
>>59002965
>so it's basically for making websites
no.

http://hexgl.bkcore.com/
>>
>>59003002
Ugly but insanely fast
>>
>>59003018
>autism
unless you're trying to be the next agar.io or slither.io i don't see why you'd do it in webgl specifically. you could use a more full-featured game engine and port it to webgl instead of learning something as web-specific as three.js
>>
>>59003002
Thanks for your thoughts on that kode.
>>
>>59003044
who gives a fucking shit he was asking if three.js was mandatory for making webGL apps, yes it is

>full-featured game engine and port it to webgl have you ever coded something functional in your life ?
>>
>>59003061
js should be banned on the web, http stands for *hypertext* transfer protocol
>>
>>59003061
you don't even have to make the engine yourself (but with three.js you're basically doing it because it has such basic functinoality) but for example the unity engine supports webgl/html5
>>
>hexgl
what a shitty "game"
>>
>>59003086
No es un argumento
>>
>>59002956

halp
>>
>>59003259
>Properly round float average (in math.h)
>Iterate again to find the smallest difference between your new int average and your values
>>
>>59002956
>compute average
>loop through it again, compare abs(i - avg), save lowest distance to average and the corresponding number
>>
apparently you're not supposed to directly access a char* by index and assign data to that?
void foo(){
if(globalChar != nullptr){
delete[] globalChar;
globlaChar = nullptr;
}

globalChar = new char[20];
for(int i =0; i < 20; ++i){
globalChar[i] = theSameSequenceOfBytesEveryTime;
}
std::cout << globalChar << std::endl;
}


globalChar would randomly end up being different with consecutive function calls, sometimes somehow random bytes were attached at the end?
>>
>>59003378
you forgot the null terminator
also use std::string
>>
>>59003378
>globlaChar
>>
>>59003422
He should use bounded stri... Oh wait.
>>
File: IMG_0019.jpg (34KB, 500x436px) Image search: [Google]
IMG_0019.jpg
34KB, 500x436px
So I was thinking about training a neural net to make trades on the stock market. What do you guys think? Is such a thing even possible?
>>
>>59003450
Yes.
>>
>>59003422
but it's not supposed to be a string, it's just bytes
>>
>>59003466
>but it's not supposed to be a string, it's just bytes
But you're treating it as a null-terminated string.
>>
>>59003466
then use std::vector<char>
>>
>>59003378
you're writing the pointer value to stdout, not the actual bytes in your array.
>>
>>59003450
HFT companies thought of this long ago, and have been pouring millions of dollars a year into machine learning applications for trading. You're up against them, because short-term trading is a zero sum game.
>>
Checking out Crystal, its pretty good
>>
>>59003509
cout prints char *s as strings, not addresses.
>>
>>59003466
cout assumes char * are null terminated strings.
Use a function that takes a char * and a count if you wanna print out just 20 chars.
>>
>>59003510
Not to mention that they have the money to run fiber through mountains and get servers next door to exchanges, some random on /g/ doesn't.
>>
>>59003378
post your whole code
>>
>>59003485
i don't understand, does cout not know how long char* is without a \0? how does delete[] work then?
>>
>>59003595
Implementation-dependent, but typically new/delete are implemented with malloc/free and malloc'd blocks store their length.
>>
File: BYShwSK.jpg (149KB, 625x838px) Image search: [Google]
BYShwSK.jpg
149KB, 625x838px
>>59001958
https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/blns.txt
>>
Trivial question: how would you format this properly?
for i p f job = 
if p i then do job i
for (i + 1) p f job
else return ()
>>
Do you guys have any suggestions for things to write in Assembly. I already made a Fibonacci sequence with hex printing and a text editor. and I need more ideas.
>>
>>59003646
sudoku solver
>>
>>59003466
>but it's not supposed to be a string

Then why are you trying to print it like a string?

Why would passing the first address to a char* print each value of the array?
What are you smoking?
>>
"I like currying"

Okay tier:
filterMap predicate transform = filter predicate . map transform


Kill yourself tier:
filterMap = (. map) . (.) . filter
>>
>>59003646
lisp interpreter
>>
>>59003646
basic raytracer
>>
>>59003656
filterMap = fmap (fmap (flip fmap fmap) fmap) filter
>>
>>59003309

can you do it for me senpai?
>>
I'm using snek (Python). I'm trying to implement a k-nearest neighbour-algorithm, but I've run into issues with the voting.
Below is my implementation of a voting scheme. The idea is to have two lists (blue and red) each containing the k points of their class closest to a test point. My code doesn't work; it just outputs that red gets all the votes whatever values I feed into the function.

Where am I going wrong?
Bonus question: is there a better way to implement a voting scheme (which must, of course, be sensitive to what class a particular data point belongs to?)

def neighbourVote(k, blueDistSmallest, redDistSmallest):
iterate = 0
blueIterate = 0
redIterate = 0
blueVotes = 0
redVotes = 0
while iterate < k:
if blueDistSmallest[blueIterate] < redDistSmallest[redIterate]:
blueVotes += 1
redIterate += 1
iterate += 1
print "Blue", blueVotes
else: # redDistSmallest[redIterate] < blueDistSmallest[blueIterate]
redVotes += 1
blueIterate += 1
iterate += 1
print "Red", redVotes
>>
>>59003790
I don't know what it's supposed to do but keep in mind that the else branch will also execute when the values are equal, not only when red < blue.
>>
>>59001874
Haskell is unreadable shit and will never be successful.
>>
File: programming-languages.jpg (129KB, 640x369px) Image search: [Google]
programming-languages.jpg
129KB, 640x369px
>>
>>59003961
I'm dedicating my life to it.

Either two things will come from it, I will be a master of a dead language and all will come to me for obscure help when it rarely pops up, or I will be known as the most autistic man on earth

Because even learning ancient Egyptian would have more use.
>>
>>59003844
>I don't know what it's supposed to do

It's supposed to compare two lists and find the smallest values. Each list has k values, but the function should stop when a total of k values have been selected. In some cases, all values will come from one list, but in other cases the values will be a mix of both lists. The list that has the largest amount of small values "wins". What I'm trying to achieve is the voting segment of k-nearest neighbour algorithm (https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm).

>keep in mind that the else branch will also execute when the values are equal, not only when red < blue.

That's true, thanks! I'm thinking of trying something like this:

def neighbourVote(k, blueDistSmallest, redDistSmallest):
iterate = 0
blueIterate = 0
redIterate = 0
blueVotes = 0
redVotes = 0
while iterate < k:
if blueDistSmallest[blueIterate] < redDistSmallest[redIterate]:
blueVotes += 1
redIterate += 1
iterate += 1
print "Blue", blueVotes
elif redDistSmallest[redIterate] < blueDistSmallest[blueIterate]:
redVotes += 1
blueIterate += 1
iterate += 1
print "Red", redVotes
else: #redDistSmallest[redIterate] = blueDistSmallest[blueIterate]
randomVote = random.random()
if randomVote > 0.5:
blueVotes += 1
redIterate += 1
iterate += 1
print "Blue", blueVotes
else: #randomVote <= 0.5:
redVotes += 1
blueIterate += 1
iterate += 1
print "Red", redVotes
>>
>>59004005
What a waste.
>>
>>59004034
My life is pretty shit it's not really a loss.
>>
>>59002108
Choose N=1.

Check mate Computer scientists.
>>
>>59003774
start with this:

        double average = numbers.Average();
Console.WriteLine("The Average is: {0}", average);
>>
>>59003510
What if I want to train it to do the job that basically a wealth management guy would do? So train it to be able to do longer term investing?
>>
>>59004546
>not doing
Console.WriteLine($"The average is: {numbers.Average()}.");
>>
Let's be unironic: Java has better IDEs and better instrumentation than other mainstream languages.
>>
>when people don't treat O(log(n)) as O(1)
fucking nerds
>>
>>59004546

I've already found the average on my own, that's the easy part.

Could you help with the other part? Thank you.
>>
>>59005037
C# + Visual Studio > Java
>>
>>59005037
Not really you can use emacs easily with other languages but java is just fucking retarded to get to work with emacs.
>>
>>59005037
this
>>
>>59005057
>log
>not ln

triggered
>>
>>59005169
>not lg
WOWWOWOOWWW!!!
>>
I'm looking to get into AI. What books should I start with?
>>
>>59005197
Artificial Intelligence: A Modern Approach

Then find a machine learning book, since that's all the rage nowadays
Elements of Statistical Learning
the bishop book
>>
File: 1427699231500.gif (569KB, 640x636px) Image search: [Google]
1427699231500.gif
569KB, 640x636px
>>59002856
plz
>>
>>59005169
>any algorithm
>actually using base e
fucking nerd terminate your execution
>>
>>59005133
Can C# be considered mainstream if it's useless on the server?
>>
Coding a 2D twisting puzzles game.
>>
>>59005169
>ln
I am triggered, tbqh
>>
>>59005383
Forgot the webm.
>>
Challenge: reimplement a function from the standard library of a programming language of choice, using only functions from the standard library of that language.
>>
>>59005419
I just call the function. 2ez
>>
I'm making a small Java multithreaded farm application to practise, it's basically farmers acquiring jugs and milking cows, then storing it into a shared pool. The way I acquire jugs is simply by setting their isTaken private variable and later setting it to false. I'm guessing this is bad and I should use something like locks instead, can someone explain why?
>>
>>59005423
Without using the function, should've said that.
>>
>>59005419
readLn = read <$> getLine
>>
>>59005383
>>59005402
What language?
>>
>>59005438
OCaml.
>>
>>59005435
Karen bls.
>>
>>59005508
sum = foldr (+) 0

map :: (a -> b) -> [a] -> [b]
map = fmap
>>
Any websites with business related challenges for COBOL that I should know about ?
>>
>>59005527
People who know COBOL don't know how to make websites.
>>
>>59005527
Should have known about?
>>
>>59005560
COBOL programmers are so old they probably can't even use a computer
>>
i see you people often suggest to use gcc but now i'm watching this talk by a google engineer and he says gcc is garbage
>>
>>59005594
>google
Implying google is competent.
>>
>>59005560
>>59005562
Like examples of business COBOL programs and guides

Gajin
>>
>>59005594
Compromise halfway and use the g and the c but not the middle c

ghc
>>
>>59005419
#include <ctype.h>
#include <stdio.h>

int atoi(const char *a) {
int result = 0, tmp, neg;
while (isspace(*a))
++a;

if ((*a == '+') || (*a == '-')) {
neg = *a == '-';
++a;
}
while ((*a >= '0') && (*a <= '9')) {
if (result == 0)
result = *a - '0';
else
result = result * 10 + (*a - '0');
++a;
}

if (neg)
result *= -1;
return result;
}

int main() {
char *ten = " 10asd";
char *minus = "-3";
char *invalid = " x-3f3";
char *derp = " +09fs";
printf("%d\n", atoi(ten));
printf("%d\n", atoi(minus));
printf("%d\n", atoi(invalid));
printf("%d\n", atoi(derp));
return 0;
}


10
-3
0
9
>>
>>59005675
>if (result == 0)
> result = *a - '0';
> else
Wait, those lines are completely pointless. Please ignore them.
>>
>>59005560
http://www.coboloncogs.org/INDEX.HTM
>>
>>59005594
Don't let yourself get memed by my boy Chandler.
>>59005634
It's Gaijin you fucking weeaboo faggot.
>>
>>59001882

Wait, then why is GNU mostly made out of C projects?
>>
File: output.webm (494KB, 1920x1080px) Image search: [Google]
output.webm
494KB, 1920x1080px
Fuck yeah, it's blinking
>>
>>59005857
Yeah why isn't the gcc a lisp low level lisp implemenation?
>>
Anyone here ever coded a bot for multiplayer games? It's such a cool project.
>>
>>59005057
In practice everything is O(1) since memory (i.e the potential maximum size of any integer) is always finite.
>>
>>59005936
>>59005057
>fucking nerds
like pottery
>>
>>59005868
GENTLEMEN, YOU HAVE CREATED... THIS THING?
>>
>>59005936
Yes, but it's not Turing complete.
>>
>>59005402
what's up with the lines getting all fucked after snapping the rect
>>
>>59005868

you're cancerous
>>
>>59005868
(in binary) "PLEASE KILL ME"
>>
What is more marketable and makes better money, PHP or JavaScript?
>>
>>59006096
cuckscript def
>>
>>59006011
Development version. I think it's fixed. I was just making rotation of 20pi+pi/2 instead of just pi/2
>>
>>59005868
Attach a motor with a offset weight. Congrats on your new vibrator.
>>
>>59005857
The 'official' GNU language is Guile which is a scheme.

The official GNU distro these days is Guix/GuixSD, which is a functional package manager entirely configured in scheme.

The FSF should make a bunch of Common Lisp courses or books, it is truly the best language you will ever use in your life to just hack around and do crazy shit in.

>>59005907
It was originally, much like the idea of Bootstrapping in the dragon book if you've read it. You start with Lisp, add some of the language you wish to implement then you finish off the compiler in said language, at least in the gcc case.
>>
>>59006096
PHP is still everywhere, if you learn everything there is to know about Wordpress themes/plugins, and write your own little security firewall to prevent somebody from calling internal wordpress functions by blocking those requests you will make more than enough money to live comfortably these days with the billions of Wordpress jobs out there. There's also Salesforce, Magento, ect which are all php.

Javascript you can learn w/PHP to use both. Google 'You Don't Know JS' book series and read them
>>
>>59006252
>You Don't Know JS
You don't know me.
>>
Is it possible to catch something like an access violation within your program? I'm using C++ in Visual Studio. The current behavior is that the program closes and Windows displays the "blah.exe has crashed, Windows is searching for a solution to this problem..." dialog. I'd rather just catch it internally and display something like "You suck at programming and your exe crashed when trying to access memory location XXXXXXXX."
>>
>>59006260
edgy post
>>
>>59006260
>You can't read

It's the title of the book series, you plebbit tier retard
https://github.com/getify/You-Dont-Know-JS
>>
>>59006260
Are you Jack?
>>
File: iwinagain.gif (4MB, 800x450px) Image search: [Google]
iwinagain.gif
4MB, 800x450px
Apologies for not being programming related but where does OP find these edited anime pictures?
>>
>>59006274
bleh never mind, I guess I forgot google existed for a minute there
>>
>>59006306
It's as if someone created them with a computer or something. Quite amazing, actually. Antother fine tool for acquiring such images is LURK MOAR
>>
File: Untitled.png (1MB, 1920x1080px) Image search: [Google]
Untitled.png
1MB, 1920x1080px
>>59006306
I made it myself
>>
>>59006306
he finds them inside his photoshop application
>>
>>59002108

Prove that I could not prove it wrong.
>>
>>59006334
How does he run Photoshop on Source Mage?
>>
>>59006363
wine 3.11
>>
>>59006225
>2017
>no superior haskell OS that uses categories and functors instead of files and programs
>>
>>59006368
>wine 3.11 (staging)

FTFY
>>
>>59006391
Do I need to set O_CLOEXEC to close over my categories on exec?
>>
>>59006391
>the f in fmap stands for file
>directories are just endofiles in monoidal catOSes
>>
File: Screenshot_2017-02-18_23-59-59.png (168KB, 771x654px) Image search: [Google]
Screenshot_2017-02-18_23-59-59.png
168KB, 771x654px
Added mascots to a shity imageboard. What stupid feature to implement next?
>>
>>59006439
add a big sign at the top saying "ANIME IMAGEBOARD"
>>
I'm using Python. I need to create an array of values, where each value must have an associated class. A dict would be nice but it doesn't allow me to assign a class to each value.

In other words, I'd like something like myDict = {1:"A", 2:"B", 1:"B", 0:"A", 2:"A"}, but that obviously won't work because it can't be ordered (I would like to order myDict so that it looks like myDict = {0:"A", 1:"A", 1:"B", 2:"A", 2:"B"}, so that I can then count some number n of first instances).

Halp?
>>
File: Screenshot_2017-02-19_00-09-09.png (18KB, 769x135px) Image search: [Google]
Screenshot_2017-02-19_00-09-09.png
18KB, 769x135px
>>59006456
Already there.
>>
>>59006532
Array of tuples
>>
I wonder if they're good programmers...
https://www.youtube.com/watch?v=d84HikrUDRI
>>
>>59006551
no you need to make sure that everyone will definitely remember forever and that it will never change for any board
>>
>>59006595
Why?
>>
>>59006656
look at what happened to 4chan
>>
>>59006682
Good point, I guess. Not that it matters with the little exposure there will ever be.
>>
# Prompt for input to "guess" variable [00,61]; input other than an integer 
# is ignored.
import time
x = int(time.strftime('%S'))

wrong = 'Not an integer.'
while True:
try:
print('Guess an integer: ')
guess = int(input())
except ValueError:
print(wrong, '\n')
continue
break

while guess != x:
while guess < x:
try:
print('A little higher.\nGuess again:')
guess = int(input())
continue
except ValueError:
print(wrong, '\n')
continue
while guess > x:
try:
print('A little lower.\nGuess again:')
guess = int(input())
continue
except ValueError:
print(wrong, '\n')
continue
continue
print('Congratulations, you guessed it!')

What's wrong with this? I got a C, despite fulfilling the requirements with 18 LOC left over while adhering to PEP8 .
>>
>>59006748
You used python instead of programming language.
>>
Is there money to be made making apps for iPhone and Android?
>>
>>59006776
no they are dead.
>>
>>59006787
Really? Why?
>>
>>59006748
answer = int(__import__('time').strftime('%S'))
reply = None

while reply != answer:
try:
print('> Input:')
reply = int(input())
except (ValueError, ):
continue

if reply < answer:
print('>> Too low, guess again:')
elif reply > answer:
print('>> Too high, guess again:')
else:
break

print('>> Congratulations, you guessed it!')
>>
>>59006748
>while True
>double nested while loops
>using while loops for conditional checking instead of if/else inside of a single main loop
Because you wrote it like a fucking orangutan
>>
>>59006748
Your code is needlessly complex, less loops, breaks and continues
>>
>>59006748
Do you not fucking understand the concept of a function?
>>
>>59006737
>>
>>59006878
>persons who has never programmed trying to shill dead language
>>
>>59006878
Does that moron thing Linux is written in C++?
Also:
>No other languages can provide safety, concurrency and speed at the same time.
Rust doesn't provide speed, unless you think being faster than Python is some kind of achievement.
>>
>>59006868
>muh FP
>>
>>59001874

What's better:

OpenCL with C89 from the official spec

or

OpenCL bindings in C++
>>
>>59006938
Where is it said that Linux is written in C?
>>
>>59006963
the source code
>>
>>59006951
>using functions is FP
I bet you also think using structs is OOP.
>>
>>59006966
I mean't isn't*
>>
>>59006938
>Rust doesn't provide speed
>
>>
>>59006938
https://blog.rust-lang.org/2015/05/11/traits.html
>>
>>59007028
>Believing meme posts
>(probably written by that hipster faggot)
>not doing your own benchmarks
wew
>>
>>59006977
structs aren't objects
functions are functions
>>
>>59007016
>>59007028
Rust is inherently slow. Traits just don't make it even more slower.
>>
>>59007054
>>59006951
This is one of the stupidest statements I have heard on here is a long time.
It's too stupid though. It must be bait.
>>
>>59007060
>Rust is inherently slow.
>
>>
>>59007050
Top quality argument, son. I guess I can guess your age now.
>>
File: linus_torvalds_on_cpp.png (102KB, 614x1248px) Image search: [Google]
linus_torvalds_on_cpp.png
102KB, 614x1248px
>>
>>59007060
>Rust is inherently slow.
C is inherently slow, if by speed you mean faster than python it's not a big achievement
>>
>>59007091
Linus is a god, C is the only good language.
>>
>>59006812
I see. But is the last else statement required, seeing as the loop will break itself?
>>59006821
>double nested while loops
What's wrong with these? They're recommended all over, even tutorials for beginners teach them as a neat trick.
>>59006831
>Your code is needlessly complex
It's not complex at all though, but I see yours and everyone else's point.
>>
>>59007114
What's the point of C these days?
>>
>>59007126
Elegance and efficiency.
C is still going strong, and isn't going away any time soon.
>>
>>59007126
Being a fag like linus
>>
Rust could become a really nice language in a few more years. Currently it's semi-shit, because the docs are shit, the compiler will sometimes go on a bitch fit about perfectly valid code, can not parse C headers to easily include libraries and the abstractions aren't all optimised away to compare to C/C++.
>>
>>59007151
>C
>abstractions
hmmm
>>
>>59007126
Showing you have a big dick and not a tiny dick who needs garbage collection, automatic memory management, or anything gay like that.
>>
>>59007126
Writing libraries to be used in other languages.
>>
>>59007165
>I have a big dick because I am a C programmer
>Programming in C is the epitome of being a man
holy shit you can't make this up
>>
>>59007185 has a tiny dick
>>
>>59007160
C abstracts assembly.
>>
>>59007143
>isn't going away any time soon.
So is C++ and Java.
However I firmly believe Rust is way better as a language.

Rust will not be able to replace C in a long time. But I don't see the reason of C++ anymore (except for the legacy libraries)

Picture related, a 20 y/o language is being caught up by a 2 y/o. Rust is only getting better and C++ is going down the gutter with along with all the abomination that are created around it
>>
>>59007185
Those grapes sure are sour, aren't they?
>>
I have a big dick and use GCed languages. Checkmate!
>>
>>59007213
>That small gap
I can trade that with memory safety, data race prevention and maintainability
>>
>>59007213
>meme benchmarks
>>
>>59007213
>all the Rust code written in unsafe-blocks
>Rust is so much betar than C++ you guiz!
>>
>>59007213
>C++ like 0.02 second faster
>HURR DURR RUST IS SLOW XD
>>
>>59007213
>However I firmly believe Rust is way better as a language.
I can agree with that somewhat, however the current tooling and library pool is too incomplete.
>>
>>59007248
source

>my fat ass
>>
Haha this blue website is trying to get me to use Rust dude lol
>>
>>59007229
http://benchmarksgame.alioth.debian.org/u64q/rust.html
>>
>>59007257
When UNIX was written, there were practically no tooling and library
>>
>>59007272
>>>/auschwitz/
>>
>>59007264
No you can see the source in the benchmark you fucking retard.
>>
>>59007273
>mfw the only C program that's slower includes some dum TCL library and calls functions from there
>>
>>59007279
Yes, and?
>>
File: Kirk_mit_Tribbles.jpg (124KB, 1431x1065px) Image search: [Google]
Kirk_mit_Tribbles.jpg
124KB, 1431x1065px
>>59007310
Forgot my face.
>>
>>59007323
Doesn't mean UNIX and C were successful
>>
>>59007273
>>59007330
Linux API is in C
>>
>>59007273
C is slower than ASM
>>
>>59007350
>Linux API is in C
What did he mean by this?
>>
>>59007367
Linux programming interface is built on C
>>
>>59007367
He wanted to demonstrate that he's at least as retarded as >>59007334
>>
>>59007374
And here I thought it was assembly.
>>
>>59007374
What exactly does an ABI have to do with any specific programming language again?
Oh, right. Absolutely nothing.
Glad we could clear that up.
>>
>>59007350
Actually, Linux's API is used with syscalls, which is not something you can do directly with C, or any programming language really. A small amount of hand-written assembly is used.

>>59007366
That is a completely worthless statement.
By virtue, nothing can be "faster" than assembly, because everything gets run as assembly.
Also, you're incredibly naive if you think you can outperform a modern optimising C compiler in the general case.
>>
>>59007393
>assembly
what
>>
>>59007399
>What exactly does an ABI have to do with any specific programming language again?
ffi
>>
>>59007423
>Also, you're incredibly naive if you think you can outperform a modern optimising C compiler in the general case.
> in the general case
What ze fuck is the general case
>>
>>59007451
A normal program.
>ze
You should fuck off.
>>
>>59007429
>not sure if trolling or retarded
>>
>>59007423
Who said anything about outperforming C? See >>59007229

Discussion was originated as Rust vs C++, Turdbrain C faggots wanted to fit in
>>
>>59007468
>A normal program.
Normal C programs use linked lists because resizing arrays is too much work.
>>
>>59007497
kek
>>
>rust fags shitting up /dpt/ again
>>
>>59007478
>Rust vs C++
>new shit vs a bigger, older pile of shit
I choose C.
>>
>>59007514
Not even a Rust fag. I'm just correcting the record against the fake news.
>>
>>59007520
C is a bigger pile of shit, I choose ASM XDD chec8 :DDD


Get the fuck out
>>
>>59007497
Not since the early 2000's. Iterating over arrays is so much faster that occasionally resizing them and some memcpy'ing is preferred over the use of linked lists.
>>
>>59007520
What's the point of C again?
>>
>>59007538
https://kjellkod.wordpress.com/2012/02/25/why-you-should-never-ever-ever-use-linked-list-in-your-code-again/
>>
>>59007520
I use Java unironically.
>>
>>59007536
Hex editor too hard for the little baby?
>>
>>59007554
&C
>>
>>59007525
>fake news
>>>/pol/
>>
>>59007566
No, little toddler I program in pure binary. C is for retards that can't into binary
>>
>>59007514
Rust fags shit up everything.

Everywhere you go somebody starts derping how X language is totally bad! Let's only use Rust instead!

The fact that nobody has written shit in Rust yet beyond a toy project escapes them. Show me a webserver that rivals NgineX, Servo that can do anything FF or Chromium can, or even just a simple router daemon in Rust and maybe I'll care about Rust but until then it's just a meme and not even worth looking at
>>
>>59007583
>Actually calls 'machine code' 'binary'
Good job proving to everyone that you're an idiot who doesn't know anything.
>>
File: heartbleed-bug-inside.png (59KB, 640x375px) Image search: [Google]
heartbleed-bug-inside.png
59KB, 640x375px
>>59007570
Surely convinced me

Anyone else?
What's the point of C again?
>>
>>59007592
>Everywhere you go somebody starts derping how X language is totally bad! Let's only use Rust instead!
see >>59007520 (yourself)
>>
>>59007578
Made up news and hoaxes are fake news, this isn't a /pol/ or stormnigger probaganda, this is real.
>>
>>59007599
I also code in binary instead of C(/++)

Does it hurt you?
>>
>ITT: babbies who can't code a CRUD app in webdev or a simple SDL minigame argue about bullshit language-war they read on wikipedia and 4chan and hackernews all day
fuck
off
to
/v/
this
is
not
ps4
vs
xbox one
>>
>>59007614
yes go spread rust propaganda to >>>/pol/ or >>>/reddit/
This is programming thread.
>>
File: shellshock-bug-100457107-large3.png (123KB, 580x388px) Image search: [Google]
shellshock-bug-100457107-large3.png
123KB, 580x388px
>>59007604
bump
>>
>>59007592
>a webserver that rivals NgineX, Servo that can do anything FF or Chromium can, or even just a simple router daemon in Rust
These were impossible in Rust up till the start of this year due to very poor async support. The fastest full-featured HTTP server up to that point was 16 times slower than even Go's. I doubt they have managed to do any of these by now either.
>>
>>59007666
>These were impossible in Rust up till the start of this year due to very poor async support.
wtf are you talking about. are you saying C has """async support"""?
>>
>>59007693
C can use epoll just fine without a lot of hassle.
>>
>>59003988

Change "best tier" with "shit tier" tier and it's pretty accurate..
>>
>Post a Rust vs C++ argument
>C++ fags get muted
>Insufferable C faggots jump straight in
Why the FUCK are C toddlers so insecure?
>>
>Even apart from that speed/safety compromise issue, I'm also skeptical about the language's design as such. In particular as regards to the five types of pointers used in it. On the one hand, it's not bad to make programmers ponder if their variables are stored in the stack or heap and if they can or cannot be handled by several threads at a time. But on the other hand, imagine you are writing a program and discover at one moment that some variable should be stored in the heap instead of the stack. So you rewrite the code to use Box. Then you figure out that you actually need Rc or Arc. Again, you rewrite all that code. And then, once again, you rewrite it all to have an ordinary variable in the stack. All of that you have to do without a decent IDE at hand. Regular expressions won't help. Or you might just end up with a nightmare like "Vec<Rc<RefCell<Box<Trait>>>>" - say hello to Java! But the saddest thing about it is that the compiler already knows everything about the lifetime of every variable and could automatically insert all those Box's, Arc's, etc. But for some reason, this duty was shifted on to the programmer. It would be much more convenient to let the programmer simply write val (we are living in the third millennium, after all!) and explicitly specify Box or Rc where necessary. From this viewpoint, Rust's developers have screwed up the whole thing.

>This, in particular, makes Rust's scope much narrower. No one sane will write web and server-side software in a language like that - especially considering that it doesn't offer any significant advantages over those languages for JVM. Even Go - with normal lightweight processes (not futures) - seems a way better choice for solving these tasks.
>>
>>59007623
I was talking about my own experiences though.
>>
>>59007749
source
>>
>>59007693
since C11
>>
>>59007726
It took Rust users two years to write
extern {
fn epoll_create(size: c_int) -> c_int;
fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut epoll_event) -> c_int;
fn epoll_wait(epfd: c_int, events: *mut epoll_event, maxevents: c_int, timeout: c_int) -> c_int;
}

Sasuga language hipsters.
>>
>>59007765
>I am literally too retarded to use a search engine
>>
>>59007788
source
>>
>Another very common pitfall is accessing memory that isn’t owned by you. More often than not, that simply means accessing an array with an index that’s out of range. This applies to read and write operations alike.

>Accessing out-of-bounds memory can introduce nasty vulnerabilities into your executable. Again, these vulnerabilities might allow an attacker to execute arbitrary code on your client’s computer (see Buffer Overflows).

>Probably the most well-known out-of-bounds access vulnerability in recent times is Heartbleed.
>>
>>59007800
http://lmgtfy.com/?q=Even+apart+from+that+speed%2Fsafety+compromise+issue%2C+I%27m+also+skeptical+about+the+language%27s+design+as+such.
>>
>>59007822
Rust release builds also don't perform bounds checking. So even if OpenSSL were written in Rust, Heartbleed would still have occurred.
>>
>>59007774
It's the type checker throwing so many false positives you needed multiple pages of code for even basic epoll usage. This is an example epoll echo server https://github.com/carllerche/mio-examples/blob/master/ping_pong/src/main.rs
>>
>>59007854
>Rust release builds also don't perform bounds checking.
>
>>
>>59007854
>Rust doesn't perform bound checking
So this is the power of /dpt/
>>
>>59007871
>It's the type checker throwing so many false positives
>

mio is just complete garbage.
>>
>>59007854
> Rust release builds also don't perform bounds checking
Now this is just false. You can avoid bound checking only by using unsafe methods. Then again, the compiler is able to optimize it out in most cases.
>>
>>59007894
And also the best async I/O Rust library available.
>>
>>59007917
>the compiler is able to optimize it out in most cases.
>
>>59007921
Nobody ever claimed that Rust isn't a hipster infested trash fest.
>>
>>59007871
>basic epoll usage
Because mio isn't just a epoll bindings, it actually supports kqueue and Windows' AIO, which is completely different from epoll model, and mio tries to provide a coherent API to use all of these.
>>
New thread: >>59007972
>>
>>59006776
for a small/solo developer you are fucked if you don't find a niche or you have some unicorn idea and execute it well. the larger developers are only profitable if they make pure cancer like look at modern combat 5 and how they try to leech money off of you at every turn, it's not fun to play
>>
>>59007872
>>59007885
>>59007917
https://github.com/rust-lang/rust/issues/35981
There is even an issue on the rust-github complaining that the compiler doesn't remove bounds-checking well enough. And people agree this should be fixed/all bounds checks should be removed.
>>
>>59006808
the market is saturated at this point. it's not like the early days when you could make bank off of some stupid fart app or flashlight app
>>
>>59008056
>being this illiterate
>>
Make another thread, >>59007978 is not going to have any (ANY) proper discussion
>>
File: 1455954055666.jpg (49KB, 600x900px) Image search: [Google]
1455954055666.jpg
49KB, 600x900px
>>59008056
>LOOK MOM I DON'T KNOW HOW TO READ XD
>>
>>59008082
Actual thread

>>59008157
>>59008157
>>59008157
Thread posts: 332
Thread images: 26


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