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

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: 341
Thread images: 28

File: knuth-2002-08-24.jpg (52KB, 901x400px) Image search: [Google]
knuth-2002-08-24.jpg
52KB, 901x400px
last >>59681677
>>
>>59687408
Lisp is the most powerful programming language.
>>
>>59687419

Maybe if you don't count Haskell
>>
>>59687419
Maybe if you don't count C#
>>
>>59687408
>Valiente

Time to go back Pablo
>>
>>59687419
Maybe if you don't count Java
>>
>>59687419
Maybe if you don't count C
>>
Added bookmarks to my reader:

collinoswalt.com/res/test.webm

saves [filename.txt].bookmark to ~/.books/bookmarks
>>
>>59687419
Maybe if you don't count C--
>>
>>59687419
Maybe if you don't count Visual Basic
>>
Wow... SICP is FUN!

Thanks /dpt/
>>
>>59687419
Maybe if you don't count C<<=1
>>
What is wrong with this haskek program

it is supposed to return the amount of hailstone sequence iterations a number takes to reach 1

hail :: Integer -> Integer -- takes one integer returns 1 integer
hail n | n <= 0 = error "Integer not in range of hail"
hail n = (nextiter n 0) -- call nextiter with iteration count starting at 0

nextiter :: Integer -> Integer -> Integer -- takes in two integers, returns one integer
nextiter n i | odd n = nextiter (3*n+1) (i+1)
nextiter n i | even n = nextiter (div n 2) (i+1)
nextiter 1 i = i -- "return" i when it reaches 1
>>
>>59687530
The problem is it's Haskell
>>
>>59687637

uncultured swine
>>
>>59687530
>
hail n | n <= 0 = error "Integer not in range of hail"

why not just use an unsigned integer?
>>
>>59687669

Because the Integer type is arbitrary precision in Haskell

to get unsigned integers you have to import some shit from something and I don't feel like it
>>
>>59687419
Maybe if you don't count shell
>>
File: god_of_evil_of_clustering_hell.png (684KB, 1139x742px) Image search: [Google]
god_of_evil_of_clustering_hell.png
684KB, 1139x742px
>>59687728
>>59687728
>>59687728
>>59687728
>>
File: ahx1 (2).jpg (32KB, 800x450px) Image search: [Google]
ahx1 (2).jpg
32KB, 800x450px
>>59687419
Maybe if you don't count 卐Python卍
>>
>>59687849
dude should shave
>>
>>59687849
dynamic linking was a mistake
>>
>>59687880

Windows was a mistake.
>>
>>59687530
Should nextiter 1 i comes first?
>>
>>59687880

you can link staticly in Gentoo GNU/Linux
>>
>>59687940

yes
>>
>>59687849
fw bisqwit is terry
>>
>>59687992

bisqwit a jew
>>
File: 2017-04-01_18-34-08.png (24KB, 529x185px) Image search: [Google]
2017-04-01_18-34-08.png
24KB, 529x185px
>>59687934
true
that market share though
>>
File: 0ca.jpg (261KB, 900x900px) Image search: [Google]
0ca.jpg
261KB, 900x900px
>>59688013
>9 out of 10 people use a botnet
>>
>>59687992
The sane or the insane one?

Is Terry his evil twin?
>>
>>59688033
build your botnet and take those suckers' money quick, anon
>>
>>59688013

Wow! GNU/Linux community 2 times bigger than 5 years ago.
>>
>>59688063
i'm pumped for linux and oss, but GNU nazi should probably die
>>
Idris 1.0 has been released, Hasklel confirmed dead: https://www.idris-lang.org/idris-1-0-released/
>>
>>59687419

Maybe if you don't count
>>
>>59688080

GNU/nazi doing masterpieces of software.
>>
>>59688166
meme-lang is dead, long live meme-lang!
>>
>>59688166
is the website written in Idris itself? because it's pretty damn fucking slow
>>
File: c649c51c755ffd4fcd35b55142d5ea82.jpg (517KB, 1739x735px) Image search: [Google]
c649c51c755ffd4fcd35b55142d5ea82.jpg
517KB, 1739x735px
How does one rotate some fragments of a page?
>>
>>59688175
artists are easily memed
>>
>>59688267
there's many way to do that
looks like some countermeasure for newfags
anyway fuck off to >>>/g/wdg/
>>
Why do you wear socks while programming?
>>
>>59687450
>C
No one cares
>>
>These “you should switch language” remarks are strangely enough from the backseat drivers of the Internet. Those who can tell us with confidence how to run our project but who don’t actually show us any code.
>This is an usual problem with people participating in discussion over the Internet. I am sure those people mean well, but often they don't put enough effort into assessing the situation and underestimate its complexity before they decide to hit the keyboard. I've myself done it a number of times, but I am working on not doing it.
>Advice for the people who are making all these suggestions and: A good way to see if you're talking out of your ass—unintentionally, of course—is to try to do what you're saying someone should do. Just try and re-write some parts of curl in Rust (you can go with a hip name like rurl). It's a good exercise to learn about the project you're rewriting, the language you're writing it in, and the problem domain. So, at the very least you'll get something out of it, and if your project is successful: even better!

Wtf I love C now!
>>
>>59688487
Goading people into writing useless projects is an abomination.
>>
int sum(int a, int b)
{
if (0 == a) return b;
if (0 == b) return a;

return (1 + (sum(a, b - 1) + sum(a - 1, b)) / 2);
}
>>
>>59688419
If not C you would be dead already.
>>
>>59687408
Does Python have optional arguments when unpacking tuples?
>>
>>59688166
April fools!
>>
>>>59688883
>>
>>59688679
Just use underscores?
(a, _, c, _, _, f, ) = (1, 2, 3, 4, 5, 6, )
>>
>>59688943
What if I want a default value instead of _?
>>
>>59688548
>backwards comparisons
Into the trash it goes.
>>
>>59688956
You set the default value when creating the tuple, otherwise the number of elements won't be correct so it's more of a packing rather than unpacking issue.
>>
>>59688956
Can you show an example of why this would be done?
>>
>>59687530
>nextiter :: Integer -> Integer -> Integer -- takes in two integers, returns one integer
>nextiter n i | odd n = nextiter (3*n+1) (i+1)
>nextiter n i | even n = nextiter (div n 2) (i+1)
>nextiter 1 i = i -- "return" i when it reaches 1

[CODE]
nextiter n i
| odd n = nextiter (3*n+1) (i+1)
| even n = nextiter (div n 2) (i+1)
| unreachable code you fucktard, n is always either odd or even
[/CODE]
>>
>>59689033

nextiter n i 
| odd n = nextiter (3*n+1) (i+1)
| even n = nextiter (div n 2) (i+1)
| unreachable code you fucktard, n is always either odd or even
>>
What's the defacto introductory book on algorithms?
>>
>>59688999
It's really just a curiosity. To better illustrate what I'm talking about, consider this code in Lisp:
CL-USER> (destructuring-bind (a b c &optional (d 'default)) '(1 2 3) (list a b c d))
(1 2 3 DEFAULT)
>>
>>59689088
CLRS
>>
>>59689104
Why would you want "just a curiosity" polluting a language's syntax?
>>
>>59689367
I wouldn't call it pollution. Anyway, that was only one feature of destructuring-bind I was curious about in Python.
>>
Programming noob here. I have a simple question about floating numbers. In this program, we are looking for the square root of a number using Newton-Raphson's method. My question is about the EPSILON number. When the program compares the "guess" number against the "epsilon" number(guess => epsilon), is it measuring number "accuracy", or is it measuring number "quantity". Because I would expect "1.414216" to be a bigger number than ".00001". I know its a stupid question, but it has been bugging me for a while. Thanks in advance.
Program 8.8 Calculating the Square Root of a Number

// Function to calculate the absolute value of a number

#include <stdio.h>

float absoluteValue (float x)
{
if ( x < 0 )
x = -x;
return (x);
}

// Function to compute the square root of a number

float squareRoot (float x)
{
const float epsilon = .00001;

float guess = 1.0;

while ( absoluteValue (guess * guess - x) >= epsilon )
guess = ( x / guess + guess ) / 2.0;
return guess;
}
int main (void)
{
printf ("squareRoot (2.0) = %f\n", squareRoot (2.0));

printf ("squareRoot (144.0) = %f\n", squareRoot (144.0));

printf ("squareRoot (17.5) = %f\n", squareRoot (17.5));

return 0;
}


Program 8.8 Output
squareRoot (2.0) = 1.414216

squareRoot (144.0) = 12.000000

squareRoot (17.5) = 4.183300
>>
>>59689503
Long story short: floats are weird.
>>
If you are making an editor of sorts: text editing, image editing, sound editing etc... how do you implement the back and the forward button? Do you keep track of the changes, Like, these pixels went from this to this rgb, or do you keep the state of the whole picture/text/...?
>>
>>59689568
Then, I guess I am not so retarded to get confused by this. I will take by your answer that it is indeed measuring the "accurancy" of the number, instead of the "quantity". Meaning, that a 5 digit number is somehow bigger than a 6 digit number. At least, that is what I got from this program.
>>
>>59689503
>When the program compares the "guess" number against the "epsilon" number(guess => epsilon), is it measuring number "accuracy", or is it measuring number "quantity"

guess is the current guess for the square root
x is the number whose square root you're calculating

epsilon serves as a convergence limit

It compares how close guess*guess is to x and stops when you reach a close enough distance depending on what epsilon is.

Decreasing epsilon will make the algorithm run longer but will give you a more accurate result.

Increasing epsilon will give you a faster algorithm but a less precise result.
>>
>>59687457
Lol.
>>
I'm having a problem in C++. I have a class, and a function that increments (or resets when > than whatever) one of its member variables. I have other functions that read this same variable. The one that increments always has the correct value, the others always read it as 0. I made a test function that just returns it, it returns 0. The incrementing function will cout the correct value. The incrementing function doesn't declare a static or local variable of the same name.

It's functioning as though it's keeping a local copy for each function. Certainly this is not intended behavior. Using gcc 6.3 (MSYS2). Tried a debug build, does the same thing. Can't find any logic error. Haven't looked at generated assembly yet.

Any ideas?
>>
>>59689755
Post code.
>>
>>59689755
Sounds weird. Can you give the code in question? Is declaring stuff as private, public and protected done right? Are you initializing it or not with a value? What about const correctness?

I know these things are part of the syntactic analysis, but who knows.
>>
>>59689644
Oh noice. I understand what you mean. Is that a consistent behaviour with all floating numbers when it comes to comparing?
>>59689616
Is this statement correct?
>>
I have no clue what I'm doing here. If I leave the code like this then it'll let me input five numbers but the last number that gets input won't be counted towards anything. I can move my if statements around and get the fifth number input to at least be checked for high/low but it still won't be added to the sum. Am I even using the right loop for this? So far we've learned for, while, dowhile.

int high, low, sum = 0, i, count, choice;
double avg;
printf("Enter a number: ");
scanf_s("%i", &i);
high = i;
low = i;
for (count = 1; count < 5; count++)
{
if (i > high) {
high = i;
}
if (i < low) {
low = i;
}
sum += i;
printf("Enter a number: ");
scanf_s("%i", &i);
}
>>
>>59690178
Walk through it and you'll get the answer. Help yourself.
>>
File: vector2.png (101KB, 1335x725px) Image search: [Google]
vector2.png
101KB, 1335x725px
doing sepples things
>>
>>59690334
I have walked through it multiple times, I can fix one problem but then something else gets messed up. At this point I'm just shit out of ideas since I'm really new to this and it's class work.
>>
>>59690341
It looks like there could be more compact solution.
>>
Which programmers have biggest dicks?
>c++ and java
>length 17cm
>girth 15cm
>uncut
>>
>>59688419
C is the only language that truly respects your freedoms.
>>
>>59690360
You'll just get the answer here, not understanding.
>>
File: 1469843979355.png (231KB, 304x366px) Image search: [Google]
1469843979355.png
231KB, 304x366px
>>59690394
>cm
>>
>>59690460
ofc cm, not some american retarded "
>>
If i have 2 constructors in c#, one that takes all arguments and one that takes only 2 for example...

        private static int count = 0;

static List<MobilePhone> listOfPhone = new List<MobilePhone>();

public string Model { get; set; }
public string Manufacturer { get; set; }
public int Price { get; set; }
public string Owner { get; set; }
public Battery Battery { get; set; }
public Display Display { get; set; }

public MobilePhone(string model, string manufacturer, int price, string owner, Battery battery, Display display)
{
count++;
this.Model = model;
this.Manufacturer = manufacturer;
this.Price = price;
this.Owner = owner;
this.Battery = battery;
this.Display = display;

}

public MobilePhone(string model, int price)
: this(model, null, price, null, null, null)
{
}


...how do you write a Method that prints all data entered.

My current method

        public void DisplayInfo()
{
Console.WriteLine("Model: " + this.Model);
Console.WriteLine("Manufacturer " + this.Manufacturer);
Console.WriteLine("Price " + this.Price);
Console.WriteLine("Owner " + this.Owner);
Console.WriteLine("Baterry model: " + this.Battery.Model);
Console.WriteLine("Display size: " + this.Display.Size + "\nDisplay colors: " + this.Display.Colors);
}


When i create an instance that has only 2 arguments entered method throws
System.NullReferenceException: 'Object reference not set to an instance of an object.'
>>
>>59690178
you put "enter a number" at the end of the loop... think about it, specially when count = 4.
perhaps you are misunderstanding the condition...
>>
Is there a consensus on "modern" C++ (11,14,17) vs "classic" C++?
Should I try to learn the new features?
>>
>>59689503
Well, value. You can use a rel error if you want a unitless error instead: abs((g*g-x)/x), for example
>>
File: 9vw5l2e.gif (652KB, 581x390px) Image search: [Google]
9vw5l2e.gif
652KB, 581x390px
>>59687419
Maybe if you don't count Lisp
>>
>>59690540
It doesn't matter where I move it, I get an error one way or another. If I move the enter a number to the top of the loop then yes it'll do the checks for the high/low but the sum will still get fucked up.
>>
>>59690394
192mm here long
>>
>>59690538
better question would be: why my constructor that has null value for instance of an another class doesn't make that instance with null values?
>>
>>59690546

"Classic" C++ is a nightmare, the new features are well worth learning to make your life easier. unique_ptr, lambdas and move semantics are essential.
>>
>>59690588
Instead of a conditional loop with i != -1 as the condition, you need an unconditional loop with a conditional break.
>>
>>59690609

You're setting Display to null, are you surprised it's throwing a null reference exception when you try to access Display.Size?
>>
>>59690672
I just started learning, shouldn't that send all properties in Display to null?

If not, how would i solve printing that in a method? I mean, some phones would have Display info and some wouldn't
>>
Practicing some JS/SQL, how would I add multiple rows in a table in a DB while adding just 1 row in another table? Per one button click. Right now it just adds 1 row to each table, but I need 3 rows inserted in one of the tables
>>
>>59690546
yes.
classic is garbage compared to modern C++, try to forget everything you know about it.
>>
>>59690693
>I just started learning, shouldn't that send all properties in Display to null?

No
>>
>>59690178
#include <stdio.h>
int main(){
int high, low, sum = 0, i, count, choice;
double avg;
int first = 1;
for (count = 1; count <= 5; count++)
{
printf("Enter a number: ");
scanf("%i", &i);
if(first) {
high = low = i;
first = 0;
}
if (i > high) {
high = i;
}
if (i < low) {
low = i;
}
sum += i;
}
printf("low = %d, high = %d\n", low, high);
}

it's ugly, but it works. I think there are better ways to do it, though
>>
>>59690546
You definitely should. For example, this is new foreach-like loop for iterating trough vectors:
for(auto &i: vectorName) {
std::cout << i << std::endl;
}

This code will print all variables in this vector. In "legacy" C++, you would use ugly iterators like this:
vector<type>::iterator vectorName_Iterator;
for(vectorName_Iterator = vectorName.begin(); vectorName_Iterator != vectorName.end(); vectorName_Iterator++) {
std::cout << *vectorName_Iterator << std::endl;
}
>>
>>59690538
I solved this with adjusting my constructor that takes 2 arguments to create 2 instances of Battery and Display with all null values

        public MobilePhone(string model, int price)
: this(model, null, price, null, null, null)
{
this.Battery = new Battery();
this.Display = new Display();
}


and Battery and Display constructors are

        public Battery()
:this (null, 0, 0)
{
}


and

        public Display()
:this (null, null)
{
}


Programming is fun
>>
>>59690693
>I just started learning, shouldn't that send all properties in Display to null?
Setting Display to null does not set all properties in Display to null. In fact, the properties in Display cease to exist entirely, because Display itself becomes null, and null has no properties. Hence the error: you're trying to extract a property from a value specifically defined to have no properties.
>>
>>59690644
>>59690717
>>59690795
Thanks guys, will read up before doing another project.
>>
>>59690795

#define sepples_loop(type, symb, lst) \
for(vector<type>::iterator symb = lst##.begin(); symb != lst##.end(); symb += 1)

sepples_loop(int, i, vectorName) {
std::cout << *i << std::endl;

}



There. No need for ugly pants on head retarded """modern""" sepples.
>>
>>59690867
>>59690853
Is this the way to do it, i solved it here?

What about when those null values for Display and Battery still remain in the constructor and i create new instances in the constructor body?
>>
How can I build a automata who accepts the first 8 prime numbers?

I know Sigma: 0,1,2,...,9
States: start, accepted, rejected
But I got stuck on delta function.

It's pretty easy to create an automata who accepts 4 first primes (2,3,5,7)

But what can I do when 11,13,17 and 19 appears?
Sigma only goes to 9.
I thought Sigma could be 00,01,02...,99, but again, 02,03,05,07 would be rejected (0 will grab 2,3,5,7 to rejected state).

Freshman CS anon here
>>
>>59689773
>>59689793
The code is on another computer. I might post it later. I'm also going to try to compile it with clang and see what it does.
>>
(dotimes (i 100)
(format t "~A " i))


#define dotimes(type, var, n) for(int var = 0; var < n; ++var)

dotimes(int, i, 100) {
printf("%d ", i);
}
>>
>>59691125
Almost. You can optionally return a result in dotimes.
>>
>>59690957
Mate, that's fucking easy
type input =
| Char of char
| EOF
;;

type return =
| Continue of (input -> return)
| Accept
| Reject
;;

let state_eof = function
| Char _ -> Reject
| EOF -> Accept
;;

let state_1 = function
| Char ('1' |'3' | '7' | '9') -> Continue state_eof
| Char _
| EOF -> Reject
;;

let state_0 = function
| Char ('2' |'3' | '5' | '7') -> Continue state_eof
| Char '1' -> Continue state_1
| Char _
| EOF -> Reject
;;

let eval string =
let lim = String.length string in
let rec loop state i =
if i = lim then
match state EOF with
| Accept -> true
| Reject
| Continue _ -> false
else
match state (Char string.[i]) with
| Continue state -> loop state (succ i)
| Accept -> true
| Reject -> false in
loop state_0 0
;;

let main () =
let rec loop () =
print_string "> ";
flush stdout;
match read_line () with
| "quit" | "exit" -> ()
| str ->
Printf.printf "%S: %B" str (eval str);
print_newline ();
loop () in
loop ()
;;

let () = main ();;
>>
>>59691185
well fuck you
>>
>>59691208
What language?
>>
>>59691248
Can C even compete?
>>
File: logocaml.gif (5KB, 375x352px) Image search: [Google]
logocaml.gif
5KB, 375x352px
>>59691295
Only the best. OCaml.
>>
>>59691295
Looks like OCuckml
>>
LINQ vs SQL
>>
>>59691325
>let ... in
eww
>>
>>59691354
Where is the problem?
>>
>>59691208
Well fuck
I need the answer, or some insight, only with finite automata shit: Sigma, States, Start and Final states, delta transformation function and automata diagram

You just programmed that shit
>>
>>59691402
I programmed the finite automata you need.
>>
>>59691422
But I dont understand your answer
>>
>>59691435
I'm sorry for you.
>>
>>59691208
What language is this?

Is that what functional programming is all about? Machinery that moves through states procedurally, rather than objects that create macro state via their interactions and individuals states? Because that's generally how I write try to write programs. They're all composed of state machines and either very limited interfaces between each other, or all connected through a few central bridges.

Should I learn Haskell or Idris?
>>
>>59691482
>What language is this?
OCaml.

>>59691482
>Should I learn Haskell or Idris?
No. Learn OCaml.

git clone https://github.com/ocaml/ocaml.git
cd ocaml
./configure -prefix "$HOME/local"
make world
make bootstrap
make opt
make opt.opt
export PATH="$HOME/local/bin:$PATH"
ocaml
>>
>>59691523
you can do
git checkout 4.04.0

after
cd ocaml

if you don't want development version
>>
>>59691482
>Is that what functional programming is all about?
Yeah, pretty much.
>Should I learn Haskell or Idris?
Knock yourself out. Just be prepared to have your brain melted by the sheer quantity of scary words they throw around to describe abstract concepts.
>>
C++ is a good language
April Fools
>>
File: 1489582481410.jpg (159KB, 500x332px) Image search: [Google]
1489582481410.jpg
159KB, 500x332px
Could someone do me a solid and walk me through how to do something with Qt?

I'm trying to learn Qt for myself but I'm kinda drowning before I can learn how to swim here. I've taken adequate look at all the documentation but it assumes you have underlying knowledge of how everything works and it's just a bunch of disjointed codebytes. I've gotten a dozen different errors trying to implement it myself

All I want to do is create a function that prints something out to the console when a certain key is pressed

Thanks boys, you'll do me wonders if you can show me exactly how this works and explain to me why and how it needs to be declared
>>
>>59691832
Woa sepples is so bad it can't be even funny in a joke.
>>
>>59691872
open Amodule;;
hello ();;

As a side note, people tend to avoid the ugly ";;", so it more common to write it like:

open Amodule
let () =
hello ()

LOL
>>
What is with the programming girly clothes meme?

Does someone actually think smart girlyboys are sexy and are trying to make more? Is that the meme?
>>
>>59692012
There's one guy in /dpt/ trying to force trap shit. It's just one guys mental illness not even a meme.
>>
>>59692012
>Is that the meme?
I just need you to know this made me burst out laughing.
>>
>>59692012
I am better at coding when I put my huge black dildo in my ass.
>>
>>59692012
I wear a skirt and programming socks when I have a programming class. since I do this my prof gives me compliments and my grades are getting better.
>>
>>59692012
it's a great /dpt/ meme and the 3 relative newkids who get pissed off every time should stop complaining
>>
>>59692117
Do you have to blow?
>>
>>59692012
This is well known under elite programmers.
>>
>>59692146
nah, just bend over a little.
>>
>>59691523
>>59691547
Better to install your OCaml through the opam package of your distribution imo. Then use opam init and do opam switch 4.04.0.
>>
>>59692217
I do the same with my wife.
>>
>>59692079
>>59692117
>>59692120
>>59692146
>>59692204
samefag
>>
>>59692230
you bend over? why?
>>
>>59692229
Why? I never use opam. And opam doesn't compile.

>>59692243
To be fucked by my wife.
>>
File: samefag.png (3KB, 126x108px) Image search: [Google]
samefag.png
3KB, 126x108px
>>59692236
(Me) in the middle
>>
>>59692248
>Why
Immediate access to every library is pretty good.
>And opam doesn't compile
What?
>>
>>59692236
nice try, faggot
>>
>>59692012
>2017
>not being a trap

Get with the times already faggot
>>
public MyObject(AnotherObject antherObject, int x)
{
this.anotherObject = anotherObject;
this.x = x;
}


In C#, when I create an instance of MyObject, does it contain a copy of AnotherObject or does it just contain a reference to the AnotherObject I put in the parameters?
>>
File: Aquafresh08.png (125KB, 684x227px) Image search: [Google]
Aquafresh08.png
125KB, 684x227px
>>59692283
NEDERLAND!
>>
>>59692256
>Immediate access to every library is pretty good
Clearly no.
>>And opam doesn't compile
>What?
Try to compile it on OpenBSD my dear friend.
>>
>>59692323
debug > memory snapshot > click the text > shows you how many instances of x classes are open in memory
>>
Best textbook of the following?

ML for the Working Programmer
Structure and Interpretation of Computer Programs
Haskell Programming from First Principles
Type-Driven Development with Idris
Functional Programming in Scala
JavaScript: The Good Parts
>>
>>59692346
Idris
>>
>>59692326
nope, belgië. hihi
>>
>>59692346
What made you think you would want to learn Scala?
>>
>>59692346
Anything but the last two

HPfFP is a bit slow, you can use the (free) wikibook instead
>>
File: 33.png (92KB, 758x613px) Image search: [Google]
33.png
92KB, 758x613px
>>59687849
Lol
>>
>>59692323
by value
>>
How do I learn C and all that low level stuff like using uchar4 and thinking about all this useless optimisation, then move on to C++ and become a true master of C/C++ ?

I'm serious
>>
I'm using some libs and that licensed under GPL. Can I get a TL;DR? What are the rules? Which bit do I have to distribute, does my entire code have to licensed under GPL as well?
>>
>>59692620
I think so.
>>
>>59689503
use matlab, call eps()
>>
>>59692323
If you want to use references check the ref keyword
>>
>>59690546
>Should I try to learn the new features?
You're fucking insane if you don't desu

life gets a lot easier when you have shit like lambdas and the new for loops

we actually spooked the JS faggots at work because our C++ code is far cleaner and more readable than the abomination they've built
>>
>>59692637
All objects in csharp are references.
>>
>>59692369
The book is far more about FP than it is about Scala.
>>
>>59692653
>spooked the JS faggots at work because our C++ code is far cleaner and more readable
> cleaner and more readable
would you mind to share an example of clean and readable C++ 14-17? i just skimmed through a cpp book and it looks horrible
>>
>>59692620
>Which bit do I have to distribute
The code you wrote.
>does my entire code have to licensed under GPL as well?
You have to license your code with one that is compatible with the licenses used in your libraries.
>>
>>59690416
this
>>
>>59692717
Idiomatic C++ code is very clean. Allocation, cleanup, exception handling etc. is all handled by the language.
>>
>>59692727
Guile** is the only language that truly respects your freedoms.
>>
Call me retard all you want, but I'm having trouble setting up 8x4 grid layout to then use border layout and have 8 buttons on the right side in java
>>
>>59692720
Cheers, that's what I thought.
>>
>>59692735
>2017
>thinking that naïve GC is good GC
>>
>>59692346
>JavaScript: The Good Parts
This one has zero pages, right?
>>
What is man supposed to use when there's just no good statically typed and compiled language that doesn't require huge vm like c# or java?
>sml
no good implementation
>ocaml
sml with shittier syntax, also GIL
>lisp
too verbose
>C
decent but manual memory management is obnoxious when prototyping
>sepples
convoluted cluster fuck that no sane person would touch
>D
can't choose if it's wants to have gc or no
>rust
used only by crazy people, also they really trying hard to make the langue uglier than sepples
>>
>>59692346
not comparable, they have different purposes
>>
File: js.jpg (792KB, 3264x1836px) Image search: [Google]
js.jpg
792KB, 3264x1836px
>>59692783
>>
>>59692794
>lisp
>too verbose
fuck off with your shitty repost
>>
>>59692810
http://www.ffconsultancy.com/ocaml/ray_tracer/languages.html
>>
>>59692825
what does this prove
>>
>>59692859
It's hard to write terse programs in lisp.
>>
>>59692875
where does it state that
>>
>>59692875
This is true, e.g.

1 + 2 * 3


vs

(+ 1 (* 2 3))
>>
>>59687419
maybe if you dont count PHP
>>
File: 1468013405521.jpg (48KB, 477x465px) Image search: [Google]
1468013405521.jpg
48KB, 477x465px
>>59692825
>no Haskell
>>
Managed to link one language to another. Who /learning/ here
>>
>>59692918
I was looking for a programming language not meme.
>>
>>59692609
Keywords for true programming enlightenment:
>read The Art of Computer Programming
>study computer engineering
>read King's C Programming: A Modern Approach or Gustedt's Modern C
>learn OCaml
I'd say there's no good resource to learn C++.
>>
>>59687419
>no inline asm
literally useless.
>>
>>59692942
kek I've used that about three times in 12 years of doing this shit for a living
>>
File: 1482929854428.png (121KB, 483x359px) Image search: [Google]
1482929854428.png
121KB, 483x359px
>>59692929
>>
Java question.
When I have nested for loops, if I call break; statement, will it leave the inner loop only or both?
>>
>>59693073
no one knows.

maybe yes, maybe not
>>
>nested for loops
Disgusting. Why don't more languages have vectorized operations?
>>
>>59693073
it will only leave the inner loop. If you need to escape more than one level of nesting with a break, you need to use a goto.
>>
>>59693105
>java
>goto
>>
>>59693104
stuck in the past
>>
we clojure now
(defn my-inc
"Increments x by y"
[x y]
(loop [sum x remainder y]
(if (= remainder 0)
sum
(recur (+ sum 1) (- remainder 1)))))
>>
>>59692825
>Overall, OCaml and SML are the most concise languages and Lisp, Java and C++ are the most verbose.

this is a bad meme, OCaml and SML are pure shit in the real world outside of your toys
>>
>>59693145
That's why almost all of the Modelica compiler are written in OCaml.
>>
>>59693145
t. NEET
>>
>>59693118
Java fucking sucks anyway, you shouldn't be using it.
>>
still working on my library.
although it's starting to look more adding stupid features to this game/program I use to test stuff.

entire code for webm related: https://pastebin.com/VRxfbVgJ
>>
File: 1467805260675.jpg (56KB, 945x482px) Image search: [Google]
1467805260675.jpg
56KB, 945x482px
The 3.3X+ versions of GNOME-Shell is written in Rust. You heard it here first.
>>
>>59693118
there are goto statements in java. They are called labels. I'm in 3rd year CS and only discovered them recently, this is how much my uni wanted to hide their existence from me.
>>
>>59692717
maybe this counts?
>>59693168
>>
True story, none of my university classes even mentioned FP. When I brought it up to my professors, I saw that flash of regret across their faces, where they knew it was the future but they were stuck back in C++/Java prison, because that is what they have learned and used for so many years, so even if the curriculum changed, they wouldn't be qualified to teach it.

Very sad.
>>
>>59693161
>>59693165
>hey guys we have one tiny tiny tiny piece of software in our language and most for research we're do good.
>>
>>59693265
>one tiny tiny tiny piece of software in our language
The one that will be used to model everything in the industry world.

OOP is more and more irrelevant, but you don;'t know what really happen in the real world.
>>
>>59693265
>I'm retarded
We knew.
>>
>>59693183
>that c drop
>>
>>59693296
>everything not OCaml is OOP

hello retard
>>
>>59693306
Good riddance 2bh
>>
>>59693306
what happened
>>
What's the advantage of learning and using tcl over python for simple automation tasks?
>>
>>59693318
agree 2bh
>>
>>59693312
What is there else? FP with Haskell, Scala or...
Ok

Low level? Soon every low level code will be generated by OCaml, exactly like FFT.
>>
>>59693324
the sheeple finaly woke
>>
>>59693324
Evolution
>>
>>59693324
TIOBE stopped reporting false positives.
>>
In c++, what is the point of helper functions?
I thought you could access and alter private members through public members without having the public member declared as friend. Or am I wrong about that?
>>
Can someone explain why homoiconicity is so good? You can have macros that work directly on the AST without the AST being the exact same as the concrete syntax.
>>
>>59693364
edit..
my question is mostly about why declare a helper operator or function as friend.
is it not possible to alter private members through public member functions without the use of friend?
>>
>>59693364
friend is for functions that aren't members. putting friend on a member doesn't do anything
>>
>>59693387
so why is my school textbook saying this.
if you scroll down to the friendship section on this page you will find they are doing this

https://scs.senecac.on.ca/~oop244/pages/content/nonme.html
>>
>>59693376
fifty levels of abstractions get old as you comb though it all.
homoiconicity is very ideal and saves time.
macro abuse is just a sign of a shitty language.
>>
>>59693466
friendsships have to be declared inside the class in question but it doesn't make them members.
>>
If I want to make a C++ gaem do I use SDL?
>>
>>59693471
What does homoiconicity have to do with abstractions?
>>
>>59693376
compiler complexity
>>
>>59693506
don't use shitty C libraries in C++
>>
>>59693499
Then what's the point of putting friend there.
I could just leave it out and then the function prototype can still access the private data.
>>
>>59693544
Simplifies the lexing/parsing part of the compiler at the expense of making life harder for everybody who uses the language. Okay.
>>
>>59693552
What should I use
>>
>>59693571
a shitty C library because they are not shitty and actually good.

GLFW is easiest, pair ti with OpenGL. Shit is really simple to do basic stuff.
>>
>>59693506
SDL if you want a simple way to port it to many platforms (PC, android, etc)
SFML if you want a simpler way to write it in C++
OpenGL if you need high performance
>>
>>59693571
depends on what sort of gaem you want to make, I guess
>>
>>59693569
it's a big deal
>>
>>59692938
>>read The Art of Computer Programming

Has anyone actually accomplished this? There's thousands of pages
>>
>>59693606
Why?
>>
>>59693571
use my library >>59693168 if you like dos games
>>
>>59693626
you don't want your compiler/interpreter to be half a GB
>>
>>59693668
Because every compiler/interpreter for a language that isn't a Lisp is 0.5 GB? I think you overestimate the complexity of parsing with operators.
>>
>>59693571
If you want to write the engine and all:
Any window creation library + OpenGL/DirectX

If you like reading documentation more than writing and don't want to do an engine of your own:
godot
ue4
>>
>>59693717
>not Vulkan
>>
>>59693686
Lua is <1MB
>>
>>59693686
when you need it at runtime
>>
Can somebody give me a babymode explanation of what overloading is in the context of C++ is and why I'd want to use it? The stuff I'm finding on google is a bit confusing.
>>
>>59690538
You could just do:

Console.WriteLine("Battery Model", Battery?.Model)
>>
>>59693728
Right, you could do Vulkan if you can manage past all the bullshit just to set up the a simple scene.
>>
>>59693729
Exactly.

>>59693731
Okay?
>>
>>59693739
Overloading is shit. Don't use it.
Also, don't use C++ to begin with.
>>
How do I refactor this?

 public static String checkPalin(String pal) {
int minI = 0;
int maxI = pal.length() - 1;
if (pal.length() % 2 == 0) {
while ((minI <= pal.length() / 2 - 1) && (maxI >= pal.length() / 2)) { // THIS IS THE ONLY DIFFERING LINE
if ((pal.toCharArray()[maxI] != ' ') && (pal.toCharArray()[minI] != ' ')) {
if (pal.toCharArray()[maxI] != pal.toCharArray()[minI]){
return "Not a Palindrome!";
}
minI++;
maxI--;
} else {
if (pal.toCharArray()[minI] == ' ') {
minI++;
}
if (pal.toCharArray()[maxI] == ' ') {
maxI--;
}
}
}
}
else if (pal.length() % 2 != 0) {
while ((minI <= pal.length() / 2 - 1) && (maxI >= (pal.length() / 2) + 1 )) { // THIS IS THE ONLY DIFFERING LINE
if ((pal.toCharArray()[maxI] != ' ') && (pal.toCharArray()[minI] != ' ')) {
if (pal.toCharArray()[maxI] != pal.toCharArray()[minI]){
return "Not a Palindrome!";
}
minI++;
maxI--;
} else {
if (pal.toCharArray()[minI] == ' ') {
minI++;
}
if (pal.toCharArray()[maxI] == ' ') {
maxI--;
}
}
}
}
return "It's a Palindrome!";
}
>>
>>59693744
OpenGL and DirectX have bullshit, the former with its terrible API that doesn't match the hardware and the latter with messing around with COM. Nothing you do with Vulkan is bullshit, it's precisely what needs to be done and nothing more.
>>
>>59693764
You seemed to have missed the point. The amount of effort needed to get a simple game in OpenGL is far far less than Vulkan where you have to be explicit in just about everything you do and for a small game and even decently big ones OpenGL is just fine.
>>
>>59693792
Same argument goes for using OpenGL vs. using an engine.
>>
Idris 1.0 is out
>>
http://www.cs.cmu.edu/~tom7/abc/
found this just now
>>
>>59693759
public static String checkPalindrome(string s){
String trimmed = s.trim();
String reversed = new StringBuilder(trimmed).reverse().toString();
if(trimmed.equals(revered))
return "It's a Palindrome!";
else
return "It's not a Palindrome!";
>>
>>59693810
thanks lad
>>
>>59693810
what's the deal with idris? i mean no uses haskell to begin with, what's the userbase of idris? 35 people?
>>
>>59693801
Sure I agree but it's on a different scale and for different reasons. Don't try to kid yourself that Vulkan is just as easy to do as OpenGL because it's annoying as fuck due to the verbosity for little performance gain for a typical toy dev.
>>
>>59693842
My first reply on 4chan
>>
>>59693849
I didn't say it was. Nor is OpenGL as easy as using an engine. What I figure is in for a penny, in for a pound. Vulkan can provide huge benefits over a premade engine, but OpenGL much less so.
>>
>>59693837
Thanks anon but I already went through the effort of figuring it out without that library and I would like to keep my code as it is.
>>
>>59693848
Idris is primarily a research language for purity and dependent types.
If you want libs, go to haskell.
>>59693862
glad to have taken that sweet cherry.
>>
>>59693848
Haskell isn't particularly interesting for academic use any more now that researchers have moved onto things that Haskell can't do. Idris has stepped up to take its place while Haskell is stabilizing and becoming more appropriate for regular use.
>>
>>59693871
So you want to do it without using any external classes/functions?
>>
>>59693862
A little underwhelming.
>>
>>59693901
It doesn't help that Haskell is full of unsafe stuff and non-total.
>>
>>59693917
They should reimplement it in Rust.
>>
>>59693917
Yeah, in the interest of being usable in practice it's keeping a lot of legacy cruft around nowadays. Stabilizing Haskell was a mistake, but at least people are making new languages instead of trying to hack around it still with even more extensions.
>>
>>59693936
>with even more extensions.
Just wait until it tries to do Dependent types.
>>
>>59693929
rustc is slow.
>>
>>59693952
I think anybody capable of writing such an extension will realize the futility and either use or write their own properly dependently typed language instead.
>>
>>59693906
String class only anon, as seen in my code.

The code clearly repeats after the

else if (pal.length() % 2 != 0) {
while ((minI <= pal.length() / 2 - 1) && (maxI >= (pal.length() / 2) + 1 )) {
>>
>>59693994
Well we have about ~5 proper langs to choose from but yeah. Pretty excited for the age of the functional wild west.
>>
>>59693997
Ok, I did another two solutions to your problem. One where I just removed the second if part, and one shorter easier vesion.

public static String checkPalindrome(String pal) {
int minI = 0;
int maxI = pal.length() - 1;
int diff = pal.length() % 2; //If its uneven its 1, else 0.
if (pal.length() % 2 == 0) {
while ((minI <= pal.length() / 2 - 1) && (maxI >= pal.length() / 2) + diff){ //Will do the same thing as the if statement
if ((pal.toCharArray()[maxI] != ' ') && (pal.toCharArray()[minI] != ' ')) {
if (pal.toCharArray()[maxI] != pal.toCharArray()[minI]){
return "Not a Palindrome!";
}
minI++;
maxI--;
} else {
if (pal.toCharArray()[minI] == ' ') {
minI++;
}
if (pal.toCharArray()[maxI] == ' ') {
maxI--;
}
}
}
}
return "It's a Palindrome!";
}


//Shorter solution
public static String checkPalindrome(String in){
int inLen = in.length() - 1;
for(int i = 0; i < inLen -1; i++){
if(in.charAt(i) == in.charAt(i-1)){
return "It's not a Palindrome!";
}
}
return "It's a Palindrome!";
}
>>
>>59693183
I'm terrified that Rust will exceed the popularity of Go and we'll all be stuck writing a terrible language with too many features, back where we started with C++.
>>
Do windows form events always have to be static? Or did I just accidentally place a static somewhere at the beginning.

Every on_XXX event function is complaining about not being static.
>>
>>59694038
Oops, I meant
in.charAt(inLen - i)

instead of
in.charAt(i-1)

In the shorter solition
>>
>>59694036
I'm glad people are realizing we can't just bolt things onto Haskell forever. Language development seems to be the "in" thing right now, which is great. Honestly it probably is sort of an effect of Haskell becoming more usable, because there's really no better language for language development.
>>
>>59693206
this looks ok. is this how modern c++14-17 looks?
>>
File: dd.png (47KB, 716x768px) Image search: [Google]
dd.png
47KB, 716x768px
>>59694038
Hey your code opened my eyes to the solution but at the same time it's wrong.

Why do you have
 
if (pal.length() % 2 == 0) {


There. That messes up the code.


As for your short version, it is completely wrong. Check image
>>
>>59694240
oh shit I didn't actually check anything properly, sorry about that.
I forgot to remove the if statement, it should obviously not be there.

As for the shorter version a working version should be:

  public static String checkPalindrome(String in){
int inLen = in.length() - 1;
int diff = inLen % 2;
for(int i = 0; i < inLen / 2 + diff; i++){
if(in.charAt(i) != in.charAt(inLen-i)){
return "It's not a Palindrome!";
}
}
return "It's a Palindrome";


I actually tested this version.
>>
>>59694380
Explain to me why you believe this code will work.
Because it doesn't.
>>
>>59694434
If you change your code to

  public static String checkPalindrome(String pal) {
int minI = 0;
int maxI = pal.length() - 1;
int diff = pal.length() % 2;
while ((minI <= pal.length() / 2 - 1) && (maxI >= pal.length() / 2 + diff)){
if (pal.toCharArray()[maxI] != pal.toCharArray()[minI]){ //Same comparison as for-loop just using .charAt() instead.
return "Not a Palindrome!";
}
minI++;
maxI--;
}

return "It's a Palindrome!";
}

(The else statement was never actually executed.)

It does the exact same this, just using a for-loop instead.

You should also add a .toLowerCase() to the input string, or something like "Able was I ere I saw Elba" won't work, since 'a' == 'A' -> false.
>>
I've been doing some beginner challanges. Please rate my code.

I play a lot of roguelikes, this one is for dicerolls (NdM)
import random
def randomDice(N,M):
for i in range (N):
print(random.randint(0,M))


This next one is extremely hideous and sloppy, but it works. I'm gonna go back and try to clean it up later. It prints a tree as output if you use an odd number.

For example:
x
xxx
xxxxx
xxxxxxx
xxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxxx
xxxxxxxxxxxxxxx
___


def tree(number,base,leaves):
max=number
inter=1
space=int((number/2)-.5)
spacebase=space-1
while inter<number:
print(space * " "+leaves*inter)
inter=inter+2
space=space-1
print(leaves*max)
print(" " * spacebase + base*3)
>>
>>59694693
Formatting is wrong, my bad. The output for the tree looks like this:
    x
xxx
xxxxx
xxxxxxx
xxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxxx
xxxxxxxxxxxxxxx
___


    ^
^^^
^^^^^
^^^^^^^
^^^^^^^^^
^^^^^^^^^^^
###

   +
+++
+++++
+++++++
+++++++++
###
>>
File: d.png (33KB, 1096x602px) Image search: [Google]
d.png
33KB, 1096x602px
>>59694606
Believe it or not, you have posted wrong code 3 times in a row at this point.
>>
>>59694204
yeah that's probably as idiomatic as it gets.
I should mention though, there's a lot going on under the hood to keep the final syntax clean. things like operator overloading are still rather verbose (>>59690341).
>>
>>59694741
Uhh... one of those is Java and the other is C++.
>>
>>59694779
Disregard this post, I am retarded.
>>
>>59694728
Right, you need to strip the string of whitespace as well.
>>
Would it be more useful to take a Software Engineering course or a Databases course at my Uni?
>>
>>59694840
databases
>>
Trying to write a function to reduce a fraction in Python 3. Hitting a brick wall. Could anyone help point me in the right direction without giving me the answer? The GCD can't be bigger than largest number, so i've got that.

I think the next step will be dividing in a loop with a range of (2,GCD) but i can't think of how the program will know when it's simplified completely. I guess if it equals 1, then you would stop there, but how about fractions where it can't be reduced to 1, like 46410/119340
>>
>>59695216
> but i can't think of how the program will know when it's simplified completely
Numerator and denominator GCD must become 1.
>>
File: 1490009755311.jpg (172KB, 537x1133px) Image search: [Google]
1490009755311.jpg
172KB, 537x1133px
C# question

If I pass a variable by reference into the constructor of another class, and that variable references and object, then will reassigning the original value in the original class to be equal to another object maintain the equality in the secondary class, or will it just change the pointer for the first class, breaking the connection?
>>
Java question.
Why can't I implement a method to return an ArrayList<...> for an interface that specifies that it returns a List<...>? Does ArrayList not implement List? Why can't I do this? I know java allows for covariant return types for overridden methods, as long as the return type is a subclass.
>>
>>59695216
divide both numerator and denominator by the gcd
>>
>>59695354
That's not easy to decipher but if you're passing an object, saving a reference that was contained in that object and then altering the original the two objects containing references will not refer to the same objects anymore.
If you're saving a reference to the object you passed in by reference and change the original you can still reference the same object despite only changing the reference in the original. Because you'd be doing a double indirection at that point.

I suggest you draw this out for yourself and see if it makes any sense for changes to appear where you want them.
>>
>>59695378
>does arraylist not implement list?
https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
It does.
You'd have to ask a-poo as to why it doesn't work. I agree that it should work just fine.
>>
>>59695381
But how can I translate the concept of a gcd to python? For example, with 4/8, the GCD is 2, but if I loop 1/4,2/4,3/4,4/4, how does python distinguish which one is the GCD? I could say it's 4, because 4/4 = 1, but how about that case of 46410/119340? It reduces to 7/18, and the GCD is 6630.
>>
>>59695205
Alright, any particular reasons?
>>
>>59695465
yeah, tried it again, refreshed project and recompiled. fucking eclipse.
>>
>>59695414
Let me clarify because whoo momma I wrote that poorly

class TestClass{
public TestClass() {
SomeObject obj = new SomeObject(2);
TestClassB b = new TestClassB(ref obj);
obj = new SomeObject(1);
//Is TestClassB's _obj equal to obj at this point?
}
}

class TestClassB{
private SomeObject _obj;
public TestClassB(ref SomeObject obj) {
this._obj = obj;
}
}
>>
>>59694840
software engineering.
>>
>>59695478
https://en.wikipedia.org/wiki/Euclidean_algorithm

>invented 300 BC
>>
new thread
>>59695514
>>59695514
>>59695514
>>
>>59695378
post code, your question is slightly confusing
>>
New thread:

>>59695524
>>59695524
>>59695524
>>
>>59695501
Ah. Way simpler than I thought.
No. You have two different references to different objects here.
>>
>>59694840
databases. with software engineering they'll probably teach you shit like version control, testing, and agile techniques. version control can be self-taught pretty easily. testing as well. agile techniques can be picked up during an internship / at a job.
a databases class is pretty useful.
>>
>>59695525
This one was first.
>>
>>59695564
Sheeit.
Is there way way to maintain a reference like that or no
>>
>>59695541
figured it out.
interface was like this :
List<GameRecord> getGamesForPlayer(int playerId);


concrete implementation was like this:
ArrayList<GameRecord> getGamesForPlayer(int playerId) {
...
}


Surprisingly, I was getting an error, but turns out Eclipse (IDE) is fucky sometimes and needs a refresh / project->clean
>>
File: shit chart who cares.png (58KB, 496x496px) Image search: [Google]
shit chart who cares.png
58KB, 496x496px
>>59695490
databases is a real technology so it's more useful. with the other they could waste your time with the shittiest, most useless charts possible like pic related
>>
>>59695623
You should have kept the signature the same and simply return an ArrayList in the function. There's no need to change the return type of the function to a more specific object.
>>
>>59694840
Databases is one of the things I think university could have taught me well. Hopefully they don't jump on fancy new systems or recommend nodb. Nodb doesn't fit most database use cases but they're super trendy (I think).
>>
>>59695655
Can you elaborate? I'm not sure what this would accomplish. I suppose if you don't want a client to know specifically what type of List is returned...
>>
>>59695568
Alright, so based on the responses databases seems more useful. Do you think I could learn those software engineering concept myself over hte summer? Any books to recommend?
>>
>>59695494
Oh this was you declaring success?
You're terrible at making yourself clear anon. I thought you just admitted defeat/was waiting for more help until I saw >>59695623
You should probably work on being more clear. It's an important skill.
>>
>>59695738
well it depends. are you wanting to be an application developer after graduation?

https://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054
https://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420
https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882

you should probably learn version control if you have not already. any standard git tutorial will suffice. next time you are working on a personal project / assignment try throwing it into github or gitlab or something
>>
>>59695707


>I suppose if you don't want a client to know specifically what type of List is returned...
The interface is what your client see and thus they should see a List<GameRecord> not a ArrayList<GameRecord>.

>I'm not sure what this would accomplish.
You're implementing the interface you wrote is what it accomplishes. The correct way to do it would have been:

//interface...
List<GameRecord> getGamesForPlayer(int playerId);
//...

//implementation...
List<GameRecord> getGamesForPlayer(int playerId) {
//... creating the ArrayList or w/e
return arr; // where arr is your ArrayList
}



That's how interfaces are meant to be done and the entire point of having the interface be a generic List rather than an ArrayList to begin with incase you change it down the line.
>>
>>59695750
anon, I specified that I was attempting to implement a method to return an ArrayList<> and the interface that it's implementing specifies a List<>, and wondering why i was getting an error. I also mentioned covariant return types, which is a feature in the java programming language. I suppose if you don't know what an interface is, or what covariant means, than that explains why my post was confusing to you.
>>
>>59695796
Yes. I am graduating after next semester. I've already messed around with git a little but I haven't gone that in depth with it.
>>
>>59695831
No anon my understanding of the problem is actually completely irrelevant. The problem is that
>>59695494
Doesn't say anything indicating success.
>>
>>59695738
first they will teach you about the "waterfall model" method of development which is to plan everything for months before starting your project, which turns out doesn't tend to work so then there are others like "agile" and similar ones (which even then is mostly a meme but if it ever happens that you go to a place that says they use agile just say you like it I guess?) that you can look up on wikipedia. Then there is UML which is a famous oop chart that you can also look up on wikipedia. And that's about all they will teach you, you are done and now they are just buying time to fulfill the semester quota...
Unless you REALLY like shit charts, you looked at >>59695637
above and though "hmm the shit chart is amazing, I really like my charts to be as shit as that chart, I want to dedicate my life to trying to make a chart as bad as that" then just enroll already
>>
>>59687849
He still makes me happy.
>>
>>59688267
CSS with Jquery.
>>
Absolute C beginner here, I'm trying out some basic math functions/operations, and I'm currently trying to deal with returning and sending arrays in functions.

I think I got an okay grasp of how the pointers gets sent back and forth instead of the actual array, but I think I'm fucking up the memory handling somehow - I have a simple function that generates an array from 1 to n, and the another function that sums the array to an integer. Now, it works on the first call, but on the second it only returns nan. So, is this some lingering memory thing, do I need to declare/free my stuff more stringently?

NOt looking for an explicit solution, just a general pointer in the right direction.
>>
>>59696804
pay close attention to the lifespan of whatever you're fucking with
>>
>>59690341
Raaaahahahahahaha, I got the joke
>>
>>59696804

> on the second it only returns nan

Nan is not a thing for ints, it's something in the floating point specification.
>>
>>59688546
hardly. if some faggot that really loves rust so much, and thinks curl is shit cause it's in c, they should totally go do it better in rust.

If they achieve it, and make it open source, everyone benefits. If they don't, it's just some faggot's time that was lost.

If someone wanted to take 20 good devs away from the kernel to re-write it in rust, then I would take exception.
>>
>>59690394
JS and Python - 9 inches strong
>>
>>59697179
>>59697413

Looking at it think it's something I'm fucked up with printf - I'm doing something wrong in the code, and improperly displaying it back to me on top of that. Thanks for the input in any case!
>>
>>59687419
>not making a lisp in forth
forth is more powerful
Thread posts: 341
Thread images: 28


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