/dpt/ - Daily Programming Thread

Old thread: Lisp is the most powerful programming language.
I don't care about what you're working on.

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

What are you working on, /prog/?

Attached: 1568229037210.jpg (473x496, 105K)

Microkernels DEFEAT monolithic kernels by means of phase angle controls utilized through composite thyristor/VPI intelligent PREBINDING.
This saves time by avoiding unnecessary CTP calculations when addressing binary PLATE QUADS sequenced by the integrated data transistor interface.

Invalid OP
Fuck off

>What are you working on, /prog/?
fizzbuzz in bbcode

Shit thread. Kill yourself, OP.

>want to build server shit with .NET-Core
>Net-Core 3.0 releases in 9 days
Worst fucking feeling, do you wait for the update to come out or what do you do

Attached: 1544523438452.png (1132x632, 1.01M)

The API won't likely change that much.

transpose a linked list of linked lists

use the preview?

CL-USER> (apply #'mapcar #'list '((1 2 3) (4 5 6) (7 8 9)))
((1 4 7) (2 5 8) (3 6 9))

Let's say I want to get into language implementation. Particularly, functional languages. I would like to start with a simple DSL as a stack machine. Should I go with C as a host language? Are there any friendlier alternatives that don't sacrifice *too much* performance?

I'm asking because although I know C fairly ok, I've never really done a large project in it. I don't know the tools.

in scheme this is just (apply map list my-list)

Common Lisp will be good enough.

transpose [] = []
transpose xs = getZipList (traverse ZipList xs)

sad

>newtype wrappers
ugly hacks

lol @hascuck

happy

there isn't a better way unless you focus solely on this example
the [] case is needed because otherwise it will give you an infinite list of []s

>there isn't a better way
in haskell, because haskell type classes are shit

thanks for telling me you're retarded in advance, now i know not to have this conversation

imagine being this rude

don't let your feelings get in the way of facts

>double retarded
yikes now i feel bad for you

>REEEE the posts

Read the posts. Exactly.

Why is Haskell so inefficient?

Attached: energy-efficient-languages.png (907x814, 265K)

Because it's a chad language

What would be the most sophisticated way to count a pattern, reverse and repeat? For example
1 2 3 4 5 6 5 4 3 2 1 2 3 4 5 6 5 4 3 2 1
for the numbers 1 - 6.
I'm thinking of
int n = 1;
int c = 1;
for(int i = 1; i

imagine your language losing to lisp

Um....put that in algorithm please. Trying to learn c++. Your task may be the umph that makes me smarter with c++. Just started yesterday.

how is it losing? it's using more energy and memory
unlike the virgin lisp which is basically sitting in a corner crying promising not to take up space

1 GB/s of garbage to be precise

in Haskell
go pattern = cycle (pattern (init . tail . reverse) pattern)

>1GB/s
Based.

Attached: 1566411753161.jpg (1280x720, 338K)

I'm not into meme languages.

based retard

how do I compile LightTable on arch?

Attached: 9D6669C76F0941A6AC7ADAE84D0EAF20.png (500x522, 117K)

because you can't learn them?

what the fuck does this even do

fixed it

creates an infinite list, given an input list
cycle takes a list and repeats it infinitely
appends lists
(init . tail . reverse) takes a list, reverses it, drops the head (takes the tail), then drops the last element (init)

so [1..6] is a list [1,2,3,4,5,6]
reverse [1..6] is [6,5,4,3,2,1]
(tail . reverse) [1..6] is [5,4,3,2,1]
(init . tail . reverse) [1..6] is [5,4,3,2,1]
[1..6] (init . tail . reverse) [1..6] is [1,2,3,4,5,6,5,4,3,2,1]
cycle then just repeats that forever
[1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6,...

>(init . tail . reverse) [1..6] is [5,4,3,2,1]
>[1..6] (init . tail . reverse) [1..6] is [1,2,3,4,5,6,5,4,3,2,1]
whoops that should be [5,4,3,2] and [1,2,3,4,5,6,5,4,3,2]
the point of taking the init and tail is that it doesn't give you 6,6 and 1,1

>(init . tail . reverse)
sounds a bit inefficient can you do tail . reverse . tail?

No, because they're useless. Everything that matters is written in C derivates, Java, Python etc.

probably idk

But your original post doesn't matter and is infinitely more irrelevant than a meme lang like Haskell?

What makes them useless relative to other languages? They're both turing-complete.

>Fucks up the mobile programming env in your path
Why is a JavaScript front-end library the most popular way to create smartphone apps these days

Attached: 3255325235.png (1000x563, 76K)

What kind of idiots are you?

>How do I do this obscure useless shit?
>Haha no I don't want to use an obscure useless language

not an argument

(((()()

Attached: lisp.jpg (437x295, 17K)

#include
#include

const char *const fizz = "fizz";

const char *const buzz = "buzz";

static int print(int n) {
const char *strs[2U];
if (n % 15 == 0) goto fizzbuzz;
if (n % 5 == 0) goto buzz;
if (n % 3 == 0) goto fizz;
if (fprintf(stdout, "%d", n) < 0) goto err;
goto ret;
fizzbuzz:
strs[0U] = fizz;
strs[1U] = buzz;
goto print;
fizz:
strs[1U] = fizz;
goto simple;
buzz:
strs[1U] = buzz;
goto simple;
print:
if (fputs(strs[0U], stdout) == EOF) goto err;
goto simple;
simple:
if (fputs(strs[1U], stdout) == EOF) goto err;
goto ret;
ret:
if (fputc('\n', stdout) == EOF) goto err;
return 0;
err:
fputs("print failed\n", stderr);
return -1;
}

static int loop(int n) {
int i;
i = 1;
loop:
if (i > n) goto ret;
if (print(i) != 0) goto err;
i++;
goto loop;
ret:
return 0;
err:
return -1;
}

static int parseint(const char *str, int *n) {
char c;
if (sscanf(str, "%d%c", n, &c) != 1) goto err;
return 0;
err:
fprintf(stderr, "not an int: %s\n", str);
return -1;
}

static int process(size_t argc, const char *const argv[]) {
int n;
if (argc > 2U) goto errus;
if (argc == 1U) goto def;
if (parseint(argv[1U], &n) != 0) goto err;
goto process;
def:
n = 100;
goto process;
process:
if (loop(n) != 0) goto err;
return 0;
errus:
fprintf(stderr, "usage: %s [INT]\n", argv[0U]);
err:
return -1;
}

int main(int argc, char *argv[]) {
if (process((size_t) argc, (const char **) argv) != 0) goto err;
if (fflush(stdout) != 0) goto errfl;
return EXIT_SUCCESS;
errfl:
fputs("flush failed\n", stderr);
goto err;
err:
return EXIT_FAILURE;
}

Based. They should just remove l**ps from C.

(_:_)

lisps? loops? larps?

go = cycle . (mappend tail . reverse . tail)

Lamps
>mappend

Lambs

Reminder that this is real.

Attached: 1568236739441.jpg (1200x900, 263K)

I didn't want to remember

Of course. goto/label is the only way to write safe and non redundant code.

what is ze/zir? does that represent a user of zig?

In C family languages how do you restart an iteration? Say I have a while loop with (true) condition but something comes up and I want to restart from the begging. "break" exits the entire thing

They should standardise that GCC extension that lets you turn pointers to labels

Continue will jump to the next round of the iteration.

he said restart, not continue

>If (something happens) (the thing you are iterating over) = 0

You want pointers to labels? Nice idea. We should build a new low level language like C with no loops but with the great power of assembly.

Anything can be done with enough macros and gotos

Yes?

Why does the following give a segfault in C?
double listA[16777216];

I just want a minimalist C with Haskell style generics and none of that accumulated bloat that's in the standard library

on linux the default stack size is 8mb and on windows it's like 1mb I think.

I agree completely. C but with universal & existential quantification would be beautiful.

Because stack space is not unlimited.

How do I increase it?
Also is there a way to use variables with goto?

why are you trying to do this?

Why not just malloc?

Do what?

It's been quite a while since I've written C and I can't remember most of the things
Thanks

nevermind

There's only a difference if it's a for loop with a side effect.

Why is Haskell so ugly?

It isn't.

what's wrong with this?
if you never gave it an empty list as an input you could also have
transpose = getZipList . traverse ZipList

just use dependent types and you won't have to worry about that

yeah then you just have to give everything a signature

wow another stupid fucking comment from a dependent type fag, imagine my shock

What is your go-to font for a resume?

Attached: Resume.png (776x433, 27K)

actually a lispfag, but even lisp handles the empty list case

what are you applying for

suffice it to say your comment was fucking retarded
it's because ZipList forms an applicative that it produces an unexpected result for an empty list (an infinite list of empty lists)
it's container generic btw, unlike the lisp version, if i just wanted lists i'd use Data.List.transpose
if I wanted to exclude empty things I would use traverse1 from semigroupoids
you say dependent types but probably mean using dependent types plus implicit arguments to emulate refinement types (again totally unnecessary and a bloated alternative)

who cares lol

Digits prove Haskell btfo

>woah DUBS??? CHECKED THATS AMAZING
t. newfag

Courier is the only font worth using, in any size. The others are failed attempts at improving on perfection.

i love 4channel

Attached: 4channel.png (341x214, 73K)

based OP