/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/Guad/batt
godbolt.org/g/j9rAUI
practicaltypography.com/why-racket-why-lisp.html
wikiwand.com/en/Extensible_programming
wikiwand.com/en/Language-oriented_programming
dlang.org/comparison.html
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
dlang.org/phobos/index.html
wiki.dlang.org/Books
github.com/passy/Android-DirectoryChooser
tour.dlang.org/tour/en/gems/functional-programming
garden.dlang.io/
twitter.com/SFWRedditImages

Lisp is the most powerful programming language.

rate my language inspired by RPN, written in C
github.com/Guad/batt

a code example:
proc reverse_number
over 1 < @end if
10 *
over 10 % +
swap 10 / swap
reverse_number
end

getln 0
reverse_number
println

What makes Lisp special?

haskell!

trash / 10

great, now implement it using truffle

parentheses

I gave rust a chance, and I couldn't shake off the sick feeling of being surrounded by webdev transplants and identity politic idealogues, both in their documentation, and their IRC channels.
Also, I was writing a bunch of stuff C style anyway, why even bother if I'm just evading the static safety system anyway.

Should I just double down on C++?
What other language should I try next?

/dpt/-chan, daisuki~~

Ask your much beloved programming literate anything (IAMA)

It's a programmable programming language.

Thank you for using an anime image.

>What are you working on, Sup Forums?
A little utility program for gnu+linux but i haven't decided what programming language yet (Crystal?)

constexpr is powerful, you can, for example, hash or filter a string in the static environment.

tbhdesu

definitely learn C++

>language shopping
>visiting IRC channels for languages
just stop 'programming' and do the world a favour honestly

How difficult would it be to replace systemd/write an init system in Haskell?

>What are you working on, Sup Forums?
Shitty irc client in Go, that should ultimately be able to automatically do xdcc requests.

does haskell even have IO?

>It's a programmable programming language.
Sounds like a buzzword to me. What does that mean in practice?

...

it might be implemented using inline assembly or compiler intrinsics which don't work at compile time

Can you go into more detail on constexpr?
To what extent can I precompute by program at compile time?

you could do factorials my friend
you could meme yourself into the code

Harder than in C, easier than in Python

What is this? A little g-string or something?

just your average programming underwear

step 1
>add yet another subsystem which implements the haskell runtime
step 2
>replace systemd with something even shittier

Seriously though, write compile time rational numbers rounding /dpt/

Seriously though, no.

just use templatehaskell and splice (round n)

I want to build my own mathematical parser

You can compute any expression where its variables are fixed in the static environment.

An example that an user posted some days ago

#include

constexpr auto cstrlen(const char* s)
{
std::size_t l = 0;
while (*s++) ++l;
return l;
}

constexpr auto has_repeated_characters(const char* s)
{
auto o = s + 1;
auto l = cstrlen(o);
for (std::size_t i = 0; i < l; ++i)
if (s[i] == o[i])
return true;
return false;
}

int main()
{
return has_repeated_characters("moose");
}

godbolt.org/g/j9rAUI

As you can see, the result is computed in the static environment.

You can extend the language as you want

practicaltypography.com/why-racket-why-lisp.html
wikiwand.com/en/Extensible_programming
wikiwand.com/en/Language-oriented_programming

some Lisps even embed C

(define (foo a b)
(#C
int c = a + b * 9;
return c;))

I'm seeing a lot of textbook definitions but I'm not seeing the thing in practice.
What does it mean, what does it look like?

>tfw you tried to have a dialogue with d-chan-fag and they didn't answer your questions

C++17 contexprs are hawt

what are you referring to? extending lisp or c++ constexpr?

Extending Lisp.
What does it look like when I "extend Lisp", and why would I want to do such a thing?

I agree. The article was filled with prose and not much in terms of practical examples.

Reminder that Paul Graham still hires lisp hackers

Someone has to maintain HN

what programming language do you know?

Is this Forth?

its based on forth

A patchwork of a few things. I know a bunch of Java, C++, PHP and Python but I don't have a lot of work under my belt.

I made some VHD in Win Server 2012r2 and i wonder why i can't switch it to dynamic disk, it's grayed out, it's always basic disk

Looks cool
Is @end a special form, or can I say @swap?

using git branches to separate the c from the c# version is not a good idea.

The @ character indicates that the next statement should be placed on the stack instead of being executed, so yeah, you can use @ with any statement

I don't really wanna continue with the C# version so I just kinda left it there

yeah but for example, you said in the readme to look in the example folder where is only present in the C# branch

Whoops, will fix

a few odd things in the code but looks good overall.

fuck me i absolutely cant design UI code without shitting up the rest of the app

it's not possible to write good ui code unless you're using html, css and react

wipe this meme off the face of earth
you can make very pretty UI if you try hard enough

What's a good parser generator that's both for C and LALR?
Is Bison good?

people still use C?

what the fuck man can any android developers tell me how i can let a user select a folder and then get all the paths to files in that folder

it's fucking ridiculous how many layers of indirection i have to go through in whatever i've looked up, initiating what seems to be the right intents and "building document URI"s in the result of the intent completion and using a contentresolver to query the resulting document URI and using another contentresolver on the URI to find all children URIs and using a contentresolver for the "MediaStore" which fails if the path isn't the "external device", blah blah blah holy fuck what a waste of thinking, this is literally two lines of code on any operating system

Yeah well you should have made webapp and used jquery, noob.

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!
>Features
dlang.org/comparison.html
>GC
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Standard library
dlang.org/phobos/index.html
>Books
wiki.dlang.org/Books

What is the K&R equivalent for Python?

That's even worse mascot than the lisp alien

what compels people to shitpost about dead languages nobody cares about?

Use github.com/passy/Android-DirectoryChooser for a directory picker.

File[] files = (new File(directoryPath)).listFiles();

Use File#getPath() on each of these files, and you're done.

see

i'll be testing this out in a minute, thanks my dude

do you recommend any other libraries to cover up general annoyance with the android API, atleast for semi beginners

unsafe

(Cross-thread)
>C#'s tools are completely free and open source.
Yes, I know; I never implied they weren't.
>C# can be used in other frameworks that have absolutely nothing to do with .NET.
I am wrong on this, sorry; however, most applications of C# do use .NET. And most learning resources require it too.
>I don't understand why you see the ability to utilize .NET Core and the .NET Framework as a negative.
First, it's relatively big. To use a simple .NET application, I'd need to download the Core or the entire Framework. And if it's a program that uses an older version of the framework, I'd have to use that too!
My second grievance is that its OOP design is a mess. This goes to Java too. Now, I'm not one of those people that thinks OOP has not place in software, it's just that its generally preferred design implementation is terrible, and it forces you into having to use OOP for the most part. Finally, it's really abstracted. Some might like this; some might not. I'm on with the latter side. This is my preference though.

tour.dlang.org/tour/en/gems/functional-programming
garden.dlang.io/
Thanks to dlang-chan for being a general-purpose systems language, she doesn't have to stuff shit in classes all the time. So she can adopt a lot of paradigms effortlessly.

I think she's cute! Though she's not a mascot. I don't have that authority.

Calling something you don't like is not shitposting. I'm trying to educate other anons on a language I love. I don't do
>if u don't use D gb2 >>>/reddit/
>only plebs don't like D LOL
etc.

I've addressed those above.

I still use Fortran and I get shit done faster than any other babbys using memelangs like Go or Haskell.

Also isn't only the .NET Core available on linux; as in you don't have all of .NET available to you on linux?

Did I do it right?

#include

int main() {
const int its = 9;
char arr[its];

const char emptyChar = ' ';
const char magicChar = '*';

for ( int i = 0; i != its; i++ ) {
for ( int y = 0; y != its; y++ ) arr[y] = emptyChar;
arr[0 + i] = magicChar;
arr[its - 1 - i] = magicChar;

for ( int y = 0; y != its; y++ ) std::cout

myself, I'm interested in language semantics
it might just might be fun
It would be a neat way of standardizing recipes across platforms

You could have ingredients inherit from ingredients and recipes from recipes
And once it's in a form like that there are lots of things you could do other than make changes to recipes, like scale them up or down.

I need a good name for it

>Calling something you don't like is not shitposting
I don't have a fucking clue what this language is, I dont dislike it, making huge, agenda-driven posts with anime avatarfagging about your language nobody wants to use is obnoxious as hell, I dont shitpost about my favourite obscure languages, they're obscure for a reason

what does that buzzword even mean?

>char arr[its];
This is invalid C++.

Linux also has Mono.

>I don't have a fucking clue what this language is, I dont dislike it
That's why I'm sharing the glory of her with my favorite anons.
>making huge, agenda-driven posts with anime avatarfagging about your language nobody wants to use is obnoxious as hell
I'm not really avatarfagging. I try to only use her as the first post. And my agenda is out of pure love. Also, they're not "huge." I generally try to only make one post about it, and it's usually only a sentence long. I regret my recent namefagging though. With regards to "nobody wants to use," that's what I'm here for! The biggest obstacle to dlang-chan being a popular girl is misunderstanding and general ignorance. Her parents are a big issue with regards to this.
> I dont shitpost about my favourite obscure languages
Good, because shitposting is bad. You could talk about it though; this is a thread about programming.
>they're obscure for a reason
And such reasons might be bullshit.

You are incorrect.

fpbp

It is not, as long as its is const. Which it is.

I forgot about, mono. But I believe mono's implementation isn't 100%.

why not make it accept XDcc requests instead to maximize your user base?

your posts are shitposts, languages dont take off for good reasons, and just because you 'love' something you're still pushing your obnoxious agenda on people just like doorknocking christians with pamplets

momo sucks dude

Dumbasses. C++ doesn't support VLAs.
You're relying on a non-standard compiler extension here.
$ cat shit.cpp
#include

int main()
{
size_t n = 10;
int arr[n];
}
$ g++ shit.cpp -Wpedantic
shit.cpp: In function ‘int main()’:
shit.cpp:6:11: warning: ISO C++ forbids variable length array ‘arr’ [-Wvla]
int arr[n];
^
Stupid sepplesfags don't even know their own language.

kek

Oh wait, fuck me, I forgot to put const.

It's close enough. You've got WinForms. Do you really need much else?

Really?
Make n const and it will compile.
"its" was const in

Not that guy or a lisper, but as a Forth programmer (which has equally powerful metaprogramming) the main reason I have for extending the compiler is custom data structures/parsing and control flow.
Being able to just take a nicely formated table of some mapping, say names to colors, have it look like an ascii table in the source code, and being valid syntax is just incredibly nice and neat.
It may seem trivial (oh, what's the big deal, just put things into array or some map/dict initializer syntax and it works in any language), but it adds up, and later when you wanna add stuff to your constant table, or event handler table, when it's expressed in super neat human readable format it's a pleasure to work with.

And of course by virtue of having direct control of the compiler you can compute anything you want at compile time.
C++ constexpr are cool? Pleb tier compared to Forth. You can turn ANY existing Forth function or expression to a compile time constant by just switching off the compiler, run the code, switch back to compiler and compile top of stack as a literal (be it integer, address, string or even another set of words, i.e another program computed at compile time).

I feel handicapped in other languages after having used Forth extensively.

It's const silly.

>your posts are shitposts
Nah, I just explained why, and you've given terrible reasons why.
>languages dont take off for good reasons
Money, advertising, timing, and misinformation are good reasons why she hasn't reached her potential.
>and just because you 'love' something You're still pushing your obnoxious agenda on to people just like doorknocking christians with pamplets
This is a terrible analogy. Making one post, that's generally small, a thread is not as nearly obnoxious as that, and comparing one post to someone coming to your house like that is retarded.
Try again. Actually, don't. You have no idea what you're talking about.

>emacs
would be nice if I had three hands or 18 fingers

>Money, advertising, timing, and misinformation are good reasons why she hasn't reached her potential.
There's also the fact that we don't need yet another competing standard for a technologically crowded space.

>he doesn't write his software in 100% pure assembly language

you've been shitposting for several threads, and programming languages aren't video games, they don't need a marketing campaign

And you would say the same about Rust and Go, right?

they're both shit, yeah

as a code artisan, i crafted my own implementation of RC4 in x64 to protect my private stuff.

I disagree. Languages are tools, and having many tools is a good thing.

Here's your (You). And by advertising, I mean spreading accurate and good information on what she is capable of. But please, stay mad.

Why doesn't C++ support VLA and C does?

nobody has been spreading misinformation about your programming language, people just dont give a shit

VLA was a C99 addition
VLA was also a mistake