[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: 320
Thread images: 41

File: 1451427410462.png (180KB, 392x309px) Image search: [Google]
1451427410462.png
180KB, 392x309px
What are you working on, /g/?

Old thread: >>59409302
>>
Math homework. Done Newton's method. Gonna do Euler's method next.
>>
>>59414582
Andrew, son of dob
>>
File: rubyist.jpg (18KB, 260x325px) Image search: [Google]
rubyist.jpg
18KB, 260x325px
going through 'well grounded rubyist'
it is actually a really good book if you are interested in Ruby.
it is a great language...
>>
>>59414665
> it is a great language...
It is.
But is it alive?
>>
Got ano interview I've been studying for, basic java and c++ and oop principals. Then I'm going to dive into finishing my bag of features + svm image classifier. Then I have to learn Django within a week.
>>
C was a mistake
ML was robbed
>>
>>59414710
mako is easy to use, if you've ever used php you'll be at home with mako. django is like 90% mako anyways
>>
>>59414703
it may not be as alive as it was a few years ago, but it is still very active.

Maybe it will die out and go the way of perl, would be a real shame if it did.
>>
>>59414665
On the topic of books, "Java 8 in action" was surprisingly good. Skip the dumb stuff with "lambdas are the best thing since sliced bread" it's boring as hell if you already know lambdas, start at part 2 with streams
>>
>>59414710
>java and Django
????
>>
>>59414582
Learning x86 asm
>>
>>59414736
here's your (you)
>>
>>59414792
he's right though. We underestimated the future of hardware and chose pleb-tier over elegance and ideological purity, and we've paid for it ever since.
>>
>>59414770
Lots of fun. Don't forget to use XCHG, some people forget about it and end up writing code that's like 2x longer than it needs to be.
>>
File: 1488248151444.jpg (233KB, 503x662px) Image search: [Google]
1488248151444.jpg
233KB, 503x662px
>>59414736
>>
File: linux.jpg (311KB, 640x1136px) Image search: [Google]
linux.jpg
311KB, 640x1136px
>>59414582
want to make something useful but don't have any idea
>>
Your best programming books:
Programming Lua Fourth Edition
>>
>>59414872
Programming in D
>>
File: 517nQhiMqzL.jpg (47KB, 380x500px) Image search: [Google]
517nQhiMqzL.jpg
47KB, 380x500px
>>59414872
>>
Trying to learn java from scratch after a year of not programming. Is there a lazy faggy way to do it fast and clean or do I just take out my old school slides?
>>
>>59414908
Why are you coming back? Is it hobby?
>>
>>59414612
>Math homework.
>Done Newton's method.
>Gonna do Euler's method next.
This is an 18+ site
>>
Post your favorite probabilistic language
>>
>>59415099
Julia.
R is for fags
>>
What is a small but fast language that's not C? Is it Go?
>>
>>59415105
Neither of those are probabilistic
>>
what was that website that had thousands of exercises for you to do
someone linked it to me here years ago... back when I was playing stalker for the first time.
those were the days...
>>
>>59415122
> Go
> fast
>>
>>59415140
rosetta code
>>
>>59415122
Fortran
>>
>>59415099
My very own Problang.
Every program has a probability of success, denoted by x. 1-x is the probability of the universe being destroyed and replaced by another universe.
>>
>>59415143
Faster than many
>>
>>59415150
Yet slower than many others, GC isn't free.
>>
>>59415140
project euler?
>>
>>59415122
Assembly
>>
>>59415159
GC is pretty convenient and it only runs when the memory is tight
>>
>>59415186
I directly write machine codes bro
>>
>>59415140
It probably wasn't http://rosalind.info/problems/locations/ but that's a good, lesser known one, specifically problems about bioinformatics
>>
Slowly falling for the rust meme but I made promises with D
>>
>>59415082
>"I will only tolerate programming a shitpost generator."
>>
>>59415195
Still it results in suboptimal performance. Also https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e#.wpvdid20a is an interesting review of the recent GC effort in Go.
>>
Post dev music
https://www.youtube.com/watch?v=6wL2VvmR5MM
>>
>>59415255
Why promise your time to a programming language? Just do what interests you.
>>
File: I-Am-Major.png (396KB, 460x460px) Image search: [Google]
I-Am-Major.png
396KB, 460x460px
>>59414582
I'm trying to learn x86 and C
>>
File: andrei.jpg (47KB, 720x404px) Image search: [Google]
andrei.jpg
47KB, 720x404px
>>59415255
Can't wait for Andrei to realize D was a mistake and Rust is the only way forward.
>>
>>59415265
https://www.youtube.com/watch?v=UgmpBHAwFLk
>>
>>59415307
I still hate C with a fiery passion though. C is like a monkey's toy. For primitive brains that doesn't know how to utilize advanced tools. Does this make you upset?
>>
>>59414896
IHS?
>>
>>59415122
Lua, small and fast it is.
>>
>>59415200
Not that guy, but assembly is not a meme. A lot of people seem intimidated by the idea of 1:1 equivalence between program instructions and processor computations, but it's a lot easier than you might think. It just requires more instructions for certain things, and it has specific hardware-based rules for certain operations.
>>
>>59415331
C was a good tool for its time and it still has its niche, although a shrinking one. Also it's a perfect teaching tool, a stepping stone to more serious programming languages.
There is not reason to use C for new projects today though, and I don't think anyone does that, except for some Open Source luddites.
>>
>>59415331
Can you exploit buffer overflow and put down Google servers?
>>
File: onlythedead.jpg (50KB, 358x406px) Image search: [Google]
onlythedead.jpg
50KB, 358x406px
>>59415331
>I still hate C with a fiery passion though.
That's because you're a retard.
But don't worry, you can still have an happy life while being clinically retarded
>>
>>59415214
it might have been that
>>
>>59415469
Only retards limit themselves with C
>>
can't we all just agree that what you accomplish is more important than the tools you use to do it?
>>
>>59415499
No.
>>
surprised anyone who posts here would hate C.

like wtf.
next you will be telling me Unix is overrated.
>>
>>59415499
I agree
t. Rustfag
>>
How do you do runtime polymorphism in rust?
>>
>>59415488
Can you exploit the disadvantages of the C language in order to get a control over a server?
>>
>>59415535
Unix is overrated.
Nothing is Unix.

Your picture viewer can render more than one format of pictures. Otherwise you would use JPEGviewer, PNGviewer etc
>>
>>59415547
https://doc.rust-lang.org/book/trait-objects.html
>>
>>59415551
CIA does
>>
>>59415488
You can do anything with C. Including creating compilers for other languages.
>>
>>59415535
Programming is overrated, don't you know?
Hell, even technology is overrated.

Now, I'll go back inside my cave, thanks.

(Just for the keks though:
www.vbcf.ac.at/fileadmin/user_upload/BioComp/training/unix_haters_handbook.pdf
)
>>
>>59415574
Creating a compiler for other languages is not a big deal. C's compiler GCC and LLVM are written in C++
>>
>>59415570
CIA uses backdoors.
>>
how do I make the following code in Dr. Racket?

class person 
{
int year;
}

void main ()
{
person a (1989);
person b(2015);

bigger (a b);
}

bool bigger(person a, person b)
{
return if (a > b);
}


how do I make the line:
bigger(a, b);

in Dr. racket?
>>
>>59415587
And 0days
>>
>>59415499
I agree with this.
>>
>>59415587
CIA uses 0-days.
>>
>>59415574
>You can do anything with C
You can also move 30 pounds of sand with tweezers.
>>
>>59415615
This so much
>>
>>59415613
And backdoors
>>
>>59415447
>There is not reason to use C for new projects today though, and I don't think anyone does that
it's still the lingua franca for client libraries, given that practically every other language can call into its ABI. that makes it the logical choice for any library developer looking for maximum portability, regardless of its limitations. you can call that a niche if you like, but i'd say that makes it pretty relevant. i'm not particularly a fan of C but i can't help but acknowledge the reality of it
>>
>>59415615
Erroneous comparison.
>>
Hi /dpt/
How can I create my own GUI toolkit?
>>
>>59415621
& Knuckles
>>
>>59415699
By programming.
>>
File: 1474081833902.png (16KB, 333x333px) Image search: [Google]
1474081833902.png
16KB, 333x333px
>>59414582
this is now a /lain/ thread.
>>
>>59415699
What do you mean how?
>>
>>59415728
Where should I start?
>>
What are languages like python that uses less lines of code per program?
>>
>>59415723
Let's all love Lain
>>
>>59415743
That depends what kind of GUI lib you wanna make.
>>
>>59415699
Try to program a native GUI in the windowing system of choice. Rinse and repeat for each windowing system your toolkit would target, that should give an idea of what they have in common and what they don't (pretty much everything actually). Your toolkit will have to bring as many implementations of its primitives as the targeted systems.

Good luck.
>>
>>59415761
Nim
>>
>>59415761
literally any language with curly braces
>>
>>59415723
Lain is the only anime series I unironically like.
>>
>>59415774
Python was designed to make smaller programs, what are other programs in that sense? Go? Rust?
>>
>>59414703
It's VERY alive in Japan for some reason. If you want to move to Japan all you have to do is learn Ruby on Rails. It's insane how popular it is over there.
>>
>>59415810
Rust is meant for big projects. The strictness should give you an idea
>>
>>59415812
>for some reason
Well, it's created by a Japanese.
>>
0x55aa
>>
File: 08373089.jpg (188KB, 600x800px) Image search: [Google]
08373089.jpg
188KB, 600x800px
>>59415723
I LOVE LAIN!
>>
>>59415592
pls halp.
>>
>>59415835
Artist fucked up proportions.
>>
Write a program that generates a random 1337 hacker name.
>>
>>59415848
Dennis Kernighan
>>
>>59415856
Brian Ritchie
>>
>>59415848
print "xXx" + random_name() + "xXx"
>>
Which is safer to use language, python rust or go?
>>
>>59415848
letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnpqrstvywzx' }
words = ""
'cvcvvc'.each_byte do |x|
source = letters[x.chr]
words << source[rand(source.length)]
end
>>
>>59415848
printf 'Zero Cool\nCrash Override\nHackerman' | shuf -n1
>>
>>59415878
gythust
>>
File: 1489277520424.gif (1000KB, 500x355px) Image search: [Google]
1489277520424.gif
1000KB, 500x355px
>>59415841
Lain is Lain, beautiful in every way.
okay time to go!
>>
>>59414582
Red pill me on buffer overflows (in C) with an example including code execution
>>
>>59415903
The concept of Lain is beautiful
>>
how do I pass a field from a struct as argument to a function in Dr. racket?
>>
I seriously want lain to become my daughteru.
>>
>>59415899
is this ruby?
>>
>>59415937
yeah
>>
>>59415899
Breddy gud, needs more leetspeak.
>>
>>59415878
>Safer
Rust
>>
>>59415908
Look up the heartbleed bug
>>
Is it safe to use python eggs or ruby gems?
>>
>>59415499
this really depends. imagine, for the sake of argument, writing a library or application that ends up becoming a cornerstone in critical, life-saving medical research, but because you chose a language/libraries/pipeline/etc that prioritized ease of development over efficiency, it runs half as fast as it theoretically could have, had you chosen a different set of technologies. if your software was a bottleneck for this research, it could be argued that your choice made the difference between life and death for some number of people. i realize this is an extreme example, but it shows how this discussion can range from autistic nitpicking to ethically substantial

another much more broadly applicable scenario people often fail to consider; just about any given piece of software's ability to scale may soon become suddenly much more relevant when it needs to be virtually instanced an arbitrary number of times for artificial intelligence applications
>>
>>59415961
meme
>>
>>59415848
from random import randint

WORDS = []
COUNT = 10

LUT = {
'i': '1',
'o': '0',
't': '7',
's': '5',
'a': '4',
}

def process_chunk(chunk):
ret = ''
for (index, char) in enumerate(chunk):
rep = LUT.get(char, None)
if rep:
ret += rep
else:
ret += char

return ret

def get_name():
return ''.join([
process_chunk(WORDS[randint(0, len(WORDS))].title()),
process_chunk(WORDS[randint(0, len(WORDS))].title())
])

with open('/usr/share/dict/cracklib-small') as f:
WORDS = f.read().split('\n')

print('\n'.join(get_name() for _ in range(COUNT)))


ArB4byh00d
Junkerd0mL47ency
Be7r07hImpu7e
Pl4nckReg10n
Gu5hPr0p05
In7r4n5171velyExpl4n4710n
P4r71c1p4n7'SAdv4n74ge
Def0rmEmbell15hed
Ab0undC0mbed
P1ddleAppend4ge'S
>>
>>59415961
python is just as safe and was designed to do what other languages can in one single line. Rather than 10+ just to say "hello world", you do it one.
>>
>>59415984
>but because you chose a language/libraries/pipeline/etc that prioritized ease of development over efficiency, it runs half as fast as it theoretically could have
One could also argue that because you picked a language which was too hard to develop in, such software never came to life.
>>
0xbeef
>>
>>59414824
xchg is too slow.
>>
0x1DEFEC8D
>>
0xDEAD1751DE
>>
0xCAFEBABE
>>
File: 1455950055870.jpg (32KB, 300x470px) Image search: [Google]
1455950055870.jpg
32KB, 300x470px
>>59416017
>>
0xBACABACA
>>
>>59416094
Hi Mozilla Internet Defense Force. How's that formal verification lead by ex webdevs going on?
>>
>>59415848
>>59416020
lmao, made something simliar

shuf -n1 /usr/share/dict/words|sed 's/'\''s$//;s/.*/\l&/;s/a/4/g;s/e/3/g;s/o/0/g;s/i/!/g'


c0ngr3ssw0m3n
b4s!s
w0rth!3st
>>
File: 9a864f8f3e435341bc80ea7d3c423.png (118KB, 500x500px) Image search: [Google]
9a864f8f3e435341bc80ea7d3c423.png
118KB, 500x500px
>be new
>called to maintain some decade old code
>actual arguments on the commentaries

> /* oh jesus christ what the fuck is this
> /* fuck you too man

>Programmer 1: /* I dont know how this works, good luck, next guy!
>Next guy: /* I dont know how it works either lol

>dude signs a piece of code
> /* fuck you. i did that. leaving your comm so everyone knows

Im having the time of my life with this shit.
Do you people comment bullshit while you program or is it just this one program?
>>
>>59416030
none of the relevant languages are "too hard" to develop in
>>
>>59416111
Go back
>>>/b/
>>
>>59416154
actual code in a program:
//don't do this wihtout parental supervision
goto itbrokeagain;
>>
>>59416191
>le ebin gatekeeper
>>
>>59416113
>c0ngr3ssw0m3n
>b4s!s
>w0rth!3st
Truth, still you could say the same for congressmen.
>>
0xF331B4D
>>
>no dpt fetish on FL
why live
>>
File: 1264126944732s.jpg (9KB, 251x189px) Image search: [Google]
1264126944732s.jpg
9KB, 251x189px
#lang racket

(define sum
(lambda (x)
(+ (car x) (sum (cdr x)))))


And I try:
> (sum '(3 5 7))
. . car: contract violation
expected: pair?
given: '()


What am I doing wrong?
>>
yYy_Cr4\/\/|_1|\|6_v|\||>3R_/\/\y_5|<1|\|_yYy
>>
>>59416346
You're using Lisp
>>
What am I supposed to put on a github?
I started programming a couple of weeks ago, and everything I do is still useless.
At what point do I upload things, and what am I expected to upload? Just whatever shitfest I type? Anything big? Stuff that would be useful to other people?
>>
>>59416413
Put your credentials and private key on it. Lots of kool kids are doing it.
>>
Is it possible to do stuff like manage bans or block ips with python rather than mysql or php?
>>
>>59416413
>I started programming a couple of weeks ago
>has a github account
>>
>>59416410
>he's on /dpt/
>he's not using lisp
top pleb
>>
>>59416491
Lisp is trash
use a real language
>>
>>59416346
(cdr x) will also give you another listm which is x minus the first element.
You need to (car (cdr x)) or (cadr x).
>>
>>59416457
I dont. But I look stuff up on github, and I dont know what i would possibly need to upload.
>>
>>59416512
But that's what I'm trying to do.
I want to sum all elements in the list.
>>
>>59414665
>ruby is a good language
okay.
>>
>>59416346
>>59416512
My bad, just realized you want to sum the list recursively.
You need a breakpoint of sorts.

(define sum
(lambda (x)
(if (null? x)
0
(+ (car x) (sum (cdr x))))))


Though + is capable of adding a whole list. You could just map the list instead.
>>
When did you fall for the Lisp meme?))))))))
>>
>>59416570
>>59416589

Also notice that your mistake was that you were trying to sum a null list '() in the end, as you were not specifying where to stop the recursion.
Returning 0 for a null list would stop the recursive process and sum the numbers.
>>
>>59416346
(defvar sum #'+)
>>
>>59416022
(print "hello world")

Safer and faster than Python.
>>
>>59416589
>You could just map the list instead
Well, I try to wrap my head around lambdas, and I had no better idea than write a function analogous to (map + '(1 2 3))
>>
>>59416503
>he doesn't understand Lisp so he calls it trash
>>
>>59416664
You'd need to apply the operator to the list, think of it as cons-ing the operator to the list and then evaluating.
It's not hard but I only recall how to do it in CL, not sure about Scheme
>>
>>59416649
stupid frogposter
>>
File: miyako_code.png (2MB, 1280x720px) Image search: [Google]
miyako_code.png
2MB, 1280x720px
>>59414612
>Newton's method
>no secant, bisection, bracket
>Euler's method is for solving ODEs
>no Simpson's, Runge-Kutta, contour
>implying the lecturer would assign homworks that skip around topics like this for a numerics course
You're not fooling anyone, child.
>>
>>59416660
fn main() {
println!("Hello World!");
}


That's hello world in rust, two lines rather than one. Still longer than python.
>>
>>59417002
HolyC
"Hello, world"
>>
>>59415656
C objectively causes longer development time for many tasks that are made trivial with the right tool.
>>
>>59416622
>?))))))))
Can we stop with the antisemitism for one fucking day?!
>>
>>59417037
yeah but with tweezers you can set every piece of sand exactly to any given point you want
with a shovel, yeah, sure, the sand moves but you have no idea where the grains are or their order
>wtf man i don't need to know that shit
then C is not for you
>>
>>59417021
Isn't HolyC still C and thus has all the problems of C along with it?
>>
File: 1478106018832.jpg (211KB, 640x640px) Image search: [Google]
1478106018832.jpg
211KB, 640x640px
Still trying to understand lambdas.
(define sum
(lambda (x)
(if (null? x)
0
(+ (car x) (sum (cdr x))))))

(define product
(lambda (x)
(if (null? x)
1
(* (car x) (product (cdr x))))))

And I run:
(product (cons (sum '(9 8 7)) '(1 2 3)))


So what? What's so special around lambdas?
>>
Would an imageboard like 4chan ever need any SQL or a database management?
>>
>>59417072
A good high-level language has tweezers and a shovel. You can manage your memory manually if you want, but you don't have to.
>>
>>59417092
name 3 languages that do this
>>
>>59417090
Yes.
How would you store posts?
>>
>>59417090
Yes.
>>
File: pic_related.png (44KB, 935x403px) Image search: [Google]
pic_related.png
44KB, 935x403px
>>59417080
>all the problems of C
>>
>>59417099
C#
C#
C#
>>
>>59417081
> What's so special around lambdas?
The fact that you're still struggling with them.
>>
>>59417081
a lambda is just a function

imagine someone told you that you can use integer literals at the top level
>>
>>59417081
Lambdas are anonymous functions, it's more or less like thinking of functions as data rather than just a static procedure
>>
File: download.jpg (72KB, 500x261px) Image search: [Google]
download.jpg
72KB, 500x261px
So, a piece of software capable of turning red states blue. Any ideas?
>>
>>59417102
>>59417103
I guess I better learn mariadb and manage that with another language like SQL or python.
>>
>>59417081
>What's so special around lambdas?
https://en.wikipedia.org/wiki/Lambda_calculus
>>
>>59417002
>quality in languages is measured by hello world
>languages can't have a 'main' anymore if it would add one line to a hello world
thanks python
>>
>>59417144
It's called a hacked voting machine, and your friends already tried that
>>
>>59417081
They're just a building block, higher order functions is where it's at, as they allow you to compose units of behavior.
>>
>>59417162
No, they tried the opposite.
>>
>>59417162
Nah man, that also includes specialized hardware, I'm looking for a software-only solution. Also, I'm on 4chan, I obv have no friends.
>>
>graded on style
>get marked down for Stroustrup style
school was a mistake
>>
if you oppose an exclusively constructivist approach to mathematics then you are either ignorant or a coward
>>
>>59415099
The quantum gate formalism.
>>
>>59417209
>get marked down for Stroustrup style
Good, that style is absolutely disgusting.
>>
>>59417215
>i enjoy having no power during winters
>>
>>59417215
I'd rather use a theorem proven using Zorn's lemma now, than wait 30 years for it to be proven by constructivists.
>>
>>59417229
>implying the cold wouldn't push you to work on a calculus over the rationals
>>
>>59416154
what does it mean to maintain?
adapt it when new bugs arise as it's being used for new problems?
>>
>>59417224
its objectively the cleanest and most efficient use of white space
>>
>>59414870
program to scrape /wg/ for wallpapers
>>
File: YouKeepUsingThatWord.png (334KB, 512x438px) Image search: [Google]
YouKeepUsingThatWord.png
334KB, 512x438px
>>59417273
>objectively
>>
>>59417215
Example: try proving that every connected graph (including infinite ones) has a spanning tree, in one line. Easy if you're not a constructivist, but annoying if you are.
>>
>>59416154
>Do you people comment bullshit while you program or is it just this one program?
No, I work on a Bigâ„¢ codebase owned by a Largeâ„¢ corporation, I'd rather keep it professional.
>>
>>59417292
>beauty isn't objective
spotted the leftist ideologue
>>
>>59417002
I'd rather use Lisp than garbage Python.
>>
>>59417325
Nobody uses lisp anymore richard.
>>
>>59417332
Lisp is the future.
Lisp will soon become the language to write reality.
>>
>>59417325
>I'd rather use Lisp than Python
that's not saying much
>>
>>59417309
No one said anything about beauty.
>>
>>59417301
So you're a coward. I hope your fiction keeps you warm at night.
>>
>>59417273
Nah. I'd rather cuddle the else like in the K&R style. I don't care too much about beauty, removing that newline means that a few extra lines of code fit in your screen without hampering readability.
>>
File: 1466793220378.png (933KB, 1280x989px) Image search: [Google]
1466793220378.png
933KB, 1280x989px
>>59415841
Could be a lot worse
>>
>>59417343
Yeah, just like everyone will use the hurd kernel richard.
>>
>>59415723
all threads are
>>
>>59417368
With time, you'll be able to use Lisp to customize your own behaviour.
Lisp will soon compile to neural synapses.
>>
File: 12ef.png (8KB, 600x600px) Image search: [Google]
12ef.png
8KB, 600x600px
>>
>>59417215
Nothing wrong with having a constructive universe Set and a classical (proof-irrelevant but with excluded middle) universe Prop.
>>
>>59417332
By nobody, you mean "no retard," since all of those flocked to Python, one of those being its BDFL.

"I also don't think that the current crop of functional languages is ready for mainstream. Admittedly I don't know much about the field besides Haskell, but any language *less* popular than Haskell surely has very little practical value, and I haven't heard of functional languages *more* popular than Haskell. As for Haskell, I think it's a great proving ground for all sorts of ideas about compiler technology, but I think its "purity" will always remain in the way of adoption. Having to come to grips with Monads just isn't worth it for most people." -Guido van Rossum
>>
Do y'all know what I fucking hate about all popular text editors? Their shitty font options. They're behind fucking HTML on it, shit! You know what I can do in a web page, typeface aside? No, I'm not talking about italics or other bullshit like that.

FUCKING LINE SPACING, MOTHERFUCKER!!!

Why don't text editors allow some fucking spacing options? I want my sources to be properly readable without fucking with blank lines all the time. GIVE ME SOME FUCKING line-height, MOTHERFUCKERS!!! (Pls keep the other web shit though, k thx)
>>
>>59417495
Most decent text editors have. You fail.
>>
>>59417350
That is plenty. Lisp has a better object system, module system, type system, better support for functional programming, better performance, ability to fine tune said performance (does Python have anything like OPTIMIZE?), better macro system, and I'm sure there is much more.
>>
>>59417534
most (all?) of those are from specific lisps, not from lisp itself
>>
>>59417577
The name Lisp nowadays refers to Common Lisp.
>>
>>59417509
Well now, there's no need to get personal
>>
File: yes.png (40KB, 431x387px) Image search: [Google]
yes.png
40KB, 431x387px
>>59417495
ok
>>
Describe yourself as a programmer in a single picture
>>
>>59417627
lain.jpg
>>
>>59417596
>The name Lisp nowadays refers to the worse Lisp out there
no it doesn't
>>
File: tmp_7349-14724529533872151468.gif (4MB, 700x488px) Image search: [Google]
tmp_7349-14724529533872151468.gif
4MB, 700x488px
>>59417627
>>
>>59417360
What's this picture from?
>>
File: 1475598524162.gif (487KB, 256x190px) Image search: [Google]
1475598524162.gif
487KB, 256x190px
Still too intelligent for lambdas.
Additional code (thanks to >>59417170)
(define hi-fun
(lambda (x y)
(if (null? (cdr x))
((car x) y)
(cons ((car x) y) (hi-fun (cdr x) y)))))

Trying to run and fail:
> (hi-fun '(product sum) '(1 2 3 4))
. . application: not a procedure;
expected a procedure that can be applied to arguments
given: 'product
arguments...:

So, I except to have the result (24 10), what am I doing wrong?
>>
>>59417596
Sure it does
>>
>>59417392
Whatever richard, let me know when you get your kernel working.
>>
File: 1362318261627.jpg (222KB, 850x909px) Image search: [Google]
1362318261627.jpg
222KB, 850x909px
>>59417627
>>
File: 1482543376023.gif (1MB, 320x240px) Image search: [Google]
1482543376023.gif
1MB, 320x240px
>>59417627
>>
File: python-logo-master-v3-TM1.png (22KB, 430x260px) Image search: [Google]
python-logo-master-v3-TM1.png
22KB, 430x260px
>help people with python on stackexchange
>set tab to single space
>autismos rage when they cant copy paste my code
>>
File: file.png (1MB, 1300x867px) Image search: [Google]
file.png
1MB, 1300x867px
>>59417627
>>
File: 1485687962055.jpg (74KB, 540x960px) Image search: [Google]
1485687962055.jpg
74KB, 540x960px
>>59417627
Dead eyes included.
>>
>>59417676
Did you define those functions?
>>
>>59417699
Lisp will compile to quarks.
Hurd runs on quantum logic.
>>
>>59417711
Python is sure a shit language.
>>
File: internet.jpg (273KB, 972x1076px) Image search: [Google]
internet.jpg
273KB, 972x1076px
>>59417627
>>
>>59417731
>>59417081
>>
Is Richard M. Stallman the embodiment of procrastination?
I mean, what has he contributed to programing except sperg out about Lisp being the best?
>>
>>59417741
Remember when you could daisy chain mice through keyboards?
>>
>>59417669
Serial Experiment Lain
>>
>>59417760
He wrote a shitload of code that is now part of the GNU project, even if today he's more interested in politics.
>>
>>59417760
He created gcc, but then he's done nothing significant in the last 25 years.
>>
>>59417760
He wrote GCC and Emacs.
>>
I'm working on the spreadsheet app for https://whimsy.space the zine based operating system that I also wrote.
>>
>>59417746
It's because you're not passing functions, you're passing symbols. Try dereferencing them and grabbing the functions that are named as such.
>>
>>59415835
Be honest: Everyone on /g/ wishes they were Lain.
>>
File: 1480089201432.png (495KB, 600x572px) Image search: [Google]
1480089201432.png
495KB, 600x572px
>>59417864
How do I do that?
>>
im an idiot who cant think of anything to work on
is there a list of little projects i can do to improve on skills?

im pretty much a beginner and only know python but im also interested in learning c++
>>
>>59417931
http://rgho.st/private/8RhXb4ZqX/89265c8f5ab5ffceea987f306656ba47
>>
File: 1485877794703.jpg (21KB, 393x360px) Image search: [Google]
1485877794703.jpg
21KB, 393x360px
Can someone explain Inversion of control and dependence injection?
I'm looking at a project right now but I don't really know how it was used in it.
All I see is that some beans are linked to the databse with annotations but is that how the IoC is used ?
I really don't think I understand a thing about it.
>>
>>59417931
https://better-dpt-roll.github.io/
>>
>>59417948
just use lambdas
>>
>>59417912
Try https://stackoverflow.com/questions/1045069/how-do-i-apply-a-symbol-as-a-function-in-scheme#1045093
>>
File: 123.jpg (99KB, 884x731px) Image search: [Google]
123.jpg
99KB, 884x731px
best resources (vids, blogs, etc) to understand pointer operations on C? Having a bit of a hard time here.
>>
Why i can't get a grasp of java? In uni I've learned python, C, i understood pointers and worked with them, but i can't understand java, the whole classes and project thing makes plain no sense to me. I even tried with the retarded "Learn Java" app without success. Am i stupid?
>>
>>59417948
Dependency injection is a fancy code monkey word for passing in things instead of having them accessible via a global variable or something.

Inversion of control usually means that you have a higher order function that you pass a lambda into, because it "inverts control" from the called function to the lambda passed by the caller.
>>
>>59418040
no you are not stupid you are just in a group that makes it hard for the same people to advocate for good readable code. If anyone here can talk about programming that means they are a good programmer. people who can't should just try harder.
>>
>>59417948
Not inversion of control:
public class TextEditor
{
private SpellChecker checker;
public TextEditor()
{
this.checker = new SpellChecker();
}
}

Inversion of control:
public class TextEditor
{
private ISpellChecker checker;
public TextEditor(ISpellChecker checker)
{
this.checker = checker;
}
}
>>
>>59417110
Is C# literally the best programming language?
>>
>>59414582
>What are you working on, /g/?

NVMe driver implemented in userspace using sysfs and controlling the disk from a CUDA kernel.

Currently I've managed to set up the admin queues and are able to submit NVM commands from the admin set. I'm about to attempt to submit the create SQ/CQ commands and point the SSD on to RAM first. If that works, I will have to implement the GPUDirect shit in the kernel driver in order to pin GPU memory before attempting to point the IO queues on GPU memory.

https://github.com/enfiskutensykkel/ssd-gpu-dma
>>
>>59418048
>Inversion of control usually means that you have a higher order function that you pass a lambda into, because it "inverts control" from the called function to the lambda passed by the caller.
Or, if you're a fucking retard, you can delay the progress of software development by about 40 - 50 years by completely fucking ignoring functions, lambdas, higher order functions, type functions, etc, and instead invent some limited and retarded version called "inheritance", that is often itself implemented using higher order functions, is FAR more limited, and then need to come up with a million different "design patterns" to try and get around the limitations you created
>>
>>59418089
Not for all things, no.

It's pretty damn good for a lot of things, though.
>>
>>59417948
>Dependency Injection
Instead of creating something on your own for your own purpose, you allow someone else to pass whatever you need as an argument. That's pretty much it. For example, in a constructor, instead of instantiating a member of your class, you receive it already-instantiated via an argument (this one's called "constructor injection").
>IoC
Usually in the form of a generic, all-powerful container that can intelligently figure out how to instantiate everything. It can look at the params of all constructors of your classes, and when you request a new object from the container, it looks at its class' constructor, recursively instantiates all its required args, then provides the finished instance.

Most IoC containers are in the form of some framework, which requires annotating classes of interest, as a form of registration for IoC, but such specifics vary from implementation to implementation.
>>
>>59418048
>Dependency injection is a fancy code monkey word for passing in things instead of having them accessible via a global variable or something.
You mean with the @RequestMapping annotation for example ? Or more like methods you'll call from another class ?

>>59418080
Is it really just that ?
>>
>>59418105
There is literally no diffrence between an anonymous lambda and an anonymous class with exactly one method, apply(). Functional babies refuse to see that.
>>
>>59418007
pointer == memory address of a struct/int/etc.
pointer + 1 == memory address of following struct/int/etc.
*pointer == actual struct/int/etc.

What more do you need?
>>
>>59417992
> (hi-fun ((eval 'product) (eval 'sum)) '(1 2 3))
. . car: contract violation
expected: pair?
given: #<procedure:sum>

I fail again.
I thought Lisp-1 must be easier for such things.
>>
>>59415499
>make a program that adds two numbers together
>programmer one uses Visual Basic
>programmer two uses C
>programmer one's program uses 2 gigs of ram and 35% of CPU for one calculation (obviously an exageration)
>programmer two's program uses 2kb of ram and 0.01% of CPU per calculation

they accomplished the same thing but one did it better with a better tool
>>
>>59418180
>programmer one spends 15 seconds
>programmer two spends 15 hours tracking down a segfault because he forgot to initialize a variable
>>
>>59415379
Ive been going over the assembly section of Hacking: The art of exploitation and I still couldn't write a hello world program.

Do you know of any resources specifically teaching you to program in assembly that I could use?
>>
>>59418141
Dependency injection is literally passing something in instead of getting it by another means (another would be creating it in the constructor or something).

OOP code monkeys don't like passing parameters so they invent these frameworks to automate it.
>>
>>59417943
>>59417967
thanks guys
>>
>>59418180
>programmer two's program silently leaks memory
>programmer two's program contains vulnerability, allowing CIA to infiltrate the system
>>
>>59418180
aka you can build a deck with nails and a hammer but if you substitute a hammer for a wrench then the deck will look like shit, it took you a lot longer, but you did it
>>
>>59418152
Then maybe you should stop using classes you fucking idiot
>i-if we rename this and wrap a """" class """" around it, it becomes OOP!
>>
>>59418216
>guys
ease up on the gender assumption, please

>>59418211
>OOP code monkeys
This is an oxymoron.
>>
>>59418180
>Programmer two has an overflow
;)
>>
File: 1481827268553.png (455KB, 463x700px) Image search: [Google]
1481827268553.png
455KB, 463x700px
>(trace hi-fun)
...trace.rkt:291:41: set!: assignment disallowed;
cannot modify a constant
constant: hi-fun
>>
>>59418168
You're supposed to turn the symbols into functions in the place where you intend to call them (ie. inside hi-fun's definition), not when passing them in.

Tbh, my Scheme is pretty rusty, but you could alternatively make hi-fun take the functions as tail arguments, to avoid quoting:

(define (hi-fun list . fns) ... )
>>
File: 9e0.jpg (18KB, 300x233px) Image search: [Google]
9e0.jpg
18KB, 300x233px
>>59418251
>implying you can't have an overflow in VB
>>
>>59418293
At least arithmetic overflow is defined behaviour in VB.
>>
>>59418247
>oop has limitations & design patterns because they can't use lambdas
>get btfo
>b-b-but oop still has to use classes
OK kid
>>
File: 1487521254771.jpg (86KB, 1280x720px) Image search: [Google]
1487521254771.jpg
86KB, 1280x720px
>>59418327
>can't reason
>can't program
>can't greentext
so this is a "redditor"
>>
>>59418211
You have an example? I understand what you're saying but since english isn't my first langage, when I have to understand something it's always easier with code.

>>59418122
Yeah I'm using Spring.
>>
>>59415499
Thanks for the stupid debate flood, shitstain.
>>
>>59418180
>obviously an exageration
Obviously, and it makes you look like a fool. You can't just acknowledge something and suddenly it's okay.
>>
>>59418340
>has zero arguments
>entire self worth based around criticizing wildly sucessful ideas
So this is...the power...of autism
>>
>>59418346
>Yeah I'm using Spring.
https://www.tutorialspoint.com/spring/spring_ioc_containers.htm

So what part of it don't you understand?
>>
>>59418366
no, a lambda has one argument, and i am not cricising lambdas
>>
>>59418306
It's well-defined in C as well, as long as you don't use meme integers.
>>
File: ????.jpg (45KB, 577x622px) Image search: [Google]
????.jpg
45KB, 577x622px
>>59417730
Is that fucking fauxpas?
>>
>>59418414
Kek
>>
>>59415366
>Lua is fast
Lmao, sure adding 1 + 1 is pretty fast. But it's speed is dwarfed by any other compiled language when you actually have to do something useful. This is coming from someone who used Lua extensively, only to have shitry performance issues even with LuaJIT and their C bindings, then switching over to c++. And the only reason Lua is small is because there is barely any shit in it. Lua is utter garbage lmao.
>>
File: 1478294458757.jpg (40KB, 600x600px) Image search: [Google]
1478294458757.jpg
40KB, 600x600px
>>59418288
I've changed the definition.
(define hi-fun
(lambda (x y)
(if (null? (cdr x))
((eval (car x)) y)
(cons ((eval (car x)) y) (hi-fun (cdr x) y)))))

Incredible, I've got what I excepted!
So, what lambdas made so special for me?
Is it implied that I can't toss functions like that in other languages?
Why I can't toss function pointers?
>>
>>59418450
Some lisp bullshit
>>
>>59418450
You can, but functions in other languages don't usually capture their environments. Either way, Lisp's strong suits are metaprogramming and symbolic computation, not functional programming. Haskell, Agda, Idris etc. blow Lisp out of the water at that.
>>
>>59418099
What is this?
>>
>>59418346
Scroll to the end. It has download of sample project.
http://www.journaldev.com/2461/spring-ioc-bean-example-tutorial
>>
>>59417889
i wish to be with Lain forever
>>
>>59417889
Nah, I'm past my weeaboo phase.
>>
>>59418386
>a lambda has one argument
>>
Watashi Lain Desu.
>>
>>59418483
>don't usually capture their environments
How that matters?
>Lisp's strong suits are metaprogramming and symbolic computation, not functional programming
I'll take into consideration, but I want to take a grasp on lambdas before I go further.
>>
>>59418583
Weeb once, weeb forever.
>>
>>59418586
It's not my fault your favourite language overcomplicates everything
>>
>>59418375
I understand all of it now. I just wanted a real life example of how it's used in an application.
I have a project that I took from a friend that use it. I understand every bit of it but I don't know where the IoC part is made.

But whatever, I understood enough of it.
>>
>>59418447
Which language would you recommend, instead of Lua, to embed in a game?
>>
New thread:

>>59418657
>>59418657
>>59418657
>>
>>59418609
>How that matters?
It makes coding easier and less of a hassle, function signatures cleaner and requires no extraneous structures to structure highly composed operations on collections.

Anyway, if I may speak freely, the reason lambdas are so hyped in some circles is because they used to be quite rare. These days, you have them in Lisps, MLs, OOP languages like Ruby, Java and C# and even in unmanaged languages like C++ and Rust. There used to be a certain smugness among lispers, going on about how awesome it was to have lambdas, but these days the rest of the world has caught on.
>>
>>59418623
>arguing semantics of course
Point is idgas about Lain, call it whatever you want.
>>
>>59418583
I don't think you have to be a weeb to appreciate Lain.
>>
>>59418634
>I just wanted a real life example of how it's used in an application.
It's used to simplify construction of objects. Instead of carefully sequencing construction of a dozen objects that you pass to each other's constructors just because you need that one instance, you can just tell the container, "look, type T requires instances of A, B, C. I don't care how they're made, just make sure you have them."

It's also easier to change: when you add a new parameter to a constructor, you may have to change the order things are made, because now you need object X to be created before object Y.

With IoC, the container takes care of it.
>>
Trying out Django because I'm bored and uninspired.
>>
>>59418218
C was a mistake
ML was robbed
>>
>>59417215
>hurr there exists a real number for which I can't decide if its positive or not durr
>>
File: Screenshot_20170315-002124.png (33KB, 720x1280px) Image search: [Google]
Screenshot_20170315-002124.png
33KB, 720x1280px
>>59417144
Thread posts: 320
Thread images: 41


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