/dpt/ - Daily Programming Thread

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

Last thread:

Attached: jmc.jpg (546x769, 70K)

Other urls found in this thread:

en.wikipedia.org/wiki/Logic_programming
mercury-in.space/crash.html
mercurylang.org/documentation/papers/book.pdf
en.wikipedia.org/wiki/Programming_paradigm
shenlanguage.org/shen.mp4
software.intel.com/en-us/articles/introduction-to-x64-assembly
amd.com/system/files/TechDocs/24592.pdf
twitter.com/AnonBabble

>Haskell is really uniquely bad.
it's really not though.
It's just everybody's first FPL, so they learn a fuck ton of concepts at once.
Also ATS isn't any harder than any other FPL, it's just ugly.

ATS isn't ugly, it's just written by a guy who has a 2-inch-wide monitor or something.
And yes it's very hard. Having to prove that you can access some memory is hard. The whole theorem proving and arrays of views stuff is hard.
>Haskell's everybody's first FPL
this is tragic. Learn Erlang, people. Haskell has too many bad ideas that you learn along with the good stuff.

Where's the anime, and why is Colonel Sanders here?

mccarthy is pretty sexy
no homo

>muh FP
>muh C
Can we have a different topic this /dpt/

don't forget to use const

Attached: CppCon 2016 - Jason Turner “Rich Code for Tiny Computers - A Simple Commodore 64 Game in C++17”- (1280x720, 1.93M)

fuck you, learn lisp

Suggestion:
en.wikipedia.org/wiki/Logic_programming

>ATS isn't ugly,
Languages usually pick and choose certain symbols and keywords to be the ones written the most. ATS said fuck it and just threw most everything in there.
>Having to prove that you can access some memory is hard.
Not any harder than learning monoids for the first time.
>Learn Erlang,
even worse than haskell, it's a dynamically typed shitlang with abhorrent error messages.

>getting this mad at superior dynamic typing

Here you go::- module cashier.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list, string, solutions.

:- type job
---> cashier
; manager
; accountant.

:- pred job(job).
:- mode job(out) is multi.
job(cashier).
job(manager).
job(accountant).

% valid(Bob, Sam, Tom)
:- pred valid(job, job, job).
:- mode valid(out, out, out) is nondet.
valid(Bob, Sam, Tom) :-
job(Bob), job(Sam), job(Tom),
not (Bob = Sam; Bob = Tom; Sam = Tom),
Sam = cashier => Tom = manager,
Sam = manager => Tom = accountant,
not Tom = cashier => not Bob = manager,
Bob = accountant => Sam = manager.

main(!IO) :-
solutions((pred([Bob, Sam, Tom]::out) is nondet :-
valid(Bob, Sam, Tom)), Solutions),
(
Solutions = []
->
io.write_string("Impossible puzzle.\n", !IO)
;
io.write_string("[bob, sam, tom]\n", !IO),
foldl((pred(L::in, !.IO::di, !:IO::uo) is det :-
(
L = [Bob, Sam, Tom]
->
io.print([Bob, Sam, Tom], !IO),
io.nl(!IO)
;
true
)), Solutions, !IO)
).(it's also an FP lang though)

g++ -o test *.o
/usr/sbin/ld: chess.o: in function `chess::chess()':
chess.cc:(.text+0x2b): undefined reference to `vtable for chess'
/usr/sbin/ld: main.o: in function `chess::~chess()':
main.cc:(.text._ZN5chessD2Ev[_ZN5chessD5Ev]+0xf): undefined reference to `vtable for chess'
collect2: error: ld returned 1 exit status
make: *** [makefile:2: test] Error 1
why is GCC giving me this?

Everyone knows your stupid jewlang. It's one of the famous common dinosaurs still used like C and C++

Oh hey, i've been learning that.
shame the book is unfinished.

the tutorial's unfinished?
this is new though: mercury-in.space/crash.html

Is Coq one of those?
Prolog?

>superior dynamic typing
Not really, i've been using elixir for awhile now, (and erlang by association). I've had enough.

This.

it's also one of if not the simplest to implement
it will never die

Mercury. Prolog wouldn't have all those types and "is nondet" stuff.

Declarative Languages != FP

>Mercury is a logic/functional programming language which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features.

mercurylang.org/documentation/papers/book.pdf
That one actually seems more like a FAQ/Q&A

what were you using elixir for?

That's fine. I don't hate Lisp itself but I'm tired of seeing it and C everywhere on /dpt/ like fags in a liberal city.

Coq is a theorem-proving language, like ATS or Idris or Agda.
For logic programming languages you want Prolog, Mercury(Prolog+FP), Curry(Haskell+Logic), Shen(Lisp+Logic^(sequent calculus)/0)

en.wikipedia.org/wiki/Programming_paradigm

yeah i know. i'm actually the OP, and wasn't really planning on posting this thread, but I am indeed a total faggot.

shen is a goddamn meme along with all of those other faggot languages
just use common lisp

shenlanguage.org/shen.mp4
listen to this voice describing the sequent calculus, and repent.

somehow you have referenced "chess"'s vtable and it does not have one, probably because it does not have virtual functions or something
i do not know how you have done this

Someone should make a language like C but give it lisp syntax and functional features. Then we can talk about functional C.

Still using it, for an image board.
I probably should make more webms to show off progress soon, it's been awhile.

D R O P P E D

Nah, it's really the best solution thanks to Phoenix, Ecto is a dream to use.

>tfw just got a craving for battered chicken

Why not use dialyzer?

I do, it's incredibly helpful, but it doesn't get everything. Though, despite me missing statically typed langs for this project, I still don't hate elixir nearly as much as i used to.

A game engine. It uses Lua and SDL. I'm embedding Lua into C++ and wrote an editor in python.

Attached: 2019-08-09-230811_1366x768_scrot.png (1366x768, 140K)

What does Jow Forums think of Rust? Any recommended projects?

Attached: Rust_programming_language_black_logo.svg.png (220x220, 7K)

Does checking x

I imagine x < y is quicker than x = y at bit arithmetic level so in some cases x

that it's gay, that its advocates are retarded, and that it has absolutely no future
just use C++ like everyone else

No, if you retards learned Assembly you would know this.

i don't really care

doesnt it check all bits at the same time?

how would it do that?

>she uses cmp

I dont know how the hardware works

Howdy. Making a shitty TUI telemetry application because some dork last year made it in Go and we all decided "Yeah, it'll be quicker and more flexible if we make it in python than learn Go".

Anyways, how would I handle window resize events in python's curses library? I know I need to use curses.KEY_RESIZE, but how would I make the ribbon at the bottom change? Here's what I have so far:

def draw(self):
user_input = None
while (user_input != 'q'):
self.draw_menu_bar()
if (input_chr == curses.KEY_RESIZE):
# wat do?
pass
elif (input_chr > 0 and input_chr < 128):
user_input = chr(input_chr)

def draw_menu_bar(self):
dest_row = curses.LINES - 2
self.tui_helper.fill_row(dest_row, ColorScheme.MENU_SCHEME)
self.tui_helper.write_string("[q] QUIT", dest_row, 5,
ColorScheme.MENU_SCHEME)
dims = self.tui_helper.get_screen_dims()
dim_str = "{}x{}".format(dims[0], dims[1])

self.tui_helper.write_string(dim_str, dest_row, curses.COLS - 10,
ColorScheme.MENU_SCHEME)

Would I need to re-assign the curses.LINES and curses. COLS? Any and all help is appreciated.

Attached: Screen Shot 2019-08-09 at 9.36.20 PM.png (1706x1452, 165K)

What a stupid post.

Hey lads. Novice programmer here. How do I git guud at x86 Assembly? Dunno how relevant this is, but I have a background in C++ programming. Any recommended books or other sources of info that'll distill it down for a retard like me?

>Python
>ncurses
>rewriting a program because it was written in a fast easy language with great TUI libraries and you want it written in the slowest language on the planet with dogshit TUI libraries

Attached: brainletcastle.jpg (645x1000, 107K)

>x86 assembly
does it work?
cool
done

Hey man, don't be rude.
There is no tangible benefit to using Go. None of us in the team we're working on know it, and we need to get this done by this weekend. I'm almost done with something that works, so there's something to be said about Python's ability to prototype.

I used tutorialispoint as a starter and it was good enough for teaching me the basics. I would recommend learning x64 too since that's what most computer use now.

>Any recommended books or other sources of info that'll distill it down for a retard like me?
that's not how ASM works, you can't shortcut it like Python.
software.intel.com/en-us/articles/introduction-to-x64-assembly
amd.com/system/files/TechDocs/24592.pdf

It takes 5 seconds to learn go.

Your shitlang has nothing on Python because speed of development is more important than 5 extra milliseconds of execution.

>Python
>good speed of development
>not even typos get seen until runtime
>can't trust code until control flow goes through it

One way to implement a "set if less than or equal to" (when working with ints) is to realize that when x < y, x - y is less than zero. When x == y, x - y is equal to zero. Most assembly instructions come with a "Set to TRUE if less than" instruction, so you could imagine doing something like this in MIPS:

sub $t0, x, y # assume x and y are registers with the desired value
slt $t0, $t0, 1
[/code]

Dude, I spent two full days reading through TGPL. There are a lot of non-obvious parts to the language. It would take much more time for me to learn Go and implement what I did in a day with python + curses. It doesn't make sense for me to tell my team to use Go.

Do you have any idea how to fix the resizing issue, or are you just shiposting again?

that's why you use common lisp and get the best of both worlds

Go allows for faster development because you don't have to deal with cancer of dynamic typing which pushes compile time errors to runtime. And it is like a hundred times faster and more memory efficient. And it isn't single threaded only trash.

>I CANT PROGRAM WITHOUT MUH STATIC TYPES HANDICAP MODE
Another problem that would've been solved had you retards learned Assembly.

>it's faster to walk than to crawl

Just don't make typing errors, retard. I usually don't use static typed languages and almost never run into typing errors.

typing errors aren't a cross and you aren't a vampire. When you use languages with static types, you do things to encourage typing errors. You structure your program to maximize the possibility of a type error. You WANT typing errors, because that means learning about a problem at compile-time instead of at runtime.

>faster development
yet it lacks generics and many expressiveness-focused features.
>you don't have to deal with cancer of dynamic typing
*Go runtime panics*
>it is like a hundred times faster and more memory efficient
but it's not even faster than lisp

>it's not even faster than lisp
it is

That's because you write nothing but fizzbuzz tier programs. People who write things with more than 100 lines make mistakes.

daily reminder to just do all your programming in coq

>That's because you write nothing but fizzbuzz tier programs.
Cope
>People who write things with more than 100 lines make mistakes.
I've written many several thousand line programs in Python and never had an issue with dynamic typing that wasn't immediately resolvable.

>have to extract it to get an actual program
no thanks

>2019
>doesn't do all his computation inside coqtop
never gonna make it

There's really no reason to use Coq when idris exists.
And if i want to go extremely autistic with security and verification, i can use F*/Low*

C can do everything that lisp can do but faster.

do it in ATS instead.
#include "share/atspre_staload.hats"

datatype class(int) =
| mage(0) | fighter(1) | thief(2) | cleric(3)
| wizard(4) | warrior(5) | ninja(6) | priest(7)

fn promoteclass{n:int | n < 4}(job: class(n)): [m:int | m == n + 4] class(m) =
case+ job of
| mage() => wizard()
| fighter() => warrior()
| thief() => ninja()
| cleric() => priest()

fn getsomeclass(): class(0) = mage()

val+ wizard() = promoteclass(getsomeclass())

implement main0() = ()
any error outside of blatantly rearranging the datatype will get caught. promote a mage to a warrior? error. getsomeclass() returning anything but a mage? error. not having a promotion path for a classes? error.
(no I don't have a real-world example.)

cool stuff. nice desktop btw.

>Idris
enjoy your 30-second compile times for 30-line programs.

idris2 is faster according to Edwin-senpai, since switching to a chez scheme backend.

lol ugly syntax

Why can't there be one /dpt/ not tainted by fpl and syslang shittery. No one doing anything useful cares about your fp and no one cares about your shitty syslang with missing generics and/or ugly syntax.

dude just get shit done lmao
dude only talk about stuff I like lmao

Daily reminder that formal verification is a waste of time for almost all programs.

talk about what you want others to talk about
or is this it? you want a greater percentage of "posts whining about what people are talking about" in /dpt/ ?

how about you wagies just fuck off and make /wpg/ then, if you want to endlessly jerk off over enterprise shitlangs and bitch about your jobs.

I translated my Haskell qsort to Python and kept it one line. Yay!
qsort = lambda l : qsort([i for i in l[1:] if i < l[0]]) + [l[0]] + qsort([i for i in l[1:] if i >= l[0]]) if len(l) else []

based OP

but that would just make /dpt/ dead

good job!
...
but now, you must benchmark it.

Go back to >>>/wdg/
Java, python, and javascript "developers" are not welcome here.

please just fuck off faglord

What does public static void main args mean in Java? My teacher is a brainlet and didn't explain it very well.

>public
other classes can see it
>static
it can be called directly as a function, rather than only as a method against an instantiated class
>main
it's just the name of the function. it's treated as the entry point of the application depending on how you compile it.
>args
operating system parameters to the entry point. an array of strings.

>Java
AAAAAAAAAAAAAA USEFUL LANGUAGE REEEEEEEEEEEEEEEE

Attached: triggered.jpg (259x194, 6K)

it means you must poo in the loo instead of on the street

void is the return type, which is nothing

see

It means you should switch majors to sociology.

>public
This makes a method callable by other classes.
>static
This makes a method work similarly to what non shit languages call a function. Meaning that you don't have to create a noun that owns the function to run it.
>void
It is the return type. Main returns nothing so it's return type is void.
>main
Name of the method, main is where the program starts executing.
>args
The arguments that are passed to the program when it is called from the command line.

Basically just verbose java retardation. Most languages don't require such arcane rituals.