/dpt/ - Daily Programming Thread

Old thread: Lisp is the most powerful programming language.
What are you working on, Jow Forums?

Attached: Lisp.png (2880x1800, 562K)

Other urls found in this thread:

google.github.io/styleguide/lispguide.xml#Iteration
exercism.io/tracks/c/exercises
pastebin.com/gtwaCmyF
twitter.com/NSFWRedditGif

perfect! So i wanted to write collatz conjecture in Common Lisp, this solution is pretty obvious (even if unreadable, problem is: how do i initialize counter i to 0, without passing 0 to function explicite?
(defun collatz (n i)
(if n
(if (< n 0) nil
(if (= n 1) i
(if (evenp n)
(collatz (/ n 2) (+ i 1))
(collatz (+ (* 3 n) 1) (+ i 1)))))
nil))
(defun collatz2 (n)
(loop for i from 0
while (> n 1)
do (if (evenp n) (/ n 2) (+ (* 3 n) 1)))
(format nil "~a" i))


I also tried to do it wih
(loop i from 0
do
while
)

its ok, but i dont know how to return i after end of loop

On your second version, you can use "finally (return ...)", though you can wrap the loop in a "let" form instead, as suggested in google.github.io/styleguide/lispguide.xml#Iteration

thanks a lot, i also had to
(setq n (/ n 2))

for n to change value after each iteration

you can do (loop for i = 0 then (/ n 2) ...

lul, i completely messed that up, but you get the idea

>still using C in the year 2019
>never found a language that I find to be more flexible and more powerful
>make drivers, graphics programming, general systems programming, general low level code and geberal high level code
>redditors screech at me to use a safer language
>SJW trannies try to belittle me into using whatever language with a trendy 1 word name is popular this week
>I parry their retorts, but waste no time arguing with the unreasonable
>never make any errors, and when I do I re-design my workflow. Because I understand it is the fault of the carpenter and not the tool if they make mistakes with such basic mechanics
>keep producing quality software
>keep winning
>keep making money
>keep writing safe, clean, perfectly optimized code
>people ask me how I write such dependable, fast, scalable programs
>reply "Must be my magic touch"

Attached: stand your ground.jpg (1199x630, 95K)

if you have multiple variables moving around in parallel, you can do this
(loop for i from 0
for x = n then (/ x 2) ...
If you can't have them running in parallel, then you can try your hand at DO*. More than one way to do things, so follow the style guide when possible.

real new thread

>I make drivers, graphics programming, general systems programming, general low level code and geberal high level code
Why are you LARPing in Jow Forums?

>if all you have is a hammer everything looks like a nail

I'm pretty familiar with most programming languages, but have been trying to learn more JavaScript recently and was wondering if there was any short way to replace if/else statements
so rather than
function test(word){
if(word=="foo"){
return bar;
}
if(word=="baz")
return boo;
}

I could just do something that has lists of inputs and their outputs and would return accordingly. I guess I could just get the array position, but was wondering if js had any built-in functions to do this(I'm surprised at how many it has), and wasn't sure how to verbalize it for a search engine.

switch case

>Lisp
Honestly, just fucking kill yourself and take your 40 year old meme book with you.

imagine being this upset over a programming language

what's an easy thing i can try to make in C?

A Lisp compiler.

lisp interpreter

a program to uninstall C

Quantum computers would not solve hard search problems instantaneously by simply trying all the possible solutions at once.

K&R is full of great exercises.

Is it possible to copy the MS certificate/signature thingy (the one that shows up as Author when asking for admin prompt) to a another executable?

quantum computers will be responsible for the singularity

Quantum computers are almost completely used right now for association rule mining to get you to buy more plastic crap.

>tfw kids in a thousand years will be programming their own universes with black-hole powered bio-computers

these programmed universes will contain worlds with their own computers, and these computers will be used to shitpost on their own daily programming threads

do makefiles even work on windows?

Attached: 2fe078dfeb6515fea7c265150a0748f3.jpg (564x833, 85K)

makefiles are just a macro to execute a series of tedious instructions.
regardless, uninstall windows.

of course, you just need GNU Make and other tools

exercism.io/tracks/c/exercises

>Ctrl-F Idris
0/0
>Ctrl-F Zig
0/0
>Ctrl-F Nim
0/0
>Ctrl-F Coq
0/0

I remember when DPT used to be cool.

>0/0
but that's indeterminate

I'm trying to learn a bit about fullstack. Is React, ExpressJS, NodeJS and Postgres a good stack to learn?

I heard MERN is dead now.

Patiently waiting for Idris2
Coq is more /sci/ though.
not if it's partial

...

this, also you want to use === always. I would look into typescript if you're coming from a c-like language, since having types makes it easier to understand

yea
you can either use nmake, microsoft's make or or gnu make

$ g++ -o test *.o
chess.o:chess.cc:(.text+0x15): undefined reference to `vtable for chess'
samplemain.o:samplemain.cc:(.text$_ZN5chessD1Ev[__ZN5chessD1Ev]+0xa): undefined reference to `vtable for chess'
collect2.exe: error: ld returned 1 exit status

Attached: tzuyu_wine.jpg (564x595, 61K)

what's my issue here?

C++

how the fuck have you managed this

mov ax, bx
add bx, ax

working on a new game, my progress so far

C++ is the most powerful programming language on Earth!

Attached: 1561968532011.jpg (800x1128, 740K)

oh, don't steal please

Wouldn't this do the same but without copying bx to ax?:
add bx, bx

yes, thank you for optimizing my code

what time of day are you best at programming?

i made a tictactoe game in elisp. i followed a tutorial on youtubue though, so it doesn't really count as much but I'm trying to take it further now.

They do, but you should use a tool like CMake if you want to be able to generate native build setups reasonably portably

Whats the Jow Forums way to web scraping?

>tfw Ada 202x pushed back a year and a half

hope they get rid of "end" so i can finally use it.

i like how fortran keeps staying relevant and modernized, it's a comfy, very fast and powerful language

Luckily they aren't that stupid.

but why, people really need to give whitespace a chance, and stop thinking every whitespace lang is python.

Ada is not a whitespace based language and never will be. Removing end would be retarded and require changing all the syntax rules.

no
the only whitespace lang is python

Ye I realize it will never happen, because Ada is at the mercy of too many big corps to make that drastic of a change.
I'd just like a whitespace Ada.

That's like asking for a whitespaced C or C++, go use a different language if you want to subject yourself to that suffering.

>suffering
Again, use a non-Python whitespace lang and you'll realize how much time you're wasting with curlies and ends.
And please don't pretend you've never gotten lost deciphering scope in a jungle of them.

python scrapy or whatever

Use a half decent editor. If you're losing that much time over a single character or three then learn to type or get software aide.

Write the whole new python library for each website in C++.

classic response from curly apologists.
>just bandaid shitty, archaic design with your editor :^)

this is sitting on my shelf, should I read it or sell it?

Attached: index.jpg (98x120, 3K)

Sell it and buy lisp books.

throw it in the garbage can

It's kinda old so I think I'm just gonna get K.N King's C

are you really going to learn C this time? or will it be the time after that? or the time after that...

I've never tried learning C before so we'll C

in that case, happy travels.

oh, the first book was a c++ book you retard, which I did in fact learn (I used Malik's book), just not from that huge tomb.

i may be a retard, but at least i'm not a cnile

thanks butthead, dump some additional resources now pls

despite all criticisms it seems worth knowing, it's the lingua franca of software and all. I wanted to learn Rust next btu i would feel very dirty knowing Rust but not C

no, it seems you are not ready for enlightenment after all.

you should feel dirty knowing rust at all
horrid language with no true purpose beyond making idiots who think they know what they're talking about arrogant

i don't know rust at all i just wanted to see what the memes were about

trannies, hrt, and dilation
that's really all there is to rust

is c++ worth knowing at all guys tell me right now, not sure whether i should pick it back up


im buying a Jow Forums pass tomorrow, so sick of captchas holding me back

HE'S GONNA FALL FOR IT

Rust is essentially a bunch of idiots shilling a language because they think everyone else is the idiots.
Almost everything they say is misinformed, (like one faggot who wasn't aware of guarenteed copy elision ranting about edge cases where deleting move constructors could cause problems) and they basically have no argument beyond the claim that the compiler should eliminate all bugs by drastically reducing the amount of freedom you, as a developer, have.
Which is absolutely retarded.

Depends on what you want from a language.
Languages are just tools, after all.
It's got a lot of useful quality of life features, but is extremely complicated, and the standard library is absolutely bloated as shit, while lacking some seemingly essential things.
If you want simple, it's not a language for you
If you don't mind complexity, and have no problem spending a fuckload of time learning it, then it's good.
Learning C++ is a real commitment.

Writing a certificate store implementation that's platform agnostic. So far I've only written the Windows Certificate Store implementation of the store. Abstraction comes next with OpenSSL support.

Why are these threads so full of jews? I dun geddit.

i know a bit of c++, took a couple classes on it and didn’t mind it. don’t remember much now but i’m sure i could brush up quickly. i just don’t really know where it fits in relation to other languages. only so much time so i’d like to git gud at a reasonably balanced list of languages.

this guy again, what i mean to say about balance is that languages are tools, and id rather learn a versatile toolset than know 5 different kinds of hammers. for example, if a person knows c or c++, should they bother learning a language that fills a similar niche like Rust or D? unless an employer request it of course

In C
My program is not going through the ifs correctly
pastebin.com/gtwaCmyF
No matter what the user chooses it always goes straight to the 'A' option in line 42 and inside after scanning the first number the program terminates.
I've trying going through it in a debugger and I've seen that the program starts two threads before terminating, I have no idea what could that mean.

Attached: 1470974716177.png (246x390, 72K)

>should they bother learning a language that fills a similar niche like Rust or D?
If that language offers a big enough benefit over another without significant cost, yes.
Neither rust nor D does that though (In fact, rust is nothing but significant costs).

Keep in mind that C++ is old as fuck, standardized, with a non-standardized ABI, which are major benefits that prevent the adoption of other languages looking to take over C++'s niche.
That means it's stable, with a shitload of libs, which can never be backwards compatible with "New language" without a shitload of effort.

Basically, learn C++ because it's been used and will continue to be used, and nothing can take over its niche.
C's niche is slightly different even if there is some overlap.

cool - i actually find c++ very comfy despite agreeing with the design criticisms. what about shit like forth, smalltalk, apl or prolog? are these just memes?

== and = are not interchangeable

>while (Task != 'E')
'Task' is uninitialised on the first loop.
>(Task = 'A')
>etc.
This is assignment, not equality. If you enabled warnings (which you ALWAYS should), the compiler would've told you about this.

>are these just memes?
Technically everything is a meme but, no, they're just dead. They didn't win the rat race.
Worth looking at to see what could have been done differently, as the path that the development of programming linguistics took was not the best one, just the one of least resistance.
Not worth actually using.

Pic related is what it's like to use C++.

Attached: 1560479338408.jpg (700x987, 678K)

no problem m8, just make sure to actually go through a book.
Don't search-engine program as a beginner.

I'm currently going through the hell that is the microservices meme at work.

Most of our services were already pretty small. I would argue that we were already doing microservices without even realizing it. But because the buzzword has infested this place, literally everything is an entirely separate application now. User X wants to search people by name and user Y wants to search by phone number? Well now, we can't just have a different argument. That's too "monolithic" (spooky thunder noises). Those need to be entirely different applications.

The users are already not particularly happy. Not only is the documentation piss poor, but nobody understands the difference between the services. I won't use the real application names because I don't want to be identified where I work, but we might have one service called "purchased-products-service" and another called "user-purchases-service". Nearly identical, with extremely minor differences that really just need to be solved by having a sane model for the data.

I think my favorite though is the fact that we have one service that uses neither XML or JSON. Instead it uses file attachments to send Microsoft Excel files back and forth. The fun part is that Excel can produce very different results depending on region and individual user settings. Anything but the default options with United States as the region will fuck it up. I also warned about time zones because Excel gives zero fucks about that, but nobody else around here seems to care either. This isn't even some legacy bullshit. This was literally a brand new application. In 2018 they decided passing Excel files back and forth was just dandy.

search-engine program as a beginner

prolog isn’t even worth using? it seems like the paradigm could have some crazy applications, making what would be hard problems in other languages trivial. i like to hear things aren’t worth learning so i can stop thinking about it though. I know some lisps (common, elisp, scheme), python, and c++. i don’t really know any language to what i would call proficient or in depth though. I’m trying to learn Python more in depth just because of the fuckton of libraries for it (i may do the same with R after for stats obv, not sure if Python has the same support) but it’s not a very comfy language so I think i’m gonna expand to C, Haskell or ML and learn one of those in parallel when i get bored with python

i’m not sure if knowing haskell, lisp and ml (probably ocaml) is like knowing how to use five hammers though, haskell and ml both seem really comfy

Sorry I'm retarded
I changed the = for == and now the program is going to the proper loops but still terminates after scanning the first number
search engine?

> one service that uses neither XML nor JSON
> it passes Excel files back and forth
Good fucking God. Touching anything Microsoft ends up with shit like LPWSTRZFUCKYOURMOM levels of awful. I wish my job would finally move away from fucking being a "Windows" house. The worst part is...in its "Golden Years", they were running on QNX.

It means, instead of """"wasting time""""" going through a book or learning properly. You just jump right in and google every basic problem as you go, because that's definitely faster.
Maybe you're not doing that, but mistaking = and == is pretty basic, so maybe you just overlooked it.
>but still terminates after scanning the first number
use enums for comparison, and a boolean for state, as a start.

I do search for an issue when I have an idea of what's happening but at the moment I don't know why the program terminates so I have to ask someone that knows better
Also I do confuse = and == a lot, it's not the first time it happens to me
>use enums for comparison, and a boolean for state, as a start.
My books hasn't said anything about this stuff so I'll read about it and see what can i do.