[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: 318
Thread images: 31

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Previous thread: >>61425574
What are you working on, /g/?
>>
IF YOU USE JAVASCRIPT YOU NEED TO KILL YOURSELF AND FUCK OFF TO >>>/G/WDG RIGHT ABOUT NOW
>>
File: 1499804168175.jpg (88KB, 1280x720px) Image search: [Google]
1499804168175.jpg
88KB, 1280x720px
>>61437065
>tfw fell for the D meme
>can't be comfortable with any other language in existence
>peak baby duck syndrome
>>
>>61437094
D is shit in some regards, so just write lots of code which uses that kind of thing and you'll get over it
>>
Is swift the sepples and java killer?
It looks really promising. The only real contender is D.
>>
DO NOT REPLY TO BAIT

THEY ARE PAID GOOGLE TROLLS WHO ARE DESPERATE FOR (YOU)S BECAUSE THEY ARE DESPERATE FOR PEOPLE TO FILL IN THE CAPTCHA BECAUSE THEY'RE STRUGGLING WITH THEIR SELF-DRIVING CARS

DO NOT LET PAID GOOGLE TROLLS SHIT UP THE THREAD
>>
>>61437065
Who is satori?
>>
>>61437114
nothing with automatic memory management will ever kill sepples
>>
>>61437114
>D
Nim is better but I got too much used to D
>>
>>61437138
2hu.
But satori in the picture is not refering to character/person.
>>
>>61437141
sure but they are better languages when you just want native application and don't care that much about performance.
>>
>>61437094
>can't be comfortable with any other language in existence
>is sad to believe he has found the comfiest possible language
>this language is an imperative shitlang
Learn Haskell and/or Idris.
You're welcome.
>>
File: vb-metroidprime.jpg (79KB, 600x350px) Image search: [Google]
vb-metroidprime.jpg
79KB, 600x350px
>>61437065
>try to teach self lua to program using only my android to make virtual boy esque video games to be played in vr
>give up because just to consider doing this made me too retarded to realise I was retarded

I made pong though at least.

>inspiration
>>
Hey /dpt/ total noob here. Taking classes at a community college, and learning Java. I imagine that's gonna make me the object of ridicule here. Regardless, Im starting to feel like the classes are going too slow for me, and I would like to start to take up another language, or start to learn more advanced things in Java. So I have a few questions.

Should I continue learning java? It seems pretty hated here, but I also here its where a lot of jobs are, and im learning it in school anyway.

At what pace can I reasonably expect myself to continue when teaching myself?

How do you guys stay motivated to learn? What keeps you from fucking off and playing a game?

Thanks in advance for any kind anons who want to help me get a scope on the whole thing.
>>
>>61437188
Java is the easiest way to get a code monkey job. It's good to know, and it's not hard to know. You shouldn't be finding it hard.
>>
>>61437179
Best languages are languages that does not force a specific paradigm. The only thing that stings me is that D's GC is not thread-local --which means it has a global memory heap/allocation which will stop the world
>>
https://en.wikipedia.org/wiki/Homelessness_in_San_Francisco
>Reasons cited for homelessness in the 2015 survey commissioned by the City include job loss (25%),
JAVASCRIPT CODE ARTISANS BTFO
>>
>>61437255
The worst languages are the ones which try to be everything at once, especially when they get that way by snowballing tacked-on shit rather than by design.
>>
>>61437065
fuck off animeposter
>>
>>61437287
> try to be everything at once
D isn't one of them :)
>>
>>61437179
>hur a dur moan ads are the best
>
Maybe Integer

In C this is just
int *
>>
How do I make functions which transform trees tail-recursive?
For instance this one.
(defun m-macroexpand (form)
(if (atom form)
form
(destructuring-bind (a . b) form
(let ((mac (gethash a *menv*)))
(if mac
(m-macroexpand (funcall mac b))
(cons (m-macroexpand a) (m-macroexpand b)))))))
>>
>>61437114
nah fuck applel
>>
>>61437317
C doesn't have a construct analogous to maybe.
C++ does have std::optional, but it's clumsy.
>>
>>61437330
I don't think he understands Maybe
>>
Searches Demonoid now. Also the display of seeders/leechers was super fucking broken so I fixed that. Any recommendations for stuff I should be adding to this?
>>
>>61437223
Oh yeah, its actually been really fun to learn so far. Im sure when im working on real projects, and not school assignments, I will understand why you affluent gentlemen have such distaste for it.

I just want to grow, and not wash out like I feel 80% of my class is going to.
>>
File: kaskade.png (59KB, 897x341px) Image search: [Google]
kaskade.png
59KB, 897x341px
>>61437345
Forgot to post pic.
>>
>>61437317
Except the destination int* has 4 states. Null, integer, something which is used to be something other than integer and most importantly: invalid memory. Maybe only has 2 states and you have to implement code for both of them.
>>
>>61437336
https://www.youtube.com/watch?v=JqczAyFIyos
>>
>>61437347
Java is a very dumbed down language. Once you have experience with other languages, you'll sense that it was built for the lowest common denominator (i.e. pajeet) to be able to write semi-competent OOP.
That said, it's still a robust language and you should definitely know it.
>>
>>61437330
>C doesn't have a construct analogous to maybe.
Yes it does.
int *
>>61437336
>I don't think he understands Maybe
I sure do.
A Maybe a is either a Just a, which wraps an a, or a Nothing, which is nothing.
Additionally it provides a return function which constructs a Just a, and a bind operator which only calls a function accepting an a on a Maybe a if that Maybe a is a Just a.
int * can do all these things. An int * (when used properly) is either a valid pointer (Just int) which wraps an int, or the integer value 0 on its own, with nothing wrapped at all (Nothing).
Return is just malloc.
Bind operator is just if.
>>
File: s.png (117KB, 1680x1050px) Image search: [Google]
s.png
117KB, 1680x1050px
>>61437065
>What are you working on, /g/?

Exploring the deepest, darkest corners of Racket.
>>
>>61437359
link to kaskade.py
>>
>>61437312
>lets replace C and C++
>memory is hard lets add garbage collect lol
>what is java c# golang?
>>
>>61437425
>what is java c# golang?
Garbage
>>
>>61437363
You don't use the latter two. Using the third state you describe is type-unsafe, so you shouldn't so it. Using the fourth is a rookie mistake. So an int * is basically a Maybe int as long as you use it right.
>>
>>61437414
https://github.com/NotHawthorne/kaskade
Working on stripping results that have the same magnet from a different site, and a prefix before each torrent name that tells you what site it's from.
>>
>>61437430
All significantly better designed than D, at least they had clear design goals.
D wanted to be "C++ but better" but then forgot to keep the only thing that makes C++ relevant.
>>
>>61437466
>All significantly better designed than D
Each one of them are objectively worse than D. Although all of them are better than C++ but that's not a big feat.
>>
>>61437401
>int * can do all these things. An int * (when used properly) is either a valid pointer (Just int) which wraps an int, or the integer value 0 on its own, with nothing wrapped at all (Nothing).
>Return is just malloc.
>Bind operator is just if.
Dude
You are retarded

It's not about what you can do but what you cannot do wrong. In this respect Haskell is superior.
You cannot dereference the invalid memory pointer by mistake in Haskell.
>>
>>61437383
Excellent. If you dont mind me asking, what all have YOU learned, and over what period of time? What keeps you motivated to keep learning? Do you work in the field yet?

Is it possible to catch up? Im 22 now. Is there really an Asian kid/ paj ready to take my job at any moment?
>>
>>61437493
Data.Maybe.fromJust
>>
>>61437466
>only thing that makes C++ relevant.
1. Microsoft kept C++ alive
2. C++ is very old and mature, so more libraries are written in it
3. Being compatible with C at the source level, C++ piggybagged on C's legacy.

I'm glad that language monopoly is slowly being abolished and C++ meme is finally dying
>>
>>61437304
you need to go back
>>
>>61437519
D can link with C and C++ effortlessly. Why hasn't D replaced C++?
Because it's useless without the GC, and there are millions of better garbage collected POOlangs.
>>
>>61437546
>and there are millions of better garbage collected POOlangs
Not really. Also being able to call sepples easily is kind of HUGE thing just because there exists so much shit written in sepples.
>>
>>61437094
haskell
>>
>>61437608
>Not really.
Then why is D dead?
>>
>>61437546
No language can "link" with C++ effortlessly. Although it can call some of the, in fact most of the C++ natively.
>Why hasn't D replaced C++?
1. No multibillion dollar company shilling it
2. Shitty GC that hasn't got any attention whatsoever
3. Language too big
4. About 20 years younger than C++

>Because it's useless without the GC
Any language that supports GC properly is bound to have GC dependent libraries, no one is interested in manual memory management anymore. But for that I guess you'd have to have tons of Macros in the standard to make up for the GC independence.

GC isn't inherently bad, what you are thinking of is the conventional global mark-sweep GC (I think your hasklel/idris has it as well) that stops the world.

It saddens me that although D community is aware and trying to make a better GC, they probably aren't going to make a thread-local GC.

>>61437632
>1200 pages book
>Costs money
Please
>>
File: 199990.png (559KB, 396x600px) Image search: [Google]
199990.png
559KB, 396x600px
Here's the Mona Lisa with 199990 lines. At this point, you can hardly tell a difference between the generated image and the real thing.
>>
>>61437545
>"he's anti-anime on an anime website with an anime owner and he's also probably an newfag hehehehe" am i rite

fuck off
>>
>>61437652
Most used languages are not used because they are good...
>>
>>61437654
Forgot to add:
Walter is not doing anything about the GC. This is why probably I'll end up jumping ship to Nim.
>>
>>61437493
>It's not about what you can do but what you cannot do wrong. In this respect Haskell is superior.
But anon, that respect doesn't matter.
>>
>>61437819
>I like writing buggy code.
>>
Programming breeds anxiety in my head for no fucking reason

Should I unsarcastically exercise
>>
>>61437830
No see the trick is to learn how to write code that has no bugs DESPITE not relying on any kind of safety.
>>
Now that I'm comfortable with function pointers in C, I find that I use them a lot to give different behaviors to the same typed struct. For example, if I have an entity type in a game, I'll have the update and render functions be members of that structure. That way, I can implement all of the different kinds of entities under the same type by just creating unique update and render functions.

My first language a few years ago was Java. Has anybody else that started with Java catch his or herself programming in a Java style, even when it may not be the most appropriate thing to do?
>>
>>61437546
>Why hasn't D replaced C++?
>"Let's rewrite the whole in wolrd in another language"
>"say no mo faam"
>>
>>61437853
Java didn't have any issues replacing C++ for general purpose application development, and had significantly more trouble interoperating with C++.
>>
Can I master python in a day?
>>
>>61437065
>What are you working on, /g/?
started to learn python
currently working on a math game... i'm doing some tutorial course
>>
>>61437663
Incredible. Triangles BTFO.
>>
>>61437852
That's what they're built for.
>>
>>61437864
C++ could never match Java actually, Java was more popular from the beginning. And it kept taking off when Android adopted it.
>>
>>61437841
I mean, I do, but thats mostly because im a fat 300 pound fuck.

>>61437865
Master? unless you know some other languages, especially C and java, im gonna say no. Learn some? sure.
>>
File: 564.gif (4MB, 250x140px) Image search: [Google]
564.gif
4MB, 250x140px
Reminder to show off your language/skills >>61435322
>>
File: s.png (84KB, 1680x1050px) Image search: [Google]
s.png
84KB, 1680x1050px
>>61437865
probably not, but you can master Racket in ten minutes!
>>
File: 1499991152021.png (561KB, 750x874px) Image search: [Google]
1499991152021.png
561KB, 750x874px
Is it worth it to start learning C++ or should I just sharpen my skills with other languages I am slightly above novice level with? (C, Java, and Python)
>>
>>61437911
>you can master Racket in ten minutes!
You have been "exploring the dankest parts of racket" for months
>>
>>61437654
What? Haskell doesn't cost money.
>>
>>61437654
1) skip the LC bit
2) there's a pdf of haskell from first principles up somewhere
check lainchan book links
>>
>>61437913
C++ is a complicated and confusing language. You should be good at C and Java first.
>>
>>61437519
>C++ meme is finally dying
not really, and if it is it's not because of D(ead)
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>61438055
C++ is dead, boy
>>
>>61438068
>C dying faster than C++
lmao
>>
>>61437865
>master
no
>make useful program
sure
You don't need to know python to make useful stuff with it.
>>
File: 1461518482869.jpg (42KB, 433x552px) Image search: [Google]
1461518482869.jpg
42KB, 433x552px
>>61437909
good doggo saving the day, what happened tho?
>>
>>61438068
it's overtaking C in a year or two dumb shit

where is D even in that graph?
>>
>>61438075
C will forever remain in a plateu since almost all languages can FFI with it.

C++ however, ... dead soon
>>
Why do C-like languages all push this meme that everything should be everything else?
C:
>pointers to different types
>just kidding you can implicitly cast a pointer to any non const type to a pointer to any other type
C++:
>different classes
>just kidding implicit constructors and cast operators
Java:
>different classes
>just kidding they're all Object
>>
>>61438068
This isn't necessarily a bad thing
>>
>>61438092
a slight downward slope doesn't mean it's dying just that newfags and their snowflake faglangs are diluting the market
>>
>>61438085
There was talk in cppcon 2014 or 2015 where the guy was talking about sepples in embedded.
The graphs he shoved actually shoved that sepples peaked somewhere 2000 but then it was steady fall and increased use of C. So it won't be overtaking C at least on embedded field and C is not even used that much on Application field.
>>
How difficult would it be to make a very simple and basic browser in python?
>>
>>61437985
Thanks friend. I'll try and tune up those skills before I jump into it.
>>
>>61438109
Enjoy being taken over by C# LMAO
>>
>>61438111
You can see suckless surf which is like 3k lines of C. So writing working browser in python using webkit should be easy, making it useful might be bit harder.
>>
>>61438121
they're not even in the same space. C# competes with java not C++. enjoy being taken over by python LMAO
>>
>>61438097
use a strongly typed language
>>
>>61438147
no good strongly typed language exists, though.
>>
>>61438147
Java is strongly typed though
>>
>>61438142
Looks like C# IS taking over C++ in terms of "popularity". IDK why should anyone care but there you go, the current state of C++

It could never even surpass Java in popularity, it could not replace C and now, it's being overtaken by C#. What a sad story.
>>
>>61438156
>
>>
>>61438161
sure is summer
>>
>>61438149
Haskell
Idris
>>
>>61438172
If that makes you feel any better, sure
>>
>>61438175
>idris
>implicit conversion
>>
Which is more popular the microcuck c# or applefag OBJECTIVE-c?

>>61438175
>good
>>
wasm will save c/c++
screencap this post
>>
>>61438177
you're literally shitposting. keep those (You)s coming. you're either paid by google to boost captcha activity or you belong in a psychiatric ward
>>
>>61438097
For the Java example, there are many similar ones.
In fact Java is the epitome of "just kidding."
If it had a short all caps name like many imperative languages do, it wouldn't be called J, it would be called JK.
>>
>>61438197
dumb nu-male hipster poster.
>>
>>61438210
>>61438205
>>
>>61438205
"sure is summer"
>>
>>61438209
Really? Java seems pretty regular to me.
At least it was in the early versions.
>>
>>61438188
>implying Haskell and Idris are not good
>>61438183
>>implicit conversion
>>
>>61438216
>>61438197
There's no point in compiling C or sepples into wasm when you could actually used better designed language for that.
Also you should not use web anyways for general applications.
>>
>>61438223
>It could never even surpass Java in popularity, it could not replace C and now, it's being overtaken by C#. What a sad story.
yeah what a sad story. i'm literally crying out of sadness.
>>
>>61437882
It still makes me feel like I'm missing the point when I automatically jump to that design choice. You know? I suppose it just takes time to get one's own style.
>>
>>61438234
http://docs.idris-lang.org/en/latest/tutorial/miscellany.html#implicit-conversions
>>
>>61438253
You're using function pointers precisely as they were intended to be used. Even overridable methods in C++ are implemented a similar way. There's nothing wrong with what you're doing.
>>
>>61438229
>objects
>just kidding they're actually reseatable smart references
>ints
>just kidding they're actually implicitly converted wrapper classes
>generics
>just kidding you can't even fucking make traits with them
>default methods in interfaces
>just kidding, interfaces STILL can't hold non-static state
>no operator overloading
>just kidding it's okay for strings
>>
>>61438229
you're right. disregard the underage summerfag shitposting
>>
>>61437188
in a similar spot, except i'm not doing csci in school anymore.

>How do you guys stay motivated to learn? What keeps you from fucking off and playing a game?

games don't interest me much anymore. learning and progressing is more satisfying...and harder than most games

>>61437508
i'm 21, not going into the field, but dude...don't worry about your age. its a non-factor if you're 22. people switch into programming in their 30s even.
even if there is some kid that is ostensibly as competent as you code-wise, that's not all landing jobs is about. i can't tell you how many asians(foreign kids, not asian-americans) in my csci classes were REALLY bad at english to the point where they couldn't really ask questions easily.
>>
>>61438319
this. also, starting at an early age is overrated because kids are brainlets, you can't become a great programmer until you're at least in your 20s, those child "prodigies" are literal memes
>>
>>61438299
>just kidding, interfaces STILL can't hold non-static state
import java.util.HashMap;
import java.util.Map;

public class FooBarTester
{
public static void main(String[] args)
{
FooBar myFooBar = new FooBar();
myFooBar.setFooMessage(args[0]);
myFooBar.setBarMessage(args[1]);
myFooBar.sayFooMessage();
myFooBar.sayBarMessage();
}
}

public class FooBar extends Foo implements Bar
{

}

public class Foo
{
private String message;

public void sayFooMessage()
{
System.out.println("I am a Foo. I am stateful; my state is " + message);
}

public void setFooMessage(String message)
{
this.message = message;
}
}


public interface Bar
{
class BarImpl implements Bar
{
private static Map<Bar, BarImpl> barImpls = new HashMap<Bar, BarImpl>();

public static BarImpl get(Bar bar)
{
if (!barImpls.containsKey(bar))
barImpls.put(bar, new BarImpl());
return barImpls.get(bar);
}

private String message;

public void sayBarMessage()
{
System.out.println("I am a Bar. I am stateful; my state is " + message);
}

public void setBarMessage(String message)
{
this.message = message;
}
}

default public void sayBarMessage()
{
BarImpl.get(this).sayBarMessage();
}

default public void setBarMessage(String message)
{
BarImpl.get(this).setBarMessage(message);
}

}

Where is your god now?
>>
File: wasm.png (314KB, 500x684px) Image search: [Google]
wasm.png
314KB, 500x684px
>>61438197
>>
>>61437086
But I somehow landed a test automation job where I have to use it among some gay frameworks... :(
>>
>>61437188
>At what pace can I reasonably expect myself to continue when teaching myself?
For a while you learn faster after the class than in the class. Not because the class is shit, but because you know how to expand and think about the problems you run into.
>>
File: 1494325469350.jpg (69KB, 500x500px) Image search: [Google]
1494325469350.jpg
69KB, 500x500px
heló
>>
>>61437065
Why's she so angry
>>
File: so_kurumu_by_djamjr805-d475b5l.jpg (180KB, 900x572px) Image search: [Google]
so_kurumu_by_djamjr805-d475b5l.jpg
180KB, 900x572px
>>61437103
Every language is shit in some regards.
>>
File: The More You Hail.png (33KB, 512x491px) Image search: [Google]
The More You Hail.png
33KB, 512x491px
>>61438542
Why don't we make one that's not then?
>>
>>61437508
>Asian kid
No
>paj
Yes

I learned C++ through game programming when I was 12 (because that is what we used back then) and then went to college where the cs department's default language was C++. Then I added a language feature to C++ but if I tell you which you'll find out my real name.
>>
>>61438606
Already tried that. Ended up with rust.
>>
>>61438632
Isn't that the tranny language though? I mean a /g/ lang.
>All vars encrypted, but modifications to data implemented as if it wasn't
>keywords are all shitposts about gentoo
>only usable to make a mediaplayer for anime
>50% chance of destroying your PC
nevermind.
>>
>>61438675
I think C+= was /g/ if I'm remembering right.
>>
Does anyone need any help? I am good at programming
>>
>>61438926
What could you help with?
>>
>>61438833
Hadn't heard of it
>>
Im quite new to testing a code.

How do i write a proper test for this "updateDays" with mockito and junit?

days is an string array with size of seven and class name is "spr"


private Calendar cal;

...


void setCalendar(Calendar c) {

cal = c;
}

void updateDays() {

cal = Calendar.getInstance();

for (int i = 0; i < 7; i = i + 1) {

days[i] = cal.getDisplayName(Calendar.DAY_OF_WEEK,
Calendar.SHORT, Locale.US);

cal.add(Calendar.DATE, 1);
}
}


tried this but wont work

@Test
public void testUpdateDays() {

String[] array = {"Mon", "Tue", "Wed",
"Thu", "Fri", "Sat", "Sun"};

Calendar mockCal = mock(Calendar.class);

//last monday
mockCal.set(2017, 7, 17);

spr.setCalendar(mockCal);
spr.updateDays();

assertArrayEquals(array, spr.days);
}
>>
>>61438948
They changed hosting a few times, but I believe this is their current homepage: https://gitlab.com/femsf/c-plus-equality
>>
>>61438945
anything except webdev and c#
>>
>>61438926
Could you figure out a way of implementing linear types in GHC without having to give up exceptions?
>>
>In a union, at most one of the non-static data members can be active at any time, that is, the value of at most one of the non-static data members can be stored in a union at any time.
in C++, if the data members in the union have the same type (let's say unsigned char), you can read the same value from an inactive member as the active member, right? and there is no undefined or implementation-defined behavior?
>>
File: opencv.png (231KB, 1366x768px) Image search: [Google]
opencv.png
231KB, 1366x768px
>>61437065
>compiling openCV on an underpowered laptop
Now I understand all the bash on sepples' compilation time
also lol openCV has warnings
>>
>>61438976
Holy shit what the fuck
Are you sure this was /g/?
>>
>>61438979
I wish I had something to ask you but honestly everything nowadays is somehow related to web development. And even then there aren't much programming related things I couldn't read about in a book. I wish I had an internet connection when I was a kid so I could have started to learn programming at a younger age.
>>
>>61438976
Subtlety has never been 4chan's strong suit
>>
>>61438505
szia tomika
>>
>>61437363
Maybe<T> is basically analogous to a safe nullable reference, which can refer either to a valid object of type T, or to nothing (null). That's a pretty common pattern in OOP languages, where objects are typically accessed via references. C has no notion of a "safe nullable reference" since nothing in C is safe, but pointers do implement the interface of a nullable reference, and proper programming practices can ensure that a pointer is always either valid or null, making it essentially the equivalent of Maybe.

>>61437493
>You cannot dereference the invalid memory pointer by mistake in Haskell.
That's really an overall language design feature though, it doesn't change the definition of what a Maybe is. A Maybe is literally just a nullable reference. The difference between the Haskell and C implementations of Maybe are that C lets you get away with not writing null-handling code for dereferencing your Maybe, at least until it causes your program to crash.

>>61438833
It was from the "Feminist Software Foundation", a group with no real history, so it probably can't be determined if /g/ was involved or not.
>>
>>61439126
https://archive.rebeccablacktech.com/g/thread/38739122/
>>
>>61438994
i have only used linear types with mercury, the uniqueness is handled in the static environment.

https://www.mercurylang.org/information/doc-release/mercury_ref/Unique-modes.html#Unique-modes
https://www.mercurylang.org/information/doc-release/mercury_trans_guide/IO.html#IO
>>
>>61437065
Quality OP image, thanks for not using a suicide cultist :)
>>
File: Shikamaru_thinking.png (1MB, 1429x1080px) Image search: [Google]
Shikamaru_thinking.png
1MB, 1429x1080px
Anyone know hard would it be to create a chatbot with python that could be used by small businesses? Users could ask it questions about item stock, hours of operation, appointments, etc... Just trying to get an idea for something me and two others could hack together in 3-4 weeks for a summer course on machine learning that we're taking.
>>
>>61439125
gáspár vagyok
>>
I like functiona construct such as map/filter/reduce, but I don't like the academic bullshit surrounding it. Is there a language suited for me?
>>
File: Screenshot_20170718-190909~01.png (716KB, 810x878px) Image search: [Google]
Screenshot_20170718-190909~01.png
716KB, 810x878px
>>61437094
I avoided D for this reason actually. I saw that I would have to use the GC and certain other issues I saw with it that'd be prohibitively expensive to get all the convenience so I had to skip it because it would just make me jealous.

I'm hoping for JAI now. That Jonathan Blow guy has the right priorities and I like his approach to language design.

This captcha worries me Google. Why do you need to distinguish helicopters and boots on the ground in the mountains of Afghanistan?
>>
>>61439261
brainlet.tiff
>>
>>61437434
>a goto is basically a loop as long as you use it right
Your argument is retarded
>>
>>61439238
import random

GREETING_KEYWORDS = (
"hello", "hi", "greetings"
)

GREETING_RESPONSES = [
"'sup bro", "hey", "*nods*"
]

def check_for_greeting(sentence):
for word in sentence.words:
if word.lower() in GREETING_KEYWORDS:
return random.choice(GREETING_RESPONSES)
>>
>>61439261
ocaml
>>
>>61439289
why?
>>
>>61439278
I'm not interested in the theory of a monoid, but I want to know how and when I can use one.
>>
>>61439299
OCaml
>>
>>61439238
I'd write an IRC bot and embed an IRC client on their web page.

It wouldn't be too hard. There's a bunch of IRC bots open sourced and you could just write one yourself if you don't like their api. The IRC protocol is very simple.
http://blog.initprogram.com/2010/10/14/a-quick-basic-primer-on-the-irc-protocol/
This is a better guide than most.

The most difficult bit is making something that understands the large variety of commands the users can send. But if you just have it be open about what it can answer it should be fine. Help the users guide it.
>>
>>61437363
>int* has 4 states
false
>Null, integer
those are the only ones
>>
>>61439307
How does OCaml compare to languages like Haskell and Scheme? I know of OCaml's existence because of FFTW.
>>
>>61439298
it's not pure
it's not lazy
it doesn't have monads in the standard library at least I think
>>
>>61439318
Depends on your platform.
If you 'only have' these states then you're still probably writing on a platform where the pointer can be in strictly undesirable states.
>>
>>61439337
>no unsigned type
>only int and 64bit float and even those are boxed
>no native thread support, GIL
>dumb ass syntax with ;;
>no libaries and very retarded C interface
Fuck everything about ocaml, just use some SML.
>>
>>61439261
>i like using FP but i dont like thinking about it
>how can i stay in the middle?
>>
>>61439320
OCaml is not lazy, so compared to Haskell you don't need decades to know the complexity of your function.
Ocaml has types, so compared to lisp it's safer.
>>
>>61439431
Correct. I like Lisp because of how simple it is. I dislike it because it lacks a type system. Macros are a hit and miss.
>>61439434
I'll give OCaml a shot. How's 3rd party library support?
>>
>>61439528
>How's 3rd party library support?
What are you talking about?
>>
>>61439642
Are there bindings available for cURL and SQLite via a package manager?
>>
>>61439697
Of course not.
>>
>>61439697
Maybe with opam.
>>
>>61437065
ray tracer I'm hoping to make a gay tracer but I don't know how yet.
>>
File: s.png (80KB, 1680x1050px) Image search: [Google]
s.png
80KB, 1680x1050px
Just implemented the Collatz Sequence... Am i a mathematician now?
>>
>>61439528
Somebody released this the other day https://github.com/ryanrhymes/owl

There is also a high performance guide to OCaml https://janestreet.github.io/ocaml-perf-notes.html
>>
>>61439528
>How's 3rd party library support
You will likely find the most common stuff like curl, sdl, opengl, gd bindings and stuff, the community is pretty active but small.
You won't find anything bigger like bindings to some game engine or some other huge sepples library.
>>
File: maxresdefault.jpg (112KB, 1920x1080px) Image search: [Google]
maxresdefault.jpg
112KB, 1920x1080px
>>61438959
You have a misguided understanding of how mocking works, you don't need it in this case.

@Test
public void test() {
String[] array = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };

Calendar mockCal = Calendar.getInstance();
mockCal.set(2017, 7, 17);
spr sprInstance = new spr();
sprInstance.setCalendar(mockCal);
sprInstance.updateDays();
assertArrayEquals(array, sprInstance.days);
}


I failed the test because its no longer monday today, your array starts with whatever day you are on right now
days[i] = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.US);
>>
>>61437663
>Mona Lisa with 199990 lines
Do you have the script for it?
>>
Tuple literals!
>>
>>61439805
I took a look at OPAM and most stuff is available. Hopefully they're of good quality (unlike some Haskell libraries).
>>
>>61437663
what's the process to generate this kind of images?
>>
>>61439746
lmao
>>
So which one is the better recursive sorting algorithm, Merge Sort, or Quick Sort?
>>
File: 9YmKi4i.jpg (319KB, 1506x2048px) Image search: [Google]
9YmKi4i.jpg
319KB, 1506x2048px
>>61440091
are you a computer scientist? merge sort
are you a computer engineer? quick sort
>>
>>61440107
Would please elaborate why? Is it because merge sort is a bit more complex? Rookie here, trying to wrap my head around algorithms in general.
>>
does anyone know how to access the "Darkweb"
>>
>>61440158
install racket
>>
>>61440158
1. Log into your profile on any website
2. Go to any part of your profile that only you can access
And you're there
>>
whats racket
>>
>>61440158
>install tor
>search for hidden wiki
>????
>watch cp
>>
>>61440158
>>61440190
rip, I thought you said Deep Web
>>
File: index.png (8KB, 256x197px) Image search: [Google]
index.png
8KB, 256x197px
>>61440194
>>
thx hey u have anything i can talk to u on anything else possibly like social media
>>
>>61440141
merge sort has a lower complexity but quicksort is still faster in reality due to how processors are implemented.
>>
i found this thing called tor
>>
https://www.torproject.org/
>>
Should I upgrade to Python 3.6 from 3.5?
>>
I'm coding web app in javascript and there is nothing you can do about it.
>>
>>61440230
I see, so that's why a Computer Engineer would use quick sort. Thanks anon, now I feel like I need to go deeper, and study how processors are implemented, just for kicks.
>>
>>61440411
you should upgrade to python 2.7
>>
>>61440502
Time to take your meds, gramps
>>
>>61440502
ANSI C is more portable though.
>>
>>61440552
>we break compatibilty with your libararies because it's hip and cool to do so
You should switch to javascript and leave python to academics, faggot.

>>61440617
True, but it sucks for prototyping.
>>
Is Rust simply Haskell for cattle nigger?
>>
>>61437065
Writing a limited vbo update procedure to avoid recalculating an entire chunk when I make a small change.

A-at least it didn't crash.
>>
>>61440705
Rust is an aimless clusterfuck that only knows that it wants to replace C++.
>>
>>61440742
So it's equal to C++, no?
>>
>be me
>work as a C++ programmer
>get a side project
>frontend webshit
what am I in for
>>
>>61440818
No fun
>>
>>61440813
Yep, but at least you won't leak as much.
>>
>>61440818
Javascript.

Although fucking around with Javascript can actually be fun if you know what to poke.
>>
File: 2017-07-18-145700_1366x768_scrot.png (132KB, 1366x768px) Image search: [Google]
2017-07-18-145700_1366x768_scrot.png
132KB, 1366x768px
I made a conky alternative in bash
>>
>>61440818
Webassembly, look it up it's specifically designed for C/C++
>>
File: 1499714141512.jpg (155KB, 540x721px) Image search: [Google]
1499714141512.jpg
155KB, 540x721px
Any good (preferably language-gnostic) books on procedural programming? I'd like to get my mind off the object oriented mindset.
>>
>>61440929
UX pro tip: blue on black does not work.
>>
>>61440951
Did you consider FP?
>>
>>61440933
Really?
>>
>>61440957
Thanks, I made it light blue
>>
>>61440951
Pick up a book on Ada.
>>
>>61440982
Even compiled my sdl game to wasm, it just werks

I don't think it's sane to make your usual website using it thou
>>
>>61437065
Writing a python script which conrtrolls spotify
>>
>>61439264
>JAI
>Google search JAI
>Pajeets all over the place
>Turns out it's a common pajeet name
kek
>>
File: oiIxPXk.png (21KB, 561x266px) Image search: [Google]
oiIxPXk.png
21KB, 561x266px
>>61439051
man tell me your os de and all the customization you did your ss doesnt look so good but its nice somehow
>>
I've spent all this time learning C++ and I still haven't made anything useful. Give me ideas
>>
>>61441064
automated reddit shitposter
>>
>>61440974
I'd actually like to be able to do useful things.
>>
File: Niina057+copy.jpg (101KB, 750x1106px) Image search: [Google]
Niina057+copy.jpg
101KB, 750x1106px
>>61439806
Thanks alot man :) i thought already nobody is going to answer :D
>>
>>61441064
Learn a better language
>>
>>61441072
Idiot.
>>
C++ is the worst language ever made.
>can't define a member function as using or returning const pointers / references if the receiver is const and non-const otherwise
>can't use the subscript operator on a const map
>can't convert implicitly between smart pointers and bare pointers
>>
what the fug, why does this not work
data (Num a) => Tree a = Leaf a
| Branch (Tree a) (Tree a)
deriving (Show)
>>
>>61441206
>>can't define a member function as using or returning const pointers / references if the receiver is const and non-const otherwise
what?
>can't convert implicitly between smart pointers and bare pointers
I hate this one, yeah.
>>
>>61441235
Do not put constraints on type, but on functions.
>>
>>61441267
But why can't I force the Tree to only hold instances from the Num class?
>>
>>61441241
>what?
for example if you're writing a data structure or wrapper then you're going to have member functions that return members by reference
you shouldn't have to declare and implement such a function twice just because the container might be const
there should be a qualifier along the lines of "maybe_const" or something that says "the pointed to or referenced type is const iff where it's coming from is const"
>>
>>61441096
???
>>
>>61439951

I wrote it, so yes.

>>61440011

1. Generate pool of candidates (in this case 3,000)
2. Select the candidate which reduces the error the most, and apply it to the canvas

That final image's raw error (summation of error for each pixel) was roughly 1.7M, where it started at a couple hundred million.
>>
>>61441043
Haha I had no idea. I just get programming related stuff. Google is smart.
>>
>>61441309
You're talking about const overloading. Yeah, that's somewhat annoying.
Does std::map not do const overloading? You shouldn't be using it in general but still.
>>
>>61441206
>>can't convert implicitly between smart pointers and bare pointers
I don't think that's C++'s fault. That's how the STL is defined
>>
>>61441302
You don't need that.
>>
>>61441401
>That's how the STL is defined
That's also the reason maps fucking suck.
We need a new one.
>>
>>61441407
Ha, interesting. Does it infer the type from the `+` function?
treeSum (Leaf x) =  x
treeSum (Branch x y) = treeSum x + treeSum y
>>
>make a basic timing block using RAII
>ctor records a time (rdtsc) and dtor calculates the elapsed time
>give it a function to call with the elapsed time
>think this construct will be super easy for the compiler to optimize out when not in use
>overload the function with an empty function
>look at disasm
>it dutifully constructs and destruct the object even in empty blocks
Great.
I'll have to wrap it in a macro now I guess. Well done C++.
>>
>>61441401
>I don't think that's C++'s fault. That's how the STL is defined
How is that not the languages fault? The committee decides on the standard library and the template library right?
>>
>>61441309
>lifier along the lines of "maybe_
sorry hasklet, sepples will never have moan ads
>>
>>61441526
C++ is old. All of the old mistakes, like iostream classes being fucky with RAII and vector<bool>, are things that cannot be fixed.
>>
>>61441574
>C++ is old.
This is not a valid excuse.
Break old code if you've made your language terrible. Or cease support for the language and work on something new.

Saying it's bad because it's old isn't a defense at all. It's just another reason to leave the language.
>>
File: variable_tab_amount.png (16KB, 904x102px) Image search: [Google]
variable_tab_amount.png
16KB, 904x102px
this has got to be the most complex thing I have ever written
>>
>>61441597
There's nothing I want more than a new iteration of C++ with nothing fundamentally different but the warts removed.
>>
>>61441611
I agree with you on that. But I don't agree with saying that it's not C++'s fault it's where it's at now.
>>
>>61438235
>There's no point in compiling C or sepples into wasm when you could actually used better designed language for that
such as what? Golang? Rust?
>>
>>61438386
Tbh, don't think this would be all that hard.
Once you got some parsing facilities and string processing functions it's probably a cakewalk.
>>
>>61438926
What's best way to pickle my python data selector. I have dynamic external functions and dynamic variables that can be made for them. You can swap them in and out but I still want the previous selections saved so you don't have to refill your 15-dimensional rule if you only have to change one part of it.
>>
Kind of dumb but sqt are dumber.
What's the best practice for creating large programs in C++? How are different files used and how are they imported?
>>
>>61441206
>can't convert implicitly between smart pointers and bare pointers
How does this make sense?
Smart pointers all have some semantic ownership of the pointer. Why would you want to have it break that implicitly?
>>
>>61441691
It's very common that you want to pass a pointer or reference to a function that does not care about the lifetime of the object it's using.
>>
>>61441688
Do you understand header files?
>>
Is there a string format for which length lookup is better than O(n) but worse than O(1)? Just curious.
>>
>>61441733
Kind of I think.
They're either declarations or implementations of other parts of the program? I can't remember which.
Or is that not right?
>>
>>61441622
>better designed language than C
>go, rust
Dumb faggot poster.
>>
>>61441735
A trie, maybe?
>>
>>61441752
Declarations. Make sure you understand what headers are and why they are used before you start thinking about how exactly to break up your programs.
>>
>>61441735
If a string has a maximum length specified couldnt you do a binary search for the last char?
>>
>>61441309
They should introduce a new syntax to solve this problem.
Possibly something like this:
template <const>

Example:
class IntWrapper {
private:
int value;
public:
IntWrapper(int);
template <const>
decltype(val) &wrapped() {
return val;
}
};

(The decltype is necessary because the template member function is parameterized over the possible types of the receiver)
>>
>>61441786
Doesn't a binary search imply you know the value at the index of the max
>>
>>61441781
Okay thanks.
Would each class be given its own .cpp file or header file as well? Coming from Java and still getting used to the nuances.
>>
>>61441811
>the template member function is parameterized over the possible types of the receiver)
Why restrict this concept to const? Why not something more like:
template <this>
>>
>>61441823
>Doesn't a binary search imply you know the value at the index of the max
could you go to the lower half if the current value is null and to the upper half if the current value is not null
at least that works in my head
>>
>>61441476
Yes, you can put a constraint on treeSum function.
>>
>>61441206
Honestly those are such minor things, there are way-way dumber things in sepples.
>>
>>61441845
Usually each class has its declaration in an includable header file and its implementation inside a .cpp.
But it's good to get out of the pattern of thinking everything must be inside a class. You can just as easily have a simple namespace with a few plain functions thrown in.
>>
swift, go, ocaml or D?
>>
>>61441868
You start from the middle where the middle is half the max?
>>
>>61441897
I've heard go is pretty cool.
It's meant to be taking over Java from what people have said. eBay have just started using it for their backend shit.
>>
>>61441940
>pretty cool
>no macros
Sounds pretty shitty to me
>>
>>61441910
thats why I said if the index has a maximum length specified
like you have a char[1024] buffer then you start at 512
>>
>>61441940
how could go take over java? isn't go for server side applications?

java does a lot more than that
>>
>>61441940
A little bird told me that eBay uses Scala for their back ends.
>>
File: 1471740354415.jpg (6KB, 480x261px) Image search: [Google]
1471740354415.jpg
6KB, 480x261px
what do i learn once i am decent at java to complement it

just for learning/trying to get smart
>>
>>61441962
I think I read 'length lookup' as finding the last index of the string, which is why I was confused. If it's finding an specific element it's O(log n) with a binary search for sure.
>>
>>61437152
Nim?!
HAHAHAHAHAHAHAHAHAHAHHA fuck off
>>
>>61442073
>dumb shitposter?!
HAHAHAHAHAHAHAHAHAHAHHA fuck off
>>
>>61442053
fall deeper into jvm hole
scala, closure, kotlin etc
>>
>>61441766
looks like bait, but i'll bite because i'm genuinely curious. what language, in your opinion, is better suited for wasm than C/C++?
>>
>>61442055
Im talking about that as well
Let's say you have a char buffer of the size 1024
you look if buffer[512] is null, lets say it is
next you look if buffer[256] is null, lets say it isnt
then you look if buffer[376(or so)] is null etc.
you will get closer and closer to the last element
>>
Sometimes I shout up algorithm/library name when working alone like anime characters
>>
Not REALLY programmin related, but, what's the best/funnest way to learn the linux command line/bash? I have tried learning the commands before, but I got bored really easily. It is not as fun as programming. Thanks in advance.
>>
>>61442177
>everythin should be fun
anon
>>
>>61442102
>kotlin
i want to build some android apps so this was already on the docket
>scala, clojure
not sure what these are like but ill look

i kinda mean something totally different though, to get me thinking in a different way. or some course/book to learn about algorithms and recursive functions and efficiency...
>>
>>61442177
code your own shell
much more fun
>>
Give me some stupid worthless shit to do in C, Python and Lua. Like:

>>61441368
>>61441477
>>61441569
>>61435333
>>61435344
>>61435351
>>
>>61442193
I get your point, but you can't deny that learning linux command lines is boring as fuck.

>>61442206
Nowhere near that good yet, but I will definitely try in a month or two.
>>
>>61442227
Write a program that replicates human instinct by guessing what you should be doing based on past recorded events. which the application provides you with easy facility to record.
>>
>>61442238
having your own shell run in the terminal is pretty easy
you would just have to redo all the commands(or hook them up to the standard ones which would make you learn them)
>>
How long would it take to learn the gist of C?
>>
>>61442254
How would you do it yourself?
>>
>>61442284
30 or so
>>
>>61442284
C is a small language. It won't take too long.
>>
>>61442303
A simple neural network that compares the conditions where you did a thing to the current situation.
Trivial stuff.
>>
>>61442323
You sound smart. Could you explain terms "thing" and "conditions" to a brainlet?

How would you track the things the user is doing? Keep focus on which program is active? What would the conditions be? Time of the day, what else?
>>
>>61442406
>thing
Well it could be anything. I'm giving you a pretty general task here. It could be just focused on things you do at your computer.
>conditions
Could also be anything, part of this is selecting what you measure. But for instance if I wanted to predict what I will be doing in X minutes I could look at what applications I have open and how long ago I interacted with them over time and eventually build a model for the relationship between the current situation and what he future will be. A neural network.
>how do you track the user
You could make it even simpler and have the user log things like when he goes to bed, when he browses the web for leisure and when he browses the web for other reasons.

You could just take time of day and the log what's going on. It'd be pretty boring since it's probably gonna end up being pretty much just a lookup into the averaged log.

I'm mainly working on windows so I'd walk the window handle tree and log stats on what's open to see what's going on. I'm not sure how you'd do the same on Linux but I'm sure it's less fiddly.
>>
>>61442279
>the commands(or hook them up to the standard ones which would make you learn them)
That sounds really fun. Thanks anon, I will definitely get to work on that.
>>
>>61439746
>racket
I love you anon
>>
what's the best free online guide to Guile Scheme, or is the documentation as good as it gets

I wanna learn it so I can add module functionality to my C++ programs
>inb4 lua
I like lisp, even if I'm not very good at it
>>
File: 1461299504894.png (541KB, 478x456px) Image search: [Google]
1461299504894.png
541KB, 478x456px
Newfag to coding here

I should learn C# right?

Also is learncs.org a good resource?
>>
>>61442717
start with the greeks
learn assembly
>>
>>61442717
C# is a slightly nicer Java with a lot more reliance on Microsoft and Windows. If you're interested in becoming a code monkey just start with Java.
>>
>>61442717
C# is just a limited java
learn something better
>>
>>61442783
You got that reversed
Java is a limited C#
>>
>>61442817
limited in terms of the language
not in terms of the ecosystem
>>
>>61442817
how so, isn't C# just a lot less portable + a lot less libraries other than .NET?

.NET can't be that good, is it?
>>
>>61442832
>.NET can't be that good, is it?
It kind of is
>>
New thread, now with more trips:

>>61442888
>>61442888
>>61442888
>>
>>61441480
how is c++ supposed to know your intention and just throw away your valid code?
>>
>>61442227
Write a program that teaches you Scheme.
>>
>>61442284
About 200 pages of a textbook to get a complete understanding of the fundamentals.
>>
>>61437065
whats the website that lets me freelance code for money?
>>
brainlet here, I have little to no experience with programming, I want to learn, so far I've been trying with codecademy, and I dont even know what to install to program in python. Do I install python to program in it? Do I install visual media studio? please help, I need a job.
>>
File: kode.png (1MB, 960x1018px) Image search: [Google]
kode.png
1MB, 960x1018px
>>61444449
breathe anon

install python
install a text editor like vs code/sublime/notepad++/etc.
start making your exercises
Thread posts: 318
Thread images: 31


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