/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Attached: dpt hime2.png (581x1133, 616K)

Other urls found in this thread:

fstar-lang.org/tutorial/
fstar-lang.org/#papers
learncpp.com/
hastebin.com/fiqufemoxe.cpp
twitter.com/AnonBabble

>ATS
pls no

Parser generator library.

Thank you for using an anime image.

Attached: remember - no objects.png (1280x720, 1.26M)

Trying to figure out why web devs think that they contribute anything of value to the world.

Hoare Logic.

>You know that it'll never throw because you are maintaining some kind of invariant in your code
This is the case I was specifically talking about. Granted, .unwrap() is probably rare in well-written Rust code, but there are some weird borrow checking scenarios where you need to move things in and out of an Option just to get the borrowing to work out. And in languages with weaker type systems than Rust, you probably have to do even more .unwrap()-like checks or assumptions.

In Java for instance, you essentially make the assumption something is non-null every time you call a method, and you also make lots of assumptions about data not being mutated. So the type system really fails you quite often. For instance you can easily break these assumptions and they can propogate insidiously (especially the part about mutation).

Yeah, I don't consider Agda general purpose in the slightest. I see how general programming niceties are still useful. For instance theres a pattern where you write a program that essentially determines if some equation holds, then run it at the type level and use that as a proof during a larger proof. So its nice to have useful programming language features while writing that type-level-program.

First for fuck Idris.

What did you call me?

Can someone help me get started with QT for X11? It's not well documented from what I can tell, like, at all.

I'm pretty bumped out, meeting hawking was always something i wanted to do.

ATS is awful don't bother with it.
F* is interesting, and potentially more promising than Idris if it keeps steady.
It also has a really good tutorial
fstar-lang.org/tutorial/

I swear that they went out of the way to pick the worst syntax they possibly could.

hawking's health and his ability to move the cursor on his computer had been deteriorating, last I checked, it took him a whole minute to string a sentence together, that's no way to live.

better than not living at all, his body gave in, not his mind

The tutorial is quite good indeed, however sadly it does not really explain how it works under the hood.

look harder lad
fstar-lang.org/#papers

Anything that earns money is a contribution in all honesty.

{ /n def
1 /i def
&{ { n i gteq } { i i 1 add /i def } while &} apply
} /genlist defun

10 genlist prettyprint

{ This is a comment. Below I implement a map that is equivalent to the hardcoded one. } drop

{ dup mul } /square defun

{ /f def
/list def
&{ { list head null not } { list head f apply list tail /list def } while &} apply
} /mymap defun

10 genlist &square mymap prettyprint

{ Alternatively, use an anonymous function. } drop

10 genlist { dup mul } mymap prettyprint

{ The difference between def and defun is merely of the default behavior when met by the interpreter. } drop

{ 2 add } /add2 defun

1 add2

{ 2 add } /add2_ def

1 add2_ apply

{ A '&' before a defun'd block turns its behavior into a def'd block. } drop

1 &add2 apply

{ This is useful to pass functions as arguments, which otherwise would be impossible for defun'd blocks.
And without defun some pieces of code would turn excessively verbose. } drop

How much time I will need to learn C, and how can I learn it? I am in university right now and we learn Java there.

I just don't want to be a NEET after Uni. ;__;

>don't want to be a neet
>wants to learn a neet language
nani

I'm employed as a C programmer.

anecdotal, the job market for C is almost nonexistent compared to things like Java, not that it's good but still if he's seeking job security he's better off sticking w/ Java

You're just jealous.

Of?

My status of being a C programmer.

rofl

>status

Doing my best to get started with Python.
I come from a strong C background with basic C++ and OOP knowledge.

I'm currently going through 'Learn python the hard way' and intend on starting 'Automate the boring stuff with python' afterwards.

As I currently only truly know just ONE programming language, my questions are, though:
>How do I dive into coding python stuff rather than 'translate' code suited for C?
>What is python good for?
>Resources pls?

Attached: 13247904_1375602045790653_3139499435278634667_o.jpg (1600x1140, 444K)

>jealous
envious

>Learn python the hard way
Zed Shaw's books are garbage, and you shouldn't take anything he says seriously.

>anything by zed shaw
just a reminder that according to him Python 3 is not turing complete because it's not backwards compatible with Python 2

l

Attached: zedshaw.jpg (640x580, 60K)

Right. I'm a higher status than you.

Just started trying to learn how to code. I feel that this error is like burning water. Could someone help?

Attached: what am i doing wrong.png (1476x1037, 75K)

You have to put that code inside of the main function, not just like that.

who's the guy facing away

Well fuck me, thanks

>C++
>Windows
>Visual Studio
pls no

Adam Neely

I'm following a guide on
learncpp.com/
if you have any recommendations I'd like to hear them.

Should I learn Awk

Attached: p258.jpg (368x557, 134K)

Who's this cute girl

Yes. Its can be very useful when writing shell scripts.

awk + sed >>> perl

just learn perl and be done with it.

Perl is dead, inefficient garbage.

install gentoo

>spent a few months learning C++ and Java years ago
>stopped entirely
>ideas and syntax are all jumbled and patchy
Is there any way to fix this or am I just fucked?

Did that before I even found Sup Forums, turned me off from coding till now.

install NetBSD

C++ will be eternally fucked unless you practice it constantly.
Java should be fine if you learned it properly.
And if you learn C once, you've learned it forever.

>Rather than translate
About the only difference is using python s looping structures

>What's it good for
Small automation scripts and gluing libraries together

>lisp
>emacs
>gentoo

not required but heavily recommended
>programming socks
>engineering panties
>coding mittens

Attached: 1516228967913.gif (500x500, 1018K)

lisp, emacs and gentoo are respective codenames for each of those.

>not pairing emacs with mittens
retard

trips have spoken.
nopan kernel compiling should be a crime

What if I only have stockings, hair bow and a bra? I'm sure the bra will help me learn C++ though since its a C cup.

>coding bottomless
slut

Oh, really?
defun # >> compile-call end
>>
# get setmac

defun peek >> dup >
defmacro get setmac

defmacro ' >> compile-literal end

defun setf
dup meta
' setf
swap
getf call
end

defmacro !call call end

defmacro ! >> get # !call end

defmacro !>> >> end

defmacro ## >> compile-literal ' compile compile-call end

defmacro if
## not
# ?jump
end

defmacro endif
# resolve:
end

defmacro else
# jump
swap
# resolve:
end

defmacro while
# label:
end

defmacro do
## not # ?jump
end

defmacro repeat
swap
# jump # to-label
# resolve:
end

defmacro /*
while
>> ' */ = not
do repeat
end

/* now we can add C-style comments! */

defmacro {
## {}
## dup
>> compile-literal >> drop
## swap
end

defmacro ;
## swap
## setf
## dup
>> compile-literal >> drop
## swap
end

defmacro }
## swap
## setf
end

Oh shit did I dun goof'd?
Why does he get flak for? I know nothing of the guy.

Not him, but I hadn't read any of his works until today.
I read the article titled "The Case Against Python 3", since in it he facetiously claims that Python 3 isn't turing complete.

Any moderately skilled programmer who reads that article will instantly understand that Zed Shaw is full of shit. He complains about baby shit. He wants Python to be more like Javascript.
If he wants to teach Javascript so much, maybe he should just fuckin' teach Javascript.

Nothing he points out as a ``problem'' with the language is a real problem in any way. He simply doesn't understand static typing, type inference, accessability, and what it means to deprecate syntax.

>it's possible to automatically infer types in her language

Attached: 729.gif (340x340, 137K)

>``her'' language has garbage static analysis

Attached: 1510391736176.png (691x395, 215K)

Tcl/Tk is pretty neat

Attached: 2018-03-14-120955_1241x1001_scrot.png (1241x1001, 271K)

>her language has a garbage type system that makes type inference possible
Haskell babby detected.

Just looked that up, why the hell does he think you can't write a python 2 compiler in python 3? I can't find any explanation from him why that would be the cast.

desu

>her language is so shitty that type inference is impossible
>has to deal with garbage autocomplete that can only insert tokens
fox and grapes

>why the hell does he think you can't write a python 2 compiler in python 3? I can't find any explanation from him why that would be the cast.
He doesn't. Apparently you just can't read.

>she is so fucking stupid that she doesn't even understand advanced type systems that make general type inference impossible due to their being superior to Haskell

What's his claim then?

Why is Carmack there? Doesn't he usually program in C++?

And please don't let it be that you are autistic enough to point out compiler vs interpreter

>she is so fucking stupid that she thinks overly complicated type systems that can't be statically analyzed is somehow superior
You should take Stroustrup's dick out of your bagina, I think it's affecting your brain

>What's his claim then?
That going by the claims of the Python 3 devs, the conclusion is that Python 3 is not Turing-complete.

Or you know, you can learn C and then Python. Then get a job in Python and use C for some stuff.
Python and C go together like cheese and wine.

>she's so immensely retarded that she thinks C++ has an advanced type system
I was thinking about dependent type systems, where type inference is undecidable, but I guess it's too much to expect /dpt/ type system shills to even have a basic grasp of type theory.

read a book

how do I get employed as a C programmer without EE knowledge?

conor mcbride

Use, I just read some more, apparently zef 'trolled' us by saying it, lol, good one.

Asked before,
anyone willing to rate my C code/tell me what I'm doing wrong?
I'm not sure whether to proceed in the book or go and read something easier

hastebin.com/fiqufemoxe.cpp

He's recently started posting and talking about languages like Haskell and Lisp

Add ' using namespace std' before your main

Don't give bad advice.

How is a namespace bad advice for a beginner?

Neither is GTK so pick your poison. Try googling around and don't worry if your code looks like shit. I think that's just what happens when you start writing a GUI

Putting your symbols in a namespace is a good thing, blanket importing everything into the global namespace is not.
Either use fully qualified names or import symbols piecemeal.

I see, how bad does a global namespace affect performance of the code?

It does not.
It damages the readability of your code, which is already on life support in C++.

looks fine

>recently
Feels more like 5-6 years now.
I remember him doing that leading up to rage.

could someone give me a hand with this def dead(why):
print why, "Good Job!"
exit(0)

def start():
print """You are in a dark room.\n
There is a door to your right and left\n
which one do you take?"""

next = raw_input("> ")

if next == "left":
bear_room()

elif next == "right":
cthulhu_room()

else:
dead("You stumble around the room until you starve.")


is why in dead(why) only being set when else:
dead("You stumble around the room until you starve.") is run? how come its not neccessary to return why from what i understand thats what you need to do in functions if you want to use one of its variables in another function, that or use globals but im not up to that yet.

Attached: 1520923416964.png (890x960, 1.36M)

You seem to be failing quite hard at reading comprehension, tard. You asked why he claimed that a P2 compiler can't be written in P3. I told you that it's not what he claimed. He claimed that P3 is not Turing complete, apparently on the basis that Python devs insisted it can't be done.

I imagine it's probably something about the raw input. Likely it's eating the newline too.

Do a print of the variable next in between quotes (so you see the whitespace).

Yes, why is only set once you call dead. In python if you don't have a return it automaticly returns when it reaches the end of the function, I'm not sure what you mean though, where would you put the return why?

Use the constructs not available in C.

Anything is possible in C.

You seem to be misunderstanding something

f(x) = x + 3

is equivalent to
def f(x):
return(x+3)


until you call dead with some argument, why is not defined