/dpt/ - Daily Programming Thread

old thread: >be me
>make fresh github for a portfolio
>git clone some small projects from some open sores cucks
>change license and all copyright text to my name
>reupload as my own repo
>make beautiful github homepage featuring "my" projects
>watch the recruiter emails pour in
>receive job offer after just 2 interviews
>some open sores cuck noticed I stole his code
>threatens to get the FSF involved (LMAO)
>send github a DMCA takedown notice on their repo, claiming they relicensed my code
>they actually believe me
>never hear from him again

Thanks for the FREE SOFTWARE, freecucks!

Keep putting everything online for people to steal, the GPL won't do shit about some guy stealing your project unless you have hundreds of thousands of users.

Other urls found in this thread:

projecteuler.net/problem=56
infoq.com/presentations/Taming-Effect-Simon-Peyton-Jones
youtube.com/watch?v=M028vafB0l8
schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/coroutines-for-streaming/part-2-coroutines
stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers
cplusplus.com/reference/vector/vector/
youtube.com/watch?v=TQpfpVD6vC8
github.com/vaccineapp/vaccine
valloric.github.io/YouCompleteMe/
valloric.github.io/YouCompleteMe/#c-family-semantic-completion
youtube.com/watch?v=D7Sd8A6_fYU
en.wikipedia.org/wiki/Dot_product#Algebraic_definition
onr.navy.mil/
kangax.github.io/compat-table/es6/
docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1#slide=id.g70b0035b2_1_168
norvig.com/python-lisp.html
inventwithpython.com/chapters/
greenteapress.com/thinkpython/html/index.html
openbookproject.net/thinkcs/python/english3e/index.html
interactivepython.org/runestone/static/thinkcspy/index.html
cs.hmc.edu/csforall/
composingprograms.com/
programarcadegames.com/index.php?lang=en
youtu.be/D7Sd8A6_fYU
youtube.com/watch?v=_wzc7a3McOs
cs.rice.edu/~taha/publications/journal/gttse07.pdf
people.freebsd.org/~lstewart/articles/cpumemory.pdf
inf.puc-rio.br/~roberto/docs/MCC15-04.pdf
agner.org/optimize/instructionset.pdf
wiki.luajit.org/New-Garbage-Collector
twitter.com/NSFWRedditImage

First for Python.

You forgot to fork() the last thread

>Thanks for the FREE SOFTWARE, freecucks!

Communism is never okay.

High, been going through some Project Euler questions with Python 3.

I was wondering if this was a thing with the language recently in that the sum() function is slower than a regular loop. I've noticed it on a few previous problems.

"""
Problem 56 - Powerful digit sum
projecteuler.net/problem=56
"""
import time

def mainComp():
return max({ comp(a**b) for a in range(1, 100) for b in range(1, 100)})

def mainLoop():
return max({ loop(a**b) for a in range(1, 100) for b in range(1, 100)})

def comp(n):
return sum((int(i) for i in str(n)))

def loop(n):
total = 0
for i in str(n):
total += int(i)
return total

def timeD(func):

def wrapper(*arg):
t = time.time()
res = func(*arg)
print(func.__name__, time.time()-t)
return res

return wrapper

if __name__ == '__main__':
c = timeD(mainComp)
print(c())
l = timeD(mainLoop)
print(l())]

This is what I get weirdly. I have some more examples if need be.
mainComp 0.34107041358947754
972
mainLoop 0.2940559387207031
972

First for Java

>imperative programming
for what purpose?

java > the rest

you literally CANNOT disprove this statement

i like to feel in control

if that's control, i'd hate to see out of control

i agree, so you'd better give me respect. half of me is the nicest trap you'll ever meet. and the other half? well...

Stop posting this functionalturd.

>the only alternative to imperative programming is functional programming

Yes, that's correct.

How can I stop vim ignoring my indent settings when editing python files?

by doing 2 spaces instead of tabs

don't use vim

Getting stuff done rather than mentally masturbating all day.

use emacs

*tips*

infoq.com/presentations/Taming-Effect-Simon-Peyton-Jones

I know there's a way to make vim use different configs for files with different extensions. I haven't looked into this deeply enough to tell you how to do it, but I do know it's possible. Google around user, I'm sure you'll figure it out :).

Haskellfags can't handle the truth

>vim
>python
A crude, simplistic editor for a crude, simplistic "language." Good riddance.

Put stuff in ~/.vim/ftplugin/python.vim.

>vim
>simplistic
Vim has many problems, but simplicity isn't one of them.

i don't think simplicity can be construed as a problem. you could argue it sometimes causes other problems, but it's never in itself a problem, only a benefit

I know. I was both denying his statement that vim is simplistic and pointing out that one of vim's problems is complexity.

pls explain

Could be that your caches are warmed up. Reverse the order of operations in which you do comp and loop and see if you still get the same result.

> caches
> having any effect on python performance
kek
its not called forced flushing of cache for nothing

simplistic doesn't mean simple

it means downplaying complicated issues as if they were simple, which is exactly what python does

i dont know enough about vim to say one way or the other

I'm the user who earlier asked if rendering 50 sprites individually would hurt performance.

After trying it, I can render 1,000,000 without any drop in fps, and 10,000,000 at 5fps

Is it possible to over-engineer solutions in CS classes?

For example, making a program very safe by adding handlers for all possible inputs, as long as it isn't at the expense of performance or anything alright even if it inflates the code size?


Also, unrelated, but I've made quite a bit of progress on my density grapher.

Wow, it's magic!

Make a webm of it for scientific purposes.

I'm so glad I'm finally getting to realize my dream of writing Windows 98 screensavers.

that doesn't look very random for some reason

Write something with boids

Yup, mostly because they expect people to do the bare minimum. I don't think over-engineering is bad. It's a good exercise for the programmer.

The boid algorithms look fairly simple, but I already shut down the VM.

Maybe I'll get around to it another time when I'm procrastinating from my coursework.

youtube.com/watch?v=M028vafB0l8

Neat.

will I likely be marked down for it?

My plan was to make some a standardized package that I could import with all the basic handlers for edge cases that were likely to appear so I don't have to fuck with it later

So how do you get work as a programmer really?

Pray 3 times a day

AS long as it's readable, I don't think you should. Do you have a rubric?

emphasis unintended

Yeah, but all it mentions is the class's definition of cheating and student expectations etc
I'll probably just ask the professor, but he's legendarily hard to get ahold of

I'm pretty sure you're fine as long as you don't make your functions long enough where it's hard to read. I myself have been trying to apply things from Code Complete in my assignments.

I've not read that but

as an example, my current assignment is to make a piece of software that manages internationals at the school- It handles their Visas, what they're allowed to do, and it prevents them from attempting to break the limits of their Visas in the database.

The thing is, this is an intro java course and I'm not exactly sure what the professor expects. One could look at this assignment (given the level of the class) and produce anything from an incredibly simple borderline-hardcoded-from-input "database" that would demo what we've learned in class in a simple way, or you could take what we've learned to produce a fullblown database manager. He's mentioned the packages we'd need to do so and gone into slight detail of them, but he didn't imply that we had to use them or anything.


TLDR: I hope I'm making sense, but it's not clear if we're expected to produce very simple toy programs or if we're supposed to produce software that actually works well.

What's it called when you're allowed to only write part of the constructor, and unset variables bounce to default?

I.E. if I have a class RegularPolygon that I'm trying to instantiate that has the constructors (int sides, float size, Color color), if I were to just call RegularPolygon(sides) it'd have size = 1 and Color = white, their defaults.

Default parameters.

i'm a cs sophomore working professionally as a programmer and have a few cool personal projects on my resume. i just applied for summer internships at big 5 companies, do i have a chance? i've yet to meet anyone in my program that knows wtf they're doing but i'm not god-tier either. is it actually super hard to get into google or will i be okay Cred Forums?

did you post this in FP WAYWO? hehe

No, but the person I'm working with might have.

I'll do that

A lot of professors in academia have a hardon for giving intentionally vague assignments as a way to prepare you for a code-monkey job, where those are basically exactly what you're going to be given.
Do something that meets any requirements set by the assignment and use your best judgement as to what you should or shouldn't bother adding. Keep in mind it's an intro course and most of the people doing this assignment couldn't program their way out of a paper bag, so if something you're thinking of seems like too much to expect out of that kind of person, you probably aren't meant to do it.

well I mean
he asks for some stuff that we wouldn't be able to do unless we knew about some more """""""advanced""""""""" (massive fucking quotations around that, I'm talking about in terms of the class) functions of Java. For instance, the Date package that we learned about doesn't do time between two dates, but we're expected to produce that for this project.

Having both work experience and personal projects will most likely get your foot in the door, so it really comes down to how well you do in the interviews.

I got hired by Google towards the beginning of last year and personally I was a little surprised by how easy the interviews were. Don't get me wrong, it was still challenging, but I'd been expecting something crazy difficult.

I'd recommend studying interview questions if you want to maximise your chances, and also so you know what to expect.

thanks for the info. i picked up CTCI today and am going to power through it while i wait for a call back. i haven't taken data structures & algorithms yet but i'm at least vaguely familiar with most general CS concepts so i'm hoping i can make it with a little studying.

My professors often dedicate a portion of class time for questions about the assignments. When they don't, or when that time is insufficient, I meet with them during their office hours to clear up any ambiguities in their assignment description. A smart professor is less vague in their assignment description, as being more vague will only lead to more students asking questions like "how should this program behave in ?"

top kek

open sore cucks are so easy to exploite it's great.

Good luck user.

Try this with Linux. Those cucks will fill every hole on your body.

Pulling a Form out of some Elm Add/Update Pages into a separate Module.

>being afraid of neet basement dwellers

top cuck m8

trying to learn coroutines so i wrote a simple implementation of them in c.

its neato, but since it doesnt pass values around its pretty useless so far.

n3985 was the most helpful thing to read, most articles on coroutines seem lacking.
void fn(coro this, void* _other) {
coro_ptr other = _other;
log("%d : entering then yield back to calling\n", this > other);
coro_yield(this);
log("%d : yielding to %d\n", this > other, other > this);
coro_yield_to(this, other);
log("%d : returning\n", this>other);
};
int main() {
coro f1, f2;
coro_init(f1, fn, f2);
coro_init(f2, fn, f1);
log("resuming %d\n", f1>f2); coro_resume(f1);
log("resuming %d\n", f1>f2); coro_resume(f1);
log("resuming %d\n", f2>f1); coro_resume(f2);
log("resuming %d\n", f2>f1); coro_resume(f2);
}
main : resuming 1
fn : 1 : entering then yield back to calling
main : resuming 1
fn : 1 : yielding to 0
fn : 0 : entering then yield back to calling
main : resuming 0
fn : 0 : yielding to 1
fn : 1 : returning
main : resuming 0
fn : 0 : returning
main :

schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/coroutines-for-streaming/part-2-coroutines

>Programming for five hours
>Haven't tested it once
oh man this is gonna be fun

5 hours of code = 5 minutes of fixes

that's not always my experience
Sometimes fixing stuff is fast, sometimes it isn't. If you're really unlucky, you can get a compounding problem early on.

Delusional idiot. Try it if you dare.

you misunderstand
it's not monotonic

Do you not plan out what you're doing before you start typing?

>write 3000 lines of code
>compiles the first time
its pretty great.

You can plan out what you're doing, and still make incorrect assumptions.
Alternatively, you could look back after hours of working and realize that X Y Z thing you did was bad for A B C reasons and decide to delete huge chunks of code to try and make it work better
I don't know about you but personally I make mistakes/bad judgment calls sometimes, or just flat-out make incorrect assumptions (this is especially applicable to things like Unity, where things might operate in bizarre and unexpected ways, requiring workarounds)

Even better feel
>write 3000 lines of code
>it compiles and functions exactly as it's supposed to
best feel

it's called haskell

>Having code not compile
What? What environment are you writing in that won't even warn you if something will prevent your code from compiling?

It's a copypasta, and you won't find any proof of this actually happening.

I'm pretty sure Canonical and Redhat are not just neet basement dwellers. I think if you fucked with them, you'd get a pretty hard corporate dicking.

All javascript code compiles successfully.

Here I will make a bold assertion: All C code will compile successfully. This is a tautology, because if one were to present an example program that is rejected by a standards compliant C compiler, by definition, it is not a C program. I will henceforth say that for all programming languages x, a program written in x will compile.

But this is meaningless, isn't it?

Depends on your definition of "successfully" for the context. Plus depending on your compilation options you could have valid C not compile.

For the purposes of this experiment, are we suggesting that C + extensions is actually invalid C that only works as a courtesy?

We are assuming that the compiler is not being told to intentionally not compile valid C, as with a flag like -Werror. Something like -pedantic-errors should still compile all valid C, however.

I am stating that all valid C is accepted by a standards compliant C compiler, because by definition a standards compliant C compiler must accept every valid C program. I am making no statements about invalid C programs being accepted.

Also, I may have to amend my statement in "for all programming languages x which are not compile-time turing complete, a program written in x will compile"

Forgot for just a moment that not all C++ programs will compile. Some valid programs may cause an infinite loop... or some standards compliant compilers may just flip the table and quit because of too deep of recursion depth.

>I am stating that all valid C is accepted by a standards compliant C compiler

That's not true, either. A C99 program cannot be compiled by a C89 compiler, despite the latter being standards compliant.

Can we at least make an assumption of same version?

A C89 compiler is not standards compliant. It just used to be, and we indicate at one point it stopped being compliant with the changing standard with the version.

I dunno, man. Assumptions are bad news.

>for all programming languages x, a program written in x will compile.
what if the compiler depends on external state?

What about a _Static_assert?

The ANSI C standard is still valid, though. A C89 compiler is compliant with the C89 standard, and is therefore standards compliant, just not C11 compliant.

what about this? stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers

Because it's not a valid C++ program.

how so?

Possibly the best stackoverflow post I've ever seen.

You may have to amend your statement to incorporate implementation-defined behaviour.

Does this look like a valid C++ program to you?

ANSI C is valid ANSI C. It is not necessarily valid C

Show me where in the C standard it specifies that C programs must consist of ASCII characters in a file. Hint: it doesn't. Read C99 1.2

Why are you using Unity?

What does const vector do in cpp? These are chess positions hardcoded into an engine.

Defines a constant vector of strings

the braces seem to be matched

What is a vector in cpp?

The only data structure you'll really ever need.

cplusplus.com/reference/vector/vector/

Doesn't say it has to be ASCII, but C11 5.2.1 does seem to suggest a requirement for a character set of some variety, none of which is present in a .png image encoding handwriting.

I'm a lazy fuck.

>Learning vulkan
Just kill me.

Thats going bit far sometimes you need a map preferably unordered_map, for everything else there is vector

Yeah, thanks for spoonfeeding.
I googled it.

I'm giving up on visual studio this new 2015 is hanging pretty frequently and is becoming annoying to use and this is fresh windows install... Installed CLion and its speedy in comparison.

Actually wait... fuck, forgot this was C++ again.

Oh well, the rules are probably similar in this regard.

Yes, that's the source character set. The standard is written in terms of abstract "source characters", so that it can refer to particular characters without having to specify an encoding for those characters. So, for example, you could write a standards compliant compiler that operates on UTF-16 files.

The only way this can work is if the standard does not specify how this translation is performed. And it doesn't: 5.1.1.2.1.1 says "Physical source file multibyte characters are mapped, in an implementation-
defined manner, to the source character set (introducing new-line characters for
end-of-line indicators) if necessary.)"
So the implementation could very well specify that the translation is performed by interpreting the image as a PNG and doing OCR.

a misnamed data structure

got it nicely working now.
coroutines can share values, so i can make generators now,
they can return something when its returns, and actually checks if it has returned.

implemented some examples like the same fringe problem.

I know that one of the main dev of Visual Studio actually programs it with ... Vim

I use vim for smaller projects but for large projects i have hard time using it effectively. For small under 1ksloc its great

What issues do you run into for larger projects? I use it at work where my team's codebase is in the 100ks of lines of code.

youtube.com/watch?v=TQpfpVD6vC8

nano bros ww2

Game of life?

I have hard time navigating through dozens of files, even with nerdtree. Also having go to definition is must sometimes. I would also like autocomplete for types. I never managed to configure vim for c++ and c as good as some other languages...

Have you ever seen Game of Life before? That doesn't look anything like it.

moved away from autotools to meson
github.com/vaccineapp/vaccine

yaourt -S vaccine-git

>I have hard time navigating through dozens of files, even with nerdtree
I've never needed it myself, but I've heard fzf is meant to be pretty good.

>Also having go to definition is must sometimes.
True. I find this less necessary because we have an internal code search tool which can do this and much more.

>I would also like autocomplete for types. I never managed to configure vim for c++ and c as good as some other languages...
Have you tried YCM? I use C++ at work, and YCM handles this quite well.

Is Visual Basic useful?

ever heard of YouCompleteMe ?

valloric.github.io/YouCompleteMe/

It does use the clang compiler to provide semantic auto completion.

>Not CMake
Literally deprecated.

No. These days it's just C# with a crappier syntax.

Does it require any additional plugin for clang complete?

I have it but it just completes what i have already written and some other things. Nothing like clang semantic

>yaourt
>not trizen

>running perl code

ctrl-p for easy file navigation, youcompleteme for completion, ctags for jumping to definitions

God damn it. That's what I figured, thanks though.

Semantic completion only triggers on ".", "->", and "::" for C++, but you can manually invoke it at any time with Ctrl-Space.

How does that compare to packer?

It can be configured to complete on any arbitary sequence
:help g:ycm_semantic_triggers

valloric.github.io/YouCompleteMe/#c-family-semantic-completion

>make program in python
>takes 7 seconds to execute
>rewrite it almost 1:1 in C

real 0m0.002s
user 0m0.000s
sys 0m0.000s


snekfags will defend this

GUYS what kind of c0mputeR is this. .

I'd like to see the programs in question

how fast does it run under pypy?

Thank you kind anons, I'll go now and configure it

heh ..... so we meet again slarer .

Yo Yo Yo Tyler Wearing Up In The HiZouse As You All Know I Am The One And Only King Of Lua So I Feel It Is Only Fitting That I Start A New Lua ScripTer Awards So WithOut FurTher A Do Lets Check Out This Years NoMinees While My DeeJay ReVolves It

Tyler Wearing
Kila98
FishEater
Seth

And The Award Goes To Wow This Is A Shocker Drum Roll Please Tyler Wearing Oh Wow This Is So UnExpected First Of All I Would Like To Thank MySelf For Being The God Of Lua Coding I Would Thank God If He Existed AnyWay Hera Version Five Point Three Is Now On Sale Hit Me Up On Steam Bitches

Ok EveryBody UnTil Next Year This Is Tyler Wearing Signing Off Hit It DeeJay Im On A Roll And Its Time To Go Solo Rolling In My Hera Five Point Zero With My Rag Top Down So My Hair Can Blow

But can it toast bread?

Do you know how to configure it to trigger on any identifier character? Setting to 're!.' works to trigger on everything, but 're![a-zA-Z_]' doesn't seem to work for just identifier characters.

heh heh heh heh

heh heh heh

tee hee :^)

heh heh heh :^)

>Crying with cum

okay so i get gmod beta and i load sethhack and when it opens the game crashes? wtf? garry wtf ???
i dont understand i launch without it and it works fine but with sethhack loaded it crash ?

wat kind of c0mputer is this ..

>unity
>sublimetext
>hexchat

kek, the usual casual script kiddie.

That is a pizza, likely ruined from the fact that you put it in a dusty drawer. One should not ruin good food.

for someone who knows nothing about programming, what do I need to learn to program vst, plugins, or other audio related stuff?

C

fortran

html

>there are more game engines made with c++ than atoms in the universe
>none of them export C api

So make one that does.

Why would you export C api? When everybody uses c++. Its like exporting rust api

youtube.com/watch?v=D7Sd8A6_fYU

They say you shouldn't use raw new/delete and raw pointers in modern C++ code, but what about when I'm writing a low-level container class for POD? The user *never* has a direct access to the raw underlying data (all access is checked) and I'd love to keep the container standalone, not have it depend on any existing std class.

My program is already suffering from template bloat madness (I have probably 150 different std::vector types and a few dozen std::maps), I'd love to not increase it further but just use a plain raw array for the data.

>casual script kiddie
I have a Bachelor's Degree in Computer Science, and a research grant from the Office of Naval Research coming in relatively soon. Fuck off.

C ABI is the gold standard for Foreign Function Interfaces. Everything talks to it. not everything talks to C++.

there no such thing.

>a research grant from the Office of Naval Research
researching what exactly?

In python does it take more memory to call a function which takes an array as input than to just read from the original array? I have lots of copy-pasted code, and I'm not if it costs me anything to make it a function. For example, the code for working out the horizontal and vertical moves is the same for the queen and rook.

so i was reading about vector math and i got to this part
var distance = normal.dot(point)
what the hell is this? i thought dot product returns scalar in range from -1 to 1, can someone help me understand it?

Research is easy, learn how to do it.
en.wikipedia.org/wiki/Dot_product#Algebraic_definition

For telling the CPU what to do.

Dot product doesn't have to be from -1 to 1. It is equal to either the sum of the product of the coefficient of each basic unit vector or the product of the magnitude of both vectors times the cosine of the angle between their tails.

/dpt/-chan, daisuki~

>No source code provided
Irrelevant

Many thought Vulkan would be easier than OpenGL but it's actually the inverse; You have to implement many facilities offered by OpenGL.

Time to learn TDD.

No preemption ?

The alternative to imperative (statements) is declarative (everything is an expression).

Turing machine.

You could have reduced
def mainComp():
return max({ comp(a**b) for a in range(1, 100) for b in range(1, 100)})

def mainLoop():
return max({ loop(a**b) for a in range(1, 100) for b in range(1, 100)})


to the following function
def main(fun):
return max({ fun(a**b) for a in range(1, 100) for b in range(1, 100)})


For the performances, sum is slower in this case probably due to (int(i) for i in str(n)). Otherwise, it's faster. (pic)

Thank your for using an anime image

Do people count assembly in LOC?

I have down syndrome and have severe problems writing bash scripts because I am a Python babby.

patch_num = "119373-33"
regex = re.search(r'(\d{6}-)(\d{2}))', patch_num)
print regex.group(1)


The following code should probably get me 119373-. What's the bash equivalent?

Sorry, and most importantly, what's the syntax so that var = regex.group(1)

Where to learn x86 assembly using AT&T

anyone know a good resource?

Professional Assembly Language

thanks i think this will do exactly

What, the Office of Naval Research? Yes, it's a thing.
onr.navy.mil/

Well, about two days ago, it was going to be analyzing the possibility of an algorithmic complexity attack on some industrial controllers. That said, the professor I'm working on this with had some issues in actually getting those controllers. So we've thus changed the topic to one that's involving analyzing some malware that's been propagating itself through a particular network protocol. I've got a bit of reading up to do on this thing tomorrow.

If you started caring about memory usage, you should move away from Python.

I think you might be right.
Python is so comfy though. It's so much more intuitive just to indent rather than to have to surround everything in braces. It's also nice not having to deal with low level data management stuff constantly.

Why not just refactor to use functions and actually profile it first?

haskell doesnt have braces and is high level

Try Go. Many Python devs migrate because it's not that much more complex to write, readable and much much more performant.

Learning some WebGL. Why is Javascript so comfy, /dpt/?

Could someone explain the benefit of creating Interfaces in C#? (and presumably other languages that support interfaces).

Is it just to assist in design so you don't forget a class? Or can you start prototyping your code with an interface, even if there is no actual code?

Poorfag question, can anyone share a cracked or licensed 32bit themida?

I haven't got it running yet. At the moment I only have a generator for pseduo legal moves. Can't really test it until later.
I'll try them out. I'll probably stick to python for this project unless it becomes unwieldy because I want to get good with it before moving on.

If you think js is comfy, check out Elm.

Interesting, thanks. Although I don't particularly like languages that compile to JS but will check it out nonetheless.

Why aren't you using ES6? The only browsers that don't support it are IE and Apple IE aka Safari. kangax.github.io/compat-table/es6/

Because Safari is my main browser, mainly because of battery life :(

Also I'm not familiar with ES6 yet. First I'm going to focus on WebGL.

You're living your life incorrectly.

What should I use for a github porfolio? I am looking to start some simple projects to fill it, do you any suggestions on what potential employers would be interested in seeing?

docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1#slide=id.g70b0035b2_1_168

Interfaces abstract away implementation and only show behaviour. The actual implementation of the code might differ, but the code on the caller side always looks the same, which is a good thing.

>Interfaces abstract away implementation and only show behaviour.
>failed oop 101
objects do that. interfaces are only about typing.

>Interfaces abstract away implementation
thats literally what they dont do

He is right you dumb fuck. An interface is a type of contract, the concrete implementation of the behaviour is done by the class. Take a look on how Inversion of Control works for example.

Not OP but I thought interfaces describe a set of behaviors. Like a Stack interface describes operations you can do to a Stack. An implementing class might use an array, or linked list, or whatever, but it has to provide all the operations. Isn't that abstracting implementation from behaviors?

>tfw Python is actually a sane language
Am I the only one who likes Python?

yes, it's a typing contract and nothing more. it's not the interface which abstract the implementation, it's the object and its polymorphic semantics.

>I thought interfaces describe a set of behaviors
No, an interface describe an interface and no more. it's the implementation of the object (class, prototype, ...) which describes the behaviors.

Interface are only there for the type system. take the dynamically typed languages where interfaces are useless, you can still abstract the implementation because it's the objects which does that.

example
sort(o)
{
o.sort();
}


interface are just here to add more typing safety

sort(Sortable o) // ensure o has the sort operation
{
o.sort();
}


but it doesn't enhance the abstraction of the implementation.

Quality bait mate

more like poopthon amirite xD

Racket is so comfy

Racket is my awesome. What do you do with it? I cant find interesting toy project

Keepad simulator

input in racket is painful.

It does have braces, but they're optional.
main = do {
putStr "Enter your name: ";
name

>til
everyday something new

I guess I was thinking more like a class or prototype describes the implementation of a behavior, while an interface only describes what behaviors an item has. Is that the same as what you're saying?

Python is basically a Lisp with better syntax, more libraries and no macros.
norvig.com/python-lisp.html

yes because as we all know python is actually made of s-expressions

The interface (not talking about typing here) of an object is the set of operations the object has. The behavior of these operations is described in the implementation of the said operations.

is this the best book for learning Python? For a sort of newb. Listening to recommendations. Also, has to be Python 3. Thanks!

>>> parse("2 + 2")
['eval_input', ['testlist', ['test', ['and_test', ['not_test', ['comparison',
['expr', ['xor_expr', ['and_expr', ['shift_expr', ['arith_expr', ['term',
['factor', ['power', ['atom', [2, '2']]]]], [14, '+'], ['term', ['factor',
['power', ['atom', [2, '2']]]]]]]]]]]]]]], [4, ''], [0, '']]

I'll be damned

how to make this shorter?

template
bool intersecting(T1& mA, T2& mB)
{
return mA.right() >= mB.left() && mA.left() = mB.top() && mA.top()

That dude's a fool. It's like "learn shit by typing it wrong then fixing it". Nah just learn it right and reinforce good behaviors.

inventwithpython.com/chapters/
greenteapress.com/thinkpython/html/index.html
openbookproject.net/thinkcs/python/english3e/index.html
interactivepython.org/runestone/static/thinkcspy/index.html

cs.hmc.edu/csforall/
composingprograms.com/
programarcadegames.com/index.php?lang=en

Sheesh, no wonder Python is too slow.

the table you linked shows 100% compatibility for safari 10

Oh, you're right. Never noticed that actually changed.

you guys drink coffee right

No you fucking hipster, go back to your python/ruby project

Nope.

tea master race

Black white or green tea?

youtu.be/D7Sd8A6_fYU

they're getting desperate

oolong

>le
go back to Cred Forumseddit you dumb drumpftard

master race indeed!

...

Caffeine + L-Theanine FTW

>compare c performance to c++ with example where he is using c++ as c with classes.
>using c++ does not force you to use all of it's "nice" features so it's valid
>proceeds to lecture that c++ is better than c because it has those "nice" features.

Yes. Also a beer everyday after work, helps me slow down and relax. And if I'm very stressed or anxious that day a cigarette too.

what's your preference?

I used to drink alot of oolang as well but in last couple of months im hooked on linden and common mallow i buy those from some old man here all fresh and pretty cheap.

kill yourself faggot

calm down user, did you lose your free software?

whats some good software for planning and designing apps? trying to get into android dev

java is horrible

Those are flower teas right? I still have some tea left that I bought in China and Taiwan. Tea shops here are overpriced and only serve fine grained tea.

Leaves as well flowers. Linden and mallow are grow here i even had mallow in my garden few years ago.

Good tea is expensive here as well unless you find someone. Or if you want to drink that tea bag garbage

everyone on this site says everything is horrible. why do you think that is? maybe people are pretending to be the authority in what's in and all that?

they don't say equally for all things

java is literally horrible

All people here can agree that Java is horrible. The only Java advocates are trolls.

>java is literally horrible

hurr durr

nigger boi plz

#56776694
0/10 terrible shitpost no (You) for (You)
literally less funny than javafag

Nigger women need love, too.

>242 posts in
1st for dlang :>

sasuga d performance

Ultra noob python question.
I'm trying to find the first number that can be divided by 3 and by 5 (which is 15) using "if".
What am I doing wrong?

>use SQL regularly at work
>think I'm good with it
>apply for job, they give SQL test
>first question easy
>second question to do with partitioning tables to get the difference between the max and second-to-max values in column B for each unique value of a column A
>mfw I realise I don't know shit about SQL

How do I git gud?

As expected from a Python user

Come on man, I'm trying to learn. Do you know what I am missing?

1. look at your while line. think about what will cause that to be false
2. i don't think you should have to check twice, but that's not fatal

That's small enough you could just write out the values of the conditionals for j = 1, 2, 3 and figure out whats wrong.

alias 'gud' to 'log' in your .gitconfig

>tfw you live in the worst timeline where javascript is used instead of Racket

>implying there's a timeline where Scheme and derivatives became popular

Lisp is cancer

Do most of the Cred Forums tards actually have jobs that involve the austist programming languages?

nobody stops you from writing something meaningful in the programming language of your choice. stop being a little crybaby and go to work now!

listen to also. if you're exceptionally lazy you can make the program print it all out. but step through the logic somehow (it is just a flaw of logic, not programming really)

i'll say more once you've found it

you're essentially doing while not divisible by 3 and 5: check if divisible by 3 and 5

>implying javascript isn't a scheme

print 15

I am sure there is a timeline where everyone uses lispmachines and care about freedom

>javascript
>scheme
When will this meme die

Yes, Python is slow but it's good enough for automating shit because with all the stuff that you can outright import you can be done with it in a few minutes.

aoba a qt :3

It's good for automation and when you're I/O bound.

pypy still runs like shit.
A Python JIT will never reach the performance of other JIT'd languages until someone rewrites the entire standard library in Python.

should I watch new game?
I know to expect moe sol but is the humor at least oriented on IT stuffs?

I like it. It's office humor with an IT twist.

Why is that? You'd think the parts written in C would be fast.

holy shit
he's the ultimate troll
youtube.com/watch?v=_wzc7a3McOs

doing c# winforms simple program for handling factures, customers and items with sqlite. i was trying to google how to use entity framework with sqlite, didnt find anythign useful and went with raw sql queries. ill never make same mistake again

JITs can remove runtime-dependant dead code like type checks and stack checks. The Python C runtime contains those unnecessary dead code segments, they are compiled in, the JIT can remove them. Rewriting the runtime in Python would allow the JIT to decide how to compile the procedures using what it knows at runtime.

JITs can theoretically be more performant than AoT compilation because the optimizations available to JITs that aren't available before execution. There was a paper about it, forget the name, if you were interested.

how can i know stuff like this about languages and such?

you seem to know about this

Read papers and blog posts by core developers. I learned a bunch from reading blogs by the V8 devs.

>I learned a bunch from reading blogs by the V8 devs.
post links pls

I read papers on programming for fun. And I read source code.
Recent papers include:
Multi-stage programming, MetaOCaml
cs.rice.edu/~taha/publications/journal/gttse07.pdf
Memory's effect on performance optimization
people.freebsd.org/~lstewart/articles/cpumemory.pdf
Using stack-ful asymmetric coroutines to implement more general flow control devices like continuations
inf.puc-rio.br/~roberto/docs/MCC15-04.pdf

Been pouring through this, reading every revision he makes, sending him emails every so often about improvements. Make might implementing this on an FPGA my master's. Other possibility is profile-guided optimization of memory allocation.
agner.org/optimize/instructionset.pdf

Been going through the LuaJIT source code too. It's pretty dense.

Will be going through implementations of arena-based allocations soon so I can attempt to make a new garbage collector for the LuaJIT.
wiki.luajit.org/New-Garbage-Collector
It probably won't be accepted, Mike's code quality requirements are impossible.

Somewhere along the way I came to "know stuff".

Can't find them anymore. Just search around for V8 inline caches or similar.

BASED

thanks

pypy is quite fast actually

>until someone rewrites the entire standard library in Python.
which is what pypy actually did.

go back to gmod sex poses and rust, faggot

I was just showing what I've been doing. I wouldn't suggest reading any of that (except maybe the one on memory performance) unless you have a background in the material.

Just pick a programming topic you like and start googling for papers and code.

???

I've tried it on most of my project Euler code. It wasn't any faster. Most of my solutions make use of itertools and comprehensions, are those things they haven't gotten to yet?

dumb tripfag
Interpreters work on parse trees => larger parse trees mean more overhead in interpretation

but python is faster than C
see

>dumb tripfag
you wot?

what is a way to manipulate PNGs with java or python?

bullshit

Haskell has performance similar to Java. If you want to learn a new low-level language for your projects that need more power than Python, try Rust. I wouldn't recommend Go, it's trying to be too simplistic by not having abstractions etc. which ends up hurting the simplicity. Haskell is an academic language to learn how functional programming works, it sucks when you try to do actual real-world stuff in it.

>it sucks when you try to do actual real-world stuff in it
[ citation needed ]

If you think that is cool , try taking code with a BSD licence, those cucks cannot even try stopping you

>the JIT can't remove them*
I always miss the most important contractions.

I've written a few projects in Haskell and it's one of my favorite languages to use... Once you wrap your head around it, it's super nice to use for real-world stuff.

counter = 1
while not (counter % 3 == 0 and counter % 5 == 0):
counter += 1
print(counter)

Your logic is sub-par. I recommend you try gaining a lot more programming experience, or you'll fail at your class.

unless the "real-world stuff" involves things you're doing for a real company, because dealing with the Haskell tooling is shit. hopefully some combination of NixOS and Stack can help combat this, but most Haskell users seem to still be using Cabal

there's nothing wrong with cabal

it's terribly broken, and a very poor excuse for a package manager

You know... forking projects on github isn't illegal, right? The whole point of "free software" is that you can do whatever you want with the code. If the company that hired you didn't fact-check you, well, that's their problem.

He's like a gnome

I say cabal install and it installs a package

What's broken?

I've been using Stack, no hangups on our deployments.

Haskell has CPU performance similar to Java, but it's memory usage is much lower (about 1/2-1/4 in most benchmarks I've seen). Of course, it's still not as fast as C/C++/Rust.

Haskell's got loads of room for completely impractical optimisations

Pretty sure the reason they haven't made progress on supercompilation is because it produces huge executables

Cabal isn't a package manager, it's a build system.

I've seen some haskell benchmarks that put it at even w/ C & C++

>it's still not as fast as C/C++/Rust.
C clang: 9.971914301 seconds time elapsed
C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed
Haskell GHC: 0.454930841 seconds time elapsed
Java OpenJDK: 1.189619693 seconds time elapsed

In very specific circumstances with highly optimised programs, or in situations where you're comparing it with enterprise OOP or shitty algorithms

new thread when ? :3

Nice weighted number generator.

Code or link?

yeah, it's just that until the wider portion of the Haskell community accepts Stack as the superior platform, it's off-putting to businesses

Benchmarks without source code don't mean anything.

what kind of editor is that user

looks nice n clean n comfy

Vim.

What is Haskell even used for in industry? Every language has it's niche. I would think DSLs, but I can't think of anything else.

NEW THREAD!!

Sure seems like the first few cases could be generated. When will true metaprogramming become more common? Yeah, higher-level functions, blah. blah, blah.

We use it mostly for backend APIs, but also have a couple CLI utilities for manipulating infrastructure.

Safety, best type system, easy refactoring, etc. make it super nice to program in, and my preferred general language for personal projects.

I prefer coffeescript.
All of the comfy with none of the syntactical bloat

The DNS module for dpkt is a piece of shit. It took me quite a while to discover that it doesn't support DNS over TCP, so I have to strip the 2 byte length from the beginning of the DNS header in order to get it to parse.