[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 31
File: languages.png (81 KB, 537x574) Image search: [Google]
languages.png
81 KB, 537x574
Old thread: >>51825909

What do you prefer: Functional, Procedural, or Object-Oriented?

Which type of Object-Orientation (Simula-67-derived School or Smalltalk School) do you prefer? Which type of Functional (Pure or Impure) do you prefer?

What are you working on, /g/?
>>
will it ever be possible to display moving images without having to project them frame by frame
>>
Simula was clearly superior.
>>
>>51832759
>Functional, Procedural, or Object-Oriented?
Yes. And generic too, ofc.

>Sepples Mustard Race Reportin
>>
>>51832664
I learned procedural first, got into OO and have been in it since, but I want to get into functional and get back into procedural I guess

I don't know about the types of OO :\ I'm a faggot

Should I learn python?
Or haskell?
I know Python has a lot more libraries for actually doing stuff, but I kind of want to get into functional, just for the memes.
>>
>>51832664
Hey guys. Why would I ever not use arrays and vectors for everything. Learning algorithms is for tryhards.
>>
>>51832815
this post is a meme but
Ever heard of a tree?
>>
>>51832757
Probably not anon. After all, the universe itself works 'frame by frame'.
>>
>>51832815

You can use vectors for pretty much everything. Sometimes other data structures come in handy, but 99% of the time, the tried and true vector will do the job.
>>
>>51832845
isn't search O(n) with a vector lol
>>
>>51832778
>>51832664
misslinked
>You anon might like it more
>>
>>51832664
>Functional, Procedural, or Object-Oriented
Java can do all of this

what the hell
>>
>>51832827
>the universe itself works 'frame by frame'.
DUDE MARAJEWANA
>>
>working on?

ATM, trying to understand the best way to categorize parsing the Project Gutenberg English textfile corpora.
>>
File: dpt.jpg (185 KB, 800x547) Image search: [Google]
dpt.jpg
185 KB, 800x547
>/dpt/
>>
Web framework, I think I can make get requests even faster than they already are. At the moment, it can 404 at 350 microseconds, faster than ASP.

>>51832664
>What do you prefer: Functional, Procedural, or Object-Oriented?
It's not about preference, that's a sign of an immature developer, its about the right tool. All have their uses.

If you're not doing anything too hardcore, chances are you're only using procedural, even if your language is object oriented. You're not doing object oriented until you have a database of generic objects.
>>
>>51832898
>wat is planck limits?
>itty little tiny bitty little marajwanas moked sooper lightnin fast anon.

SIR, HOW MANY MARIJUANAS HAVE YOU INJECTED TODAY?
>>
>>51832851
O(n) on an unsorted vector, O(logn) on a sorted one, O(1) if you use index as key.
>>
>>51832918
I hope no one robs his stall at night :(

Even if they do, he can at least follow the footprints until the end of the designated shitting street
>>
>>51832963
Neat. Wouldn't that just make it the same as an array tho
(vectors are implemented as arrays right)
>>
>>51832918
>entrepreneurship in action
at least he's working it
>>
>>51832851
He's just a someone who thinks nlogn sorting algorithm are bad.
>>
>>51832851
He's just a someone who thinks nlogn sorting algorithm are bad.
>>
>>51833002

Heap sort is the nigger of the nlogn sorts.
>>
File: 20151213_153846.jpg (2 MB, 3264x1836) Image search: [Google]
20151213_153846.jpg
2 MB, 3264x1836
Building on my seismograph project, which I still need to reprogram because the way it is collecting data currently is dumb, I am making a logging seismometer which would log acceleration along all three axis, which could make the ground (or house) movement interesting to plot.

Except I forgot to buy the RTC module. Also I plan to connect a 9V battery or some other form of power to it.
>>
>>51832757
Well, yeah. In fact some of the first video displays didn't have framerates. The problem is that the only way to have 'fluid' refreshes is to have a vector display, and it's damn difficult to have a normal looking UI on a vector display.
>>
>>51832908
> over 118,000 English books &tc.
>>
>>51832798
Learn F#. It's functional, actually useful unlike Haskell, has full access to the .NET Framework and is even faster than C# in some benchmarks.
>>
Working on my OS. it's File system today.
>>
Eiffel looks really fucking cool tbf
>>
>>51833090
vendu is that you?
>>
>>51833070
I don't use windows so no .NET for me
>>
I'm having fun fixing OpenSpades bugs. Unfortunately project seems dead.
>>
>>51833101
who the fuck is vendu?
>>
>>51833116
.NET is on Linux, too.
>>
>>51832798
Python was my first language. That said, I love Haskell. If you are looking to learn functional you should definitely learn Haskell.
>>
>>51833124
This is vendu: https://github.com/vendu/OS-Zero
>>
>>51833194
He's a bit further along than I. By a bit I mean about 6 mos/ 1 year of dedicated work.
>>
What the fuck, Dart is a fucking awesome language, if only it were natively compiled and not for web shit. It's like C++ done right.
>>
>>51833278
Hmm. For some reasons I thought Dart did get compiled to native?
>>
>>51833289
It probably did, I have autism
>>
Rust vs Go

go
>>
>>51833326
bad meme vs bad meme
I'd go with Go just because it isn't dead and has a future
but they're both fucking ugly syntactically
>>
>>51833326
Rust, easily the most retarded language of the two. Which I assume is what we're assessing here.
>>
Does GAS have syntax specifying 32/64 bit instructions?
Like Intel's
bits 32
bits 64
>>
File: ^).png (2 KB, 563x22) Image search: [Google]
^).png
2 KB, 563x22
This solution is not ideal because I still want to be able to read your memes at least once in a while. I need to find a good way to do that.
>>
File: 1430529951791.jpg (38 KB, 400x388) Image search: [Google]
1430529951791.jpg
38 KB, 400x388
>big project due next week
>writing up in a fault tolerant, etc way
>realize i don't even need to be fault tolerant and handle errors
>realize i just wasted lots of time

why do i always do this to myself
>>
>>51833326
>>51833374
>>51833388
at least Rust does something interesting with the whole attempt at guaranteed safety, Go really doesn't do anything
>>
>>51833056
sounds cool, how accurate will it be when it's done? also, nice to see somebody else on here studying japanese~
>>51833388
>I don't like the look of something I've never tried, so it must be bad
>>
>>51833449
.code32
.code64
>>
>>51833499
dumb frogposter
>>
>>51833502
true, but a useful language is better than an "interesting" one.
>>
>>51833554
thanks
>>
>>51833449
You can use a suffix like `movl` for 32-bit or `movq` for 64-bit.
>>
File: 20151212_211911.webm (2 MB, 1920x1080) Image search: [Google]
20151212_211911.webm
2 MB, 1920x1080
You did anon don't worry.

I think that's all I can handle for the night though; I'll be shutting this down now. Thanks for your memes anons :$
>>
File: dafdae.jpg (11 KB, 242x209) Image search: [Google]
dafdae.jpg
11 KB, 242x209
I want to make my form so that when a user presses two buttons a messagebox pops up .
I've tried setting boolean values that turn true when the keys are pressed. Then an event where the messagebox should show when both are true, but it is not working at all. What do i do? :(
>>
>>51833607
this was a pretty cool idea though anon
did you use a bunch of libraries to do shit for you or did you make it NIH syndrome style?
>>
>>51833499
>not figuring out requirements beforehand

But at least you have a plan for how it should be done, which is way better than trying to bolt it on later
>>
How the hell do I do day 11's challenge?

This just increments the final 2 letters and I'm not sure how to keep it going for all 8 without creating a nasty nested if loop mess.
void increment1(char *key)
{
unsigned len = strlen(key);
unsigned i;
for (i = len - 1; i > 0; i--)
{
assert(isascii(*(key+i)));

if (*(key+i) != 'z')
{
*(key+i) += 1;
break;
}
else
{
*(key+i) == 'a';
if (*(key+i - 1) != 'z')
{
*(key+i - 1) += 1;
}
break;
}
}
printf("%s\n", key);
}
>>
>>51833672

I had found a library that did the basics of shifting data into the MAX7219 chips but required a bit of debugging to get up to the 8 8x8 matricies involved. That was on the arduino side. In terms of complexity this isn't really hard to do at all but I didn't know that when I started it. I really thought that the internet connectivity would be harder than it was but it worked the first time i had a friend try it out. dank af tbqh famly
>>
File: Untitled.png (29 KB, 485x688) Image search: [Google]
Untitled.png
29 KB, 485x688
I've reinstalled windows 7 and i can't install VS
Anyone there had this problem?
>>
File: 1436641056588.jpg (14 KB, 249x228) Image search: [Google]
1436641056588.jpg
14 KB, 249x228
>>51833822
that's what you get for being a winkek
>>
>>51833822
Install Gentoo
>>
>>51833822
go install a newer version of windows
I hear 10 is great :^)
>>
File: 1440036985836.jpg (7 KB, 295x200) Image search: [Google]
1440036985836.jpg
7 KB, 295x200
>>51833735
>*(key+i)
Can you stop doing this? It's pronounced key[i]
>>
Fixed bug when switching weapon the reload did complete anyways. Now I found there is no way to cancel the current sound being played.
>>
>>51833949
welcome to the wacky world of buffers. i'm sure they're's some api available to you anon. learn it.
>>
>>51833967
Cant. I'm doing some fixes on OpenSpades. It already has implementation for OpenAL and another for something called Ysr. Keeping the code clean is proving hard.
>>
>>51833735
What are you trying to do?

 
#include <stdio.h>

/* Increment the characters in a string, wrapping around for letters. */
char *
incs(char *key) {
for (size_t i = 0; key[i]; ++i) {
if (key[i] == 'z')
key[i] = 'a';
else if (key[i] == 'Z')
key[i] = 'A';
else
++key[i];
}
return key;
}

int
main(void) {
char key[] = "Jews did 9/11 zZa";
printf("%s\n", incs(key));
}
>>
>>51833846
>Install Gentoo
did this

then
emerge =www-client/visual-studio

failed
>>
>>51834065
Wait, are you pulling my leg?
>>
>>51832664
Just released the source code to my chatbot project today.

It's not well designed or algorithmically the state of the art these days, but there are some interesting ideas put forth in it.

https://www.youtube.com/watch?v=VBSTUuRwWS0

Refactoring and restructuring are next on my to-do list, along with exploring more robust and expressive approaches to natural language processing and sentiment analysis within a "small data" processing model.
>>
>>51834060
> for (size_t i = 0; key[i]; ++i) {
What is they key[i] in the middle for?
>>
>submit my final project for programming
>professor emails me and accuses me of cheating
>didn't cheat

What do?
>>
>>51834174
Complain to the department head, of course.
Can you post the letter?
>>
>>51834174
ask him on what grounds, contact the student judicial body, etc etc

>>51834186 too
>>
>>51834174
tell him you cheated.
>>
>>51834186
D n k m e me s
>>
I know C and "know" (basics of) C++.
I really want to learn a modern language. Something easy with a lot of easy-to-use libraries etc.
Any suggestions?
>>
>>51832664
>be me
>reading bullshit on C pointers

char a[20] = "hello, world";
3[a] = 'x';
printf(a); // helxo, world


i am euphoric
>>
>>51834205
glad C still makes people happy
>>
>>51834197
what is your area of interest? best to learn a language applicable to what you like.
>>
>>51834197
Haskell
>>
>>51834144
The reply I just gave you was too autistic, sorry.

key[i] evaluates to false when it's the null byte '\0' (same as 0). So basically, loop until you get to the end of the string.
>>
>>51834174
What was your final project on? Did he say anything specific or just the accusation?
>>
>>51834174
Show him your git logs
>>
>>51834232
I'm not too sure yet unfortunately. I just know that I want nothing to do with "webapps" and related cults. I have always wanted to get into simulation (biological, physical), AI, and programming languages I guess.

>>51834237
It's on the list for consideration
>>
>>51834023
>OpenAL
>from the pgrmmrs guide
// Load test.wav
loadWAVFile("test.wav", &format, &data, &size, &freq, &loop);
if ((error = alGetError()) != AL_NO_ERROR) {
DisplayALError("alutLoadWAVFile test.wav : ", error);
alDeleteBuffers(NUM_BUFFERS, g_Buffers);
return;
}
// Copy test.wav data into AL Buffer 0
alBufferData(g_Buffers[0], format, data, size, freq);
if ((error = alGetError()) != AL_NO_ERROR) {
DisplayALError("alBufferData buffer 0 : ", error);
alDeleteBuffers(NUM_BUFFERS, g_Buffers);
return;
}
// Unload test.wav
unloadWAV(format, data, size, freq);
if ((error = alGetError()) != AL_NO_ERROR) {
DisplayALError("alutUnloadWAV : ", error);
alDeleteBuffers(NUM_BUFFERS, g_Buffers);
return;
}


http://www.openal.org/documentation/OpenAL_Programmers_Guide.pdf
>>
>>51834174
send him back a quick 'n' dirty cock and balls .obj rendering in openGL

make it textured 2 boot :^)
>>
>>51834197
C++14
>>
>>51834197
C is a modern language with lots of libraries.
>>
>>51834269
if you want to experiment with AI python has numpy which has some ML and neural network (right?) stuff in it

I study AI but haven't messed with numpy so I can't vouch for it

simulations probably also align with numpy but once again I can't vouch for it

prog langs are best done in a functional language (obv.) so I would agree with >>51834237 on
haskell since I've only heard good things about it.

I didn't really answer your question. Sorry. if you have more to ask concerning your original question now that you have been prompted I can attempt to answer.
>>
>>51834274
https://github.com/yvt/openspades/blob/50abf954aabafb82e73c74413e0096f1f9610e03/Sources/ScriptBindings/IAudioDevice.cpp

https://github.com/yvt/openspades/blob/50abf954aabafb82e73c74413e0096f1f9610e03/Sources/Audio/YsrDevice.cpp

Feel my pain.
>>
>>51834350
>14 tabs deep
You have nobody to blame but yourself.
>>
>>51834350
Sorry have enough on my own plate atm. Gud luck anon.
:P
>>
what made you guys want to learn programming?
if it was an idea, did you ever fulfill it? what happened next?
>>
>>51834370
Is not my code.
>>
>>51834385
I did not want to learn programming because I knew programming. I wanted to learn computer science because even with my base knowledge there was so much I didn't know. I guess I just like learning and I happened to enjoy computing.

My answer was kind of autistic. sorry.
>>
>>51834385
Curiosity.
Never fulfills, you want to learn more and more.
Got a job killing my love for programming.
>>
>>51834341
I'll check out python. It's pretty must-now tier nowadays anyway.

>>51834335
I'm pretty tired of it. It's just getting boring, I suppose. That, and I can't come up with a project idea, so learning a language is something to do.

>>51834303
nice meme

>>51834385
I have always wanted to do programming, but years ago that was JavaScript, HTML, and CSS. I gave up on that pretty quickly. I saw /desktop/ and installed Linux, and learning to use the shell made me want to be able to program I guess. I volunteered at a science museum and got to see the workshops where they built interactive displays and little robots and whatnot, so that was pretty inspirational too.

>>51834428
Do you mean getting a job killed your love for programming? Sucks.
>>
>>51834428
if you don't mind sharing

what is your job?
what is your specific role on your team?
what is a typical day like?
>>
>>51834385
>what made you guys want to learn programming?
the ideas behind my goals. means to an end, really.
>if it was an idea, did you ever fulfill it?
My idea(s) are too big to fulfill in this life I imagine, so no, not yet anon.
>what happened next?
Still pursuing my original goals as a kid.
>>
>>51834385
Just wanted to learn how computers worked, it came along with that
>>
>>51834409
That's cool anon.
>>
>>51834402
Then install you'reself clang-format and fix it.
>>
>>51832664
Sorry, I don't use deprecated programming paradigms. Probabilistic programming is where it's at.
>>
>>51834501
Android game programming in LibGDX (java).
My work revolves around the game logic and rendering of Rock Hero. Recently also of menus.
On release dates I get to fix 10-15 Jira tickets with game bugs in screens, gameplay, errors in loading of songs and such. Friday was a release date so now I got the task to clean and refactor the game engine (game code is now two years old, I have been working on that game for one year).
Sucks because it's stressful, I work six hours I day but I do a lot of extra hours to complete tasks on time.
>>
>>51832664
Why is Oz as big as python? Shit pic desu senpai.
>>
>>51834608
based, could you post some problems you've solved with probabilistic programing, please?
>>
>>51834608
Sounds like a meme
>>
>>51834510
>Just wanted to learn how computers worked
tangentially related, but you might find this interesting and/or inspirational

soul of a new machine by tracy kidder

http://www.amazon.com/Soul-New-Machine-Tracy-Kidder/dp/0316491977
>>
>>51834623
>could you post some problems you've solved with probabilistic programing

Sure:
Efficient integer factoring
Efficent discrete logarithm solution
Proof of Riemann's hypothesis
P = NP
>>
>>51834385
I wanted to make video games and then after making a few I realized I enjoyed computers more than games.
>>
>>51834623
I use them to perform policy learning, using a separately trained NN as the generator, for realtime vision-based motion learning. For instance, train a robot to fetch a virtual cheese while avoiding virtual traps in a virtual maze, where what each component looks like can be changed halfway through, and the optimal policy is relearned as needed.

Other interesting uses include
https://mrkulk.github.io/www_cvpr15/
and their earlier work.
>>
>>51834618
thanks for sharing
>>
if let Some(x) = some_function() {
...
} else {
...
}

match some_function() {
Some(x) => ...,
None => ...
}


Which looks better?
>>
>>51834795
The second one.
>>
>>51834795
I like the language of #1 but #2 looks better.
>>
>>51834795
The latter. There's a reason every sane languages either has match or switch.
Python is not sane
>>
>>51834795
The second.

What the fuck even is the first one?
>>
>>51832876
java is nowhere near as nice as haskell for functional.
>>
>>51834853
It is an insult to even pretend that java can remotely do functional. Same with procedural, to a much lesser extent really.
>>
>>51834826
http://doc.rust-lang.org/book/if-let.html

I guess it's useful if you only have a single case.
>>
>>51834826
it's swift
>>
I need to figure out if a number is even or odd. I think itd be best if I used an array or vector buy Im not sure how to incorporate it.
bool even(int x)
{
for (int i = 0; i<=x; i++)
if (x==i)
return(true);
return(false);
}
>>
What's the difference between functional and procedural? I've seen a lot of haskell and C for example but all I can tell that is different is syntax.
>>
>>51834886
mod operator?
>>
>>51834886
hint: %
>>
>>51834886
you're making this up.
>>
>>51834886
Are you serious?
It's literally just
x & 1
to test if a number is odd.
>>
>>51834886
bool even(int x) {
return x % 2 == 0;
}
>>
>>51834886
surely they're's a CS grad guy on this somewhere?
>>
>>51834868
>It is an insult to even pretend that java can remotely do functional

I wrote a type-safe direct style monadic parser combinator in Java. It wasn't as pretty as in a language like Haskell, but it worked.
>>
>>51834888
function(func) is valid in functional languages. Its not in procedural. Youd need a point to the function to pull it off.
>>
>>51834926
-5/10
>>
>>51834385
So I can tell the fucking computer what I want it to do. Computers are fucking stupid!
>>
>>51834886
>I think itd be best if I used an array or vector
almost had me :^)
>>
>>51834934
... is that really it?
Syntactically it's the same in that regard, then

void func(void) {}

void function(void (*f)(void)) { f(); }

int main(int argc, char **argv) { function(f); return 0; }


The only difference is the function header
:\

Can you do something like


function((x, y){return x * y})

or something?
>>
File: .jpg (17 KB, 342x311) Image search: [Google]
.jpg
17 KB, 342x311
>>51834886
THIS CAN'T BE HAPPENING
>>
>>51834920
>>51834914
>>51834904
>>51834901
mod operator tells me if its in the integer "class" of 2 (set theory way of thinking about it). It wont help me here.
>>
>>51834961
>Computers are fucking stupid!
this. in a nutshell, this.
>>
>>51834886
this would actually work if you s/++/+=2
>>
>>51834979
https://en.wikipedia.org/wiki/First-class_function
>>
>>51834926
>I wrote a type-safe direct style monadic parser combinator in Java. It wasn't as pretty as in a language like Haskell, but it worked.
so you wrote an add-on for your own edification? that's not really the same.
>>
>>51834986
It tells you if it's in the class of 1, not 2
>>
>>51834888
It has to do with how IO works (and the flow of time in general).
IO in a procedural language happens by side effect.
IO in a functional language happens by passing around a world or handle and returning an updated one.
>>
>>51834986
But mathfags r smert and no need 2 lrn progmin???????
>>
>>51834795
>>51834807
>>51834823
>>51834824
>>51834826
>pretending you care what the language looks like
>patrician
>>
>>51835005
I mean 0, but it's one or the other
>>
>>51834997
Thanks
>>
>>51834979
functional languages are all about passing functions to functions. C++ has implemented this but its not as good.
>>
File: welp.jpg (58 KB, 592x282) Image search: [Google]
welp.jpg
58 KB, 592x282
>>51834886
>>
>>51834993
ah I wrote it in a hurry. Knew I messed up somewhere. Yeah i should increment 2. I guess thats why everyones complaining.
>>
>>51835039
C++ can technically do legitimate functional programming as long as you use a compiler which supports TCO (such as gcc) nowadays.
>>
>>51832815

Hashmaps are the fucking bomb. Sometimes a stack is nice too. Queues are rarely useful.
>>
>>51834986
but if it's in the class of 2 it's even, if i'm understanding your meaning correctly, which actually, I don't. Are you saying that because 6 = 0 (mod 2) that it's in the class of two because a set with cardinality 6 can be broken into a two sets of cardinality 3?
>>
>>51835059
>Queues are rarely useful.
My sides exploded.
>>
>>51835039
Actually, I think Sepples17 coroutines will be world-class at it.
>>
File: 1449647525239.jpg (35 KB, 640x638) Image search: [Google]
1449647525239.jpg
35 KB, 640x638
Pythonry 2.7x-
Can anyone intuit what the hell is going on here?
I've uglied everything up to shit trying to debug this and I still am getting no where.
a,b,c,d,e,f = randint(0,len(self.firstfirst)), randint(0,len(self.firstmiddle)), randint(0,len(self.firstlast)),randint(0,len(self.firstfirst)), randint(0,len(self.firstmiddle)), randint(0,len(self.firstlast))
print a,b,c,d,e,f
name = "{0}{1}{2} {3}{4}{5}".format(self.firstfirst[a], self.firstmiddle[b], self.firstlast[c],self.firstfirst[d],self.firstmiddle[e], self.firstlast[f])


This code will print:
12 0 15 52 0 13
IndexError: list index out of range


The index error is because self.firstfirst is a list with 48 elements. Why in the world would randint(0, len(self.firstfirst)) return 52 when the length of the list is 48?
>>
>>51835059
>Queues are rarely useful.
Yeah, as long as you don't use parallel processing, multi-user OSes, multithreading, or synchronus processes queues are pretty useless :^)
>>
>>51835144
not to mention, well, queues.
>>
>>51835129
>2.7
>>
>today's AoC challenge
Literally just permutations and regex

Python is making this shit too easy. Not that it's a bad thing, nobody's going to want reinvent a permutations algo every time
>>
>>51835129
I think randint is inclusive fyi
>>
>>51835201
>>> from random import randint
>>> for i in range(10): print(randint(0, 3))
...
2
3
2
1
0
0
0
0
3
1
>>>
>>
Java = aldo
C# = Mcgregor
>>
>>51835201
Even being inclusive it should generate numbers between 0 and 52, which would fail for 52 and I can fix that easily. I cannot figure out why it generates a 58 though. That's beyond the bounds.
>>
>>51835229
You're forgetting that list[len(list)] is out of bounds, but I dunno your other problems.
>>
>>51835129
print len(self.firstfirst)
>>
>>51835281
Prints 52
>>
>>51835294
then your list has 52 items
52 makes perfect sense then
>>> len(range(52))
52
>>> l = range(52)
>>> l[52]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> l[51]
51
>>> l[1]
1
>>> l[0]
0
>>> print l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 2
2, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 4
2, 43, 44, 45, 46, 47, 48, 49, 50, 51]
>>>

the first element of a list/sequence/whatever in python is 0, not 1
so the 52nd item is actually l[51]
>>
>>51835352
You are misinterpreting my question. My question isn't why it generates random numbers between 0 and 52, it's why it generates random numbers up to or possibly exceeding 58.
>>
>>51835376
you said 48
>>51835129
>>
>>51835385
You're right, my confusing post in the beginning. firstlast has 48 elements, firstfirst has 52 elements. However I've gotten index errors due to randint(0, self.firstfirst) generating numbers up to 58. That's what I'm being puzzled by. I am having the issue with all three generating random numbers longer than the length.
>>
>>51835066
>but if it's in the class of 2 it's even
No, this is just wrong.
>>
>>51832664
>Simula-67 derived

Nice wikipedia meme
>>
>>51835447
Can you explain?
>>
>>51835429
that's not possible
len() will never return anything larger than the length of the list
try this and see what it gives you
print len(self.firstfirst)
print len(self.firstmiddle)
print len(self.firstlast)

PS: you don't need the 0,
>>> range(0, 5)
[0, 1, 2, 3, 4]
>>> range(5)
[0, 1, 2, 3, 4]
>>>
>>
>>51835493
That's why I was so puzzled. It made no sense to me. I decided to rework it a bit and I haven't seen it come back so I'm chalking it up to a misplaced parenthesis or some kind of oddity. I'm generating a ton of extra names each run just to try to produce the problem more often if it's still there.
>>
>>51835470
Do you mean equivalence class by class?
"Divisible by x" is not an equivalence class.
>>
>>51834886
bool even (){
if (x/2==x)
return true;
else return false;
}
>>
>>51835548
I don't know what I mean. I was wondering what he meant when he said the mod operator tells you if something is in the class of 2. I've only read a little bit on set theory so I don't really know what I'm talking about.
>>
>>51834120
good work anon, you might be the first person here to write something involving drawings of girls where those girls don't look like chinese pedophile drawings
>>
>>51835549
. . .
>>
does anyone here program iphone apps without a mac osx machine? i heard the VM environments are unstable, i want to start developing apps but dont know if i should drop the cash for a mac or not
>>
Just finished Python course from codeacademy. What should I go into next that will get me a part-time job while in college?
>>
>>51835579
He's a troll and has no idea what he's talking about.
>>
File: r9la61f.png (29 KB, 1659x237) Image search: [Google]
r9la61f.png
29 KB, 1659x237
>>51835519
well, if you did, that's understandable
a,b,c,d,e,f = randint(0,len(self.firstfirst)), randint(0,len(self.firstmiddle)), randint(0,len(self.firstlast)),randint(0,len(self.firstfirst)), randint(0,len(self.firstmiddle)), randint(0,len(self.firstlast))

looks really fucking ugly, I wouldn't be surprised if you misplaced something

syntax highlighting helps, though
>>
>>51834120
Are you the guy interested in the >>>/g/mbg/ threads?
>>
>>51835519
I copied your code, and got an index error. Then I changed it to randint(0,len(self.firstfirst) - 1) and never got an index error (i also did some find and replace on your names):
import random

list1 = range(5)
list2 = range(2)
list3 = range(49)

while True :
a,b,c,d,e,f = random.randint(0,len(list1) - 1), random.randint(0,len(list2) - 1), random.randint(0,len(list3) - 1),random.randint(0,len(list1) - 1), random.randint(0,len(list2) - 1), random.randint(0,len(list3) - 1)
print a,b,c,d,e,f

print list1[a]
print list2[b]
print list3[c]
print list1[d]
print list2[e]
print list3[f]
>>
>>51835647
so >>51835352
was right
>>
>>51835614
Everything looks awful because it's part of my LD48 entry. I'm trying to just plow on and get as much implemented as possible rather than refactoring things as I go. I'm using PyCharm though so it makes more sense with the highlighting.
>>
>>51834120
>kekd
    !    Interjection
(! `i'd just like to interject for a moment...)


>would interject/10
>>
>>51835685
>>> list1 = range(3)
>>> f = len(list1)
>>> f
3
>>> list1[f]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>>

>>51835352
>>51835647
>>
>>51835617
mbg? Haven't been too active here lately.

>>51835593
It was really a question of which source had the best set of image layers for generating and colorizing face parts.

The flash I harvested the layers from were perfect since they were transparent and positioned in a way where there was no need to re-position them (unless I was looking to offset them for different expressions.) If there had been a better source, I would have gone with it.

Hell, if someone were to recommend me a programmable 3D / pseudo-3D avatar I could use, I could interface the program's sentiment data with it and put on an even nicer demo.
>>
>>51835613
Actually, I'm not so sure the guy you're talking about is wrong. Is divisibility by 2 with remainder 0 an equivalence relation over the set of integers? I don't remember how to prove that.
>>
>>51834934
>>51834979
>>51834997
>>51835039
>>51835056
>>51835110
Functional programming was all about effects and getting rid of assignment. They were sometimes called "single assignment" languages. Backus's FP is another variation on this concept.

Almost every language lets you pass a procedure or subroutine as an argument. This is not a new idea from functional programming, but was part of most programming languages from the 50's and 60's. Machine languages, of course, include the ability to pass an address of an instruction and jump to it.

Why did the meaning of "functional programming" change so much from it's original definition? It's because FP concepts haven't had much influence on programming, but they're still trying (after 40 years of failure) to present it as better and everything else as inferior. By saying that features are actually from functional programming, they can increase their perceived influence on programming languages.

FP promoters are taking advantage of people's lack of knowledge. People are confused because some of these languages use the word "function" like C and Lisp. They're called procedures in Scheme, by the way.
>>
>>51835757
>mbg
moe-bot general. an attempt to consolidate group ideas on creating first a good VR bot, then eventually humanoid robots.

also,
>Dynamic Parser. Generates parsing expression grammars, and attempts to use them to parse natural language. Rudimentary proof of concept, but an interesting concept at that.
Very cool. I've been doing some basic study of expression grammers to help with NLP English parsing. Neat idea that.
>>
>>51835757
3D avatar. Have you tried looking at Poser? It's about as simple COTS to use for this as one could get atp I think.
>>
>>51835785
Regardless C++17 stackless resumable coroutines will literally scale to millions of processes w/o popping the stack. And, ofc, they will run smoking fast.
>>
>>51835785
Lisp was "the first FP language" by all accounts because it was based on the lambda calculus. The idea of passing procedures/anonymous procedures came out of Lisp. Eventually functional programming came to mean more things, but the basic idea has always been turning the lambda calculus into a language (and one way that we got closer to that was by controlling affects and removing assignment, because the lambda calculus doesn't have those things). As long as you consider Lisp to be functional, then lambda expressions in programming are (originally) a functional idea. The only people who deny that are retards who are scared of using anything deemed remotely "functional" because they're too obsessed with their stupid buzzwords about OOP or shit like that and Haskell-fags (specifically the autistic ones, not all of them) who have chosen to redefine it so that they're the only ones "smart enough for FP". Not every functional programmer is a stupid bitch like that though, nor is every imperative programmer scared of anything somewhat associated with FP
>>
>>51835782
It follows pretty trivially from the fact that congruence mod n partitions the integers.
>>
>>51835972
Provide a formal proof then. I managed to get to the point where all I needed to do was that it was an equivalence relation (trivial up to that point), but I got stumped. It's been a while since I've done discrete maths.
>>
Best Haskell book? LYAHFAGG?
>>
What are some good recourses for learning c++?

I know python, R, java, perl and c. I want to learn it so I can use rcpp and make some parts of R faster.
>>
>>51836031
Tour of C++ is a quick and dirty book. You sound experienced so it should be fine.
>>
File: Tour-front-and-back.jpg (371 KB, 1153x704) Image search: [Google]
Tour-front-and-back.jpg
371 KB, 1153x704
>>51836031
Tour++
http://www.stroustrup.com/Tour.html
>>
>>51836029
Probably
>>
>>51835710
kek, completely forgot I included that in the guide.

>>51835797
>moe-bot general

Sounds cool, I'll check out the archives and try
to drop in if another thread begins.

> I've been doing some basic study of expression grammers to help with NLP English parsing.

Any good resources? The current implementation I'm using is somewhat inefficient, and relies on a filtered brute force algo to identify the most likely structure.

>>51835812
Poser never really crossed my mind, so I'll make a point to check it out.
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>51834926
>type-safe direct style monadic parser combinator
>>
File: dogot.webm (2 MB, 480x360) Image search: [Google]
dogot.webm
2 MB, 480x360
Ask your beloved programming literate anything.
>>
>>51836094
this was a happy webm
>>
>>51835997
Just prove that the relation is reflexive, symmetric and transitive.
>>
>>51836029
Thinking functionally with Haskell
>>
>>51836094
why don't you kill yourself you ugly retard
>>
>>51835997
This will be painful in ASCII, but okay.

Let Si denote the set of integers equal to i mod n (for some n in Z), and let S = { Si : 0 <= i < n }. S partitions the integers:

* No Si is empty, as Si contains i
* S covers Z, as any element m in Z is in the class S(m nod n)
* No element m in Z is in two Si's: Assume m in Sa and Sb => m mod n = a & m mod n = b => a = b

Since S partitions the integers, there exists a corresponding equivalence relation. Done.


It's not something you'd usually bother to prove. The fact that equality mod n is a congruence (which is stronger than this result) is fairly basic.
>>
>>51835782
>>51835972
>>51836029
Check this guide: github.com/bitemyapp/learnhaskell
>>
>>51836094
How do I stop current playing sound in this nightmare:
https://github.com/yvt/openspades/blob/50abf954aabafb82e73c74413e0096f1f9610e03/Sources/Audio/YsrDevice.cpp

AlDevice already done. But with this Ysr handmade library I have no luck. Tried empty samples (did nothing), empty buffer (game broke).
>>
>>51834385
you can do almost anything and you can go far without having to spend a bazillion dollars. like it takes a ton of resources to make a physical product or whatever but if it's a software product you can just make it yourself if you have a lot of time on your hands
>>
>>51836084
>interject
heh

>I'll check out the archives
sounds good. i'll try to let you know beforehand via the link you provided.

>Poser
Actually I'm a professional character TD, and facial is my specialty. Poser is probably the simplest approach for a hobbyist, and would likely amp you're avatar(s) up a fair bit.
https://www.youtube.com/watch?v=b8KIIp8tYkU

Very interesting stuff you're doing anon, it's right up my alley. I'm working on this atm:
>>51832908
>>
>>51836112
I am aware of the definition of equivalence relation. I just couldn't do it myself and wanted to know the answer to what seemed like an easy question. Since you said the demonstration is trivial, I thought you wouldn't mind providing it. That's all.
>>
>>51836057
>>51836055
Thanks guys :)
>>
>>51836029
Beginner - LYAH (I found the LYAH a vert bad introduction to monads, see below for a better one)
Intermediate: Introduction to Monads -
http://research.microsoft.com/en-us/um/people/simonpj/papers/marktoberdorf/mark.pdf
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
Advanced - Real World Haskell
>>
>>51836118
thanks
>>
>>51836184
nprb anon. just think of it as K&R for C++.
>>
File: DPTChristmas1.png (332 KB, 588x390) Image search: [Google]
DPTChristmas1.png
332 KB, 588x390
http://adventofcode.com

Day 1: https://paste.installgentoo.com/view/raw/770a1225
Day 1 input: https://paste.installgentoo.com/view/raw/ae0e09d8

Day 2: https://paste.installgentoo.com/view/raw/a1d7af1c
Day 2 input: https://paste.installgentoo.com/view/raw/75f7f51f

Day 3: https://paste.installgentoo.com/view/raw/0eb17a9e
Day 3 input: https://paste.installgentoo.com/view/raw/5dbccc12

Day 4: https://paste.installgentoo.com/view/raw/e1e9f76c
Day 4 input: https://paste.installgentoo.com/view/raw/ca32e94d

Day 5: https://paste.installgentoo.com/view/raw/70bcb8ec
Day 5 input: https://paste.installgentoo.com/view/raw/9af42714

Day 6: https://paste.installgentoo.com/view/raw/9f864447
Day 6 input: https://paste.installgentoo.com/view/raw/1b9aadb7

Day 7: https://paste.installgentoo.com/view/raw/1c6e7472
Day 7 input: https://paste.installgentoo.com/view/raw/3294b0fd

Day 8: https://paste.installgentoo.com/view/raw/2c33c700
Day 8 input: https://paste.installgentoo.com/view/raw/4a5e19f3

Day 9: https://paste.installgentoo.com/view/raw/ea1bce9a
Day 9 input: https://paste.installgentoo.com/view/raw/da1f96f5

Day 10: https://paste.installgentoo.com/view/raw/ed4e45e9
Day 10 input: https://paste.installgentoo.com/view/raw/39260721

Day 11: https://paste.installgentoo.com/view/raw/1221fa54
Day 11 input: https://paste.installgentoo.com/view/raw/a022514d

Day 12: https://paste.installgentoo.com/view/raw/4d1d34d3
Day 12 input: https://paste.installgentoo.com/view/raw/a22ea1a7

Day 13: https://paste.installgentoo.com/view/raw/0b0dbfa7
Day 13 input: https://paste.installgentoo.com/view/raw/c7d6ce34

Answers: https://paste.installgentoo.com/view/raw/a1405030
>>
File: despair.jpg (232 KB, 538x785) Image search: [Google]
despair.jpg
232 KB, 538x785
>Passwords must contain at least two different, non-overlapping pairs of letters, like aa, bb, or zz.

What's a good way to determine if letter pairs are unique to one another?
I tried putting them in a char array and qsorting them, that didn't work.
I tried adding their ascii values together, taking the last number and then dividing by the number of pairs detected, hoping that the number would equal the last number if all the pairs are identical, but this doesn't work in all edge cases.
>>
>>51832664
Of those three functional but Prolog is my favorite language
>>
>>51836186
No problem. Glad my maths degree is useful for something.
>>
>>51832823
I got one in my garden
>>
>>51834341
numpy doesn't have much to do with machine learning other than the fact that most real ML code uses it. sure, there's some basic regression and optimization algorithms, but that's not very interesting. you want something like scikit-learn. dunno what the best neural net solution is these days.
>>
>>51833499
You are not alone!
>>
File: 1438300136315.jpg (2 MB, 3664x3688) Image search: [Google]
1438300136315.jpg
2 MB, 3664x3688
>>51833822
They want you to install the spyware edition to get that NSA money

American programmers are worse scammers than Nigerian programmers
>>
>>51836242
Why not just do
(a << 8) | b
? Then you have a 16-bit value which uniquely identifies a pair of ASCII characters.
>>
>>51834986
the fuck
>>
>>51836103
>dog eaten alive
>happy webm
ಠ_ಠ
>>
>>51836185
Thanks, you cool man.
>>
Just a quick question from someone new to the field. So far I've learned C++, C#, and HTML (I know, markup language). I will be learning SQL, Objective C and VB soon. What other languages should I learn to become well rounded and make it out there? I've thought of Java and Python.
>>
File: 1374574136479.png (685 KB, 735x724) Image search: [Google]
1374574136479.png
685 KB, 735x724
>>51836323
>Objective C and VB
>>
>>51836332
We'll sorry, like I said I'm new and one is for iOS apps and the other for an advanced programming class...
>>
>>51836295
too soon
>>
>>51836351
>VB
>advanced programming class
abandon ship
seriously
take ANYTHING you learn in that class, ANYTHING, with a bucket full of salt
>>
>>51836323
>I've thought of Java and Python.
Both good choices to add to you're retinue anon.

Personally, I suspect you haven't 'learned' C++ however. *Begun* to do so maybe?
>>
>>51836323
I will shill Haskell every time
>>
>>51836372
We'll yeah, I've delved further on my own besides what the class thought me. Created several applications but nothing too serious. I've put most of my attention on C# since I found it to be more of my liking. C++ was introductory so yeah ill admit that.
>>51836362
I understand that but believe me, it's not a BS degree so VB is advanced for this. I'm currently working towards an AAS on Computer Tech which I'll use to transfer to a 4 year program. A good one too, very demanding but I need a job meanwhile I study so I went this route to get my foot wet.
>>
File: PPP2frontNback.jpg (113 KB, 1170x677) Image search: [Google]
PPP2frontNback.jpg
113 KB, 1170x677
>>51836417
C++ is an amazing--but complicated--beast.

If it's of any further interest to you as an (aspiring) professional, and If you really want to gain a fair mastery of it, you might consider backing up and working through PPP2.
>
After that going through Tour++.
>>51836057

Successfully work through both of those books, and you'll be more employable than roughly 75% of the 'professionals' already having jobs in C++ development anon.
>>
>>51836453
Thank you, thank you very much, will do.
>>
>>51836362

Things I studied getting my degree:

* Eiffel
* Rational Rose
* Object Oriented PL/SQL
* Prolog
* VB

Decent languages in University degrees doesn't seem to happen in my area.
>>
File: 48956378_p1.png (731 KB, 668x900) Image search: [Google]
48956378_p1.png
731 KB, 668x900
anyone itt knows IDEAL c++ code of a real-world application that i could read to get a better understanding how to write a nice code?
>>
>>51836485
You're welcome, and good for you. Be sure to plan for enough time to do all the PPP2 work anon. You'll learn to program in Sepples by actually programming in it, not by just reading. It's a thick (but freshman) textbook.

> t. 10+yr C++ dev
>>
File: 43229317_p6.png (390 KB, 900x885) Image search: [Google]
43229317_p6.png
390 KB, 900x885
>>51836535
you for example. how do you combine performance and nice structure?
>>
>>51834886
bool even(int x)
{
if(x == 0) { return(true); }
else
if(x == 2) { return(true); }
else
if(x == 4) { return(true); }
else
if(x == 6) { return(true); }
else
if(x == 8) { return(true); }
else
if(x == 10) { return(true); }
else
if(x == 12) { return(true); }
else
if(x == 14) { return(true); }
else
if(x == 16) { return(true); }
//...and so on
else { return false; }
}

I could make up til 100, but I think you got the idea on how to do it
>>
haskell is beautiful
Can I actually make things with it, though, or just pump out numbers and whatnot?
>>
>finally finish an AoC challenge
>go to r/adventofcode
>"here's my python one-liner for part 2!"
>mine is C and takes up more than 250 lines

at least my code runs faster...
>>
class MyClass 
{
public:
int wat;

MyClass();
};

or
class MyClass 
{
public:
int wat;

MyClass();
};
>>
>>51836521
I consider this quite good C++ code.
https://thrust.github.io/

>>51836604
Primarily by following two pieces of advice:

>KISS
>Don't reinvent the wheel

The first principle is similar to the DRY principle, and will make you're life much easier as a professional. To (mis)quote a very smart man (Ken Thompson) "Debugging is twice as hard as writing code. If you spend all your cycles writing software, you'll need somebody twice as smart as you to maintain it. Keep it simple."

The second principle primarily involves using the well-wrung-out STL libraries first and foremost whenever feasible. Literally millions of man-hours have been poured into making them stable and efficient, and even if I could do something slightly better, it's not how I would spend my time as a developer unnecessarily.
Thread replies: 255
Thread images: 31

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.