/dpt/ - Daily Programming Thread

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

Attached: Life.jpg (563x400, 75K)

Other urls found in this thread:

fediverse.party/
fediverse.party/en/fediverse/
esolangs.org/wiki/Rockstar
esolangs.org/wiki/Homespring
en.wikipedia.org/wiki/Larry_Wall
perltutorial.org/perl-do-while/
twitter.com/SFWRedditImages

not anime girl pic

Attached: 1560204664981.jpg (560x401, 137K)

stop using any other lisp flavor but Shen

Attached: [Coalgirls]_Yuru_Yuri_05_(1280x720_Blu-Ray_FLAC)_[62FD25E0].mkv_snapshot_12.25_[2018.07.11_09.59.52] (1280x720, 1.68M)

I thought Racket was the most powerful programming language.

Use my wife in the OP next time.

Attached: 1396886114638.jpg (1280x720, 144K)

Attached: pSuKsv7.jpg (500x587, 68K)

Your waifu a shit! A SHIT!

Attached: 16_.0.png (1280x720, 670K)

Wow I remember that trjpfag. Also remember marisa, he was making an OS . Don't think he got as far as our swedish boi tho

Have sex.

Attached: 1396886131808.png (560x420, 206K)

I need rust macro help. I want to write a macro that accepts an enum and generates calls to an associated function of each type stored within. Is this possible? Here's some code:

enum Foo {
One(one::One),
Two(two::Two),
}

trait Buzz {
fn bar() -> Self;
}

mod one {
pub struct One { /* fields */ }
impl Buzz for One { ... } // bar() will return One
}

mod two {
pub struct Two { /* fields */ }
impl Buzz for Two { ... } // bar() will return Two

}

// Want
cool_macro!(Foo);
// to turn into something like:
let vec = vec![Foo::One(one::One::bar()), Foo::Two::(two::Two::bar())];

it took me literally 5 hours to find out why my linked lists were segfaulting at seemingly random times. the one line I had to add was

newNode->next = nullptr;

5 hours.

Attached: 1547424045609.jpg (971x565, 141K)

if only there was an a program that lets you see where the segfault was.

if only.

I knew where the segfault was

>5 hours.

Attached: 15393681828280.jpg (300x626, 24K)

gdb + valgrind are your friends

sure you did

You would appreciate the dangers of proprietary software if you were in the MIT labs in the 60s. Freedom ain't free.

Attached: richard-stallman.jpg (400x326, 20K)

sci needs our help

11
do-while loops always execute at least once.

the absolute of pseudo/sci/entists

for x in range(2,m+1):
row=[0,m+1]
for y in range(2,n+1):
a=row[y-1]
b=array[x-1][y]
row.append(a+b)

how can i get list out of range in a=row[y-1]?

>it all started because of a printer
>the bane of linux is still printer drivers

>clang -fsanitize=memory

Attached: 1396887747735.jpg (1275x1500, 271K)

absolute state, even

yep I was using gdb, setting breakpoints and looking at the pointers and then sometimes it would segfault in another place (undefined behavior) from one run to the next. my linked lists weren't null terminated so functions were reading garbage at the end of them. too much of a brainlet until now to think why it was happening

what does this do? I use gcc.

There has never been a good consumer printer ever made. It's all just different flavors of screwing you out of money for ink.

Valgrind would have told you you had an ininitialized pointer.

Having my ass caressed has such a calming effect on my mind. It just goes blank.

has any language deviated from this?
it only makes sense that a do shouldn't run if the while is a literal false.

>MemorySanitizer is a detector of uninitialized reads. It consists of a compiler instrumentation module and a run-time library.

Attached: 1396896661943.jpg (648x639, 35K)

most laser printers are okay.

these sound like they would've been very helpful

no, because it doesn't make any sense. it's do {some shit} THEN check if you should stop doing it

>while means after

>doing leetcode problems
>my attempted solution doesn’t even complete in the allotted time

Attached: 7B3B6E76-1865-4A5F-AE0F-4796B6C3D3F2.gif (487x560, 898K)

imagine being at science

>while (false) { code }
>condition evaluated before code
>do { code } while (false)
>code executed before condition

It's 'repeat while'.

>weeb
>frogposter
>retarded

yep, checks out

If one did then there wouldn't be a reason to have it instead of a standard while statement. It'd just be syntactic bloat to write
do {
...
} while (x)

instead of
while(x) {
...
}

There's no legitimate reason to do so than to trip up newbies and to be a different for difference sake.

Attached: 1561803477459.jpg (1476x990, 402K)

Nice rack. How is it possible to focus on science with a pair of these abouncing all over the place? Women were a mistake

it's not
do while()
it's
do{
some shit
}
while()


mongoloid

hmm

Attached: 1561834139117.png (2560x1600, 259K)

Careful big guy. This is my wife you're talking about.

Attached: 1396890404975.jpg (1920x4406, 516K)

>needing to compile the code to know the answer
brainlet

why do pajeets love visual studio

int x = 1;
do {
x += 10;
} after (x < 20);

What is the value of x?

>trusting anything but real-world tests
It's like you want to make a Therac-25 or something

who

Attached: 1396885268015.jpg (500x703, 140K)

31

Attached: incredible.jpg (474x474, 10K)

21.

Makoto from Persona 5 (I think)

Attached: 1555531416696.jpg (1920x1080, 215K)

after doesn't make sense there.
why the fuck have we been okay with a fundamental linguistic mistake for decades.
as the other user said, it should just be while
or
while condition do action

error: expected 'while' in do/while loop
} after (x < 20);
^

see

do {
x += 10;
} as long (x < 20)

fediverse.party/
fediverse.party/en/fediverse/

you're gonna shit your brain when you see things like what the system call to send signal to a process is called in linux

which is a mistake because of the original picture.
it's not logical.

for (;;) {
things;
if (condition) break;
}

#define ever ;;
for (ever) {
things;
if (condition) break;
}

do this code below before checking if you should stop {
x += 10;
} if this condition is false then you should stop now (x < 20)

this is much better than do while

bulling the compiler into doing things it shouldn't is fun

Attached: 1560725434921.png (1111x849, 40K)

do-first {
x plus x equals 10;
} then-repeatedly-and-while-condition-is-met-exactly-before-but-not-necassarily-after (x is-less-than 20)

Attached: 1561633604555.jpg (456x320, 31K)

quick rundown on fediverse?

consider {
f();
} thereupon (x);

Attached: smug_sip.jpg (1600x900, 90K)

>i'm so le random xD

...

proposition f()
upon condition

do {
things;
} until (condition);

do {
things
} while (condition)

how's about we just stick with do-while and remember that it runs the body once before checking the condition because we're not fucking retards

>just accept and perpetuate the past's flaws because sunk-cost
kill yourself

The macro system operates on ASTs, so it can't do arbitrary inspection of types declared in some other place. I think the closest you can get is to decorate the enum's definition with a macro that declares a function, and then you call that function to get the vec you want.

>i'm so le random xD
what did he mean by this

it's scoped compile time state
it is completely unintended and there are currently proposals that make it ill formed
it's the definition of bulling the compiler into doing things it shouldn't
and it's not random either, it's very useful for implementing things like compile time hashing algorithms, or alternative forms of RTTI

Attached: 1535511775835.jpg (341x341, 27K)

i got tired of using parens, so i switched to brackets
(set-macro-character #\[
(lambda (s c)
(declare (ignore c))
(read-delimited-list #\] s t)))

(set-macro-character #\]
(lambda (s c)
(declare (ignore s c))
(error "Unmatched right bracket")))

CL-USER> [mapcon #'list '[[1 2 3] [4 5 6] [7 8 9]]]
(((1 2 3) (4 5 6) (7 8 9)) ((4 5 6) (7 8 9)) ((7 8 9)))

it isn't even a flaw. do while is obviously going to be different from a normal while loop you dumb cunt
maybe go make a babby programming language that starts indexes at 1 and fucks everything up just because it makes slightly more sense than what everyone's been doing for 30 years

he doesn't understand it so he's shitposting.

vouchsafe {
x += 10;
} ergo (x < 50);

Attached: karen sip.gif (480x270, 1.03M)

ask any linguist what should happen and I guarantee they'll agree it's a logical inconsistency.

Should I learn Lisp if I hate Jews?

That's helpful, thanks. Could you give me a code snippet, or a link to where I can find more info on how to do that? I never found a good reference for macros...

linguists aren't programmers for a reason. there are plenty of linguistic inconsistencies in computer science so I'm not sure why you're freaking out about do while loops

render {
x += 10;
} upon (x < 50);

Attached: hedgehog girl sip.jpg (1280x720, 87K)

linguists and programmers need more crossover for this very reason. And i'm not freaking out, merely proposing that do while is illogical.
And you saying "just learn the quirks and stop complaining" is depressing.

Hopefully they will say "this clearly isn't written in English at all, what is your problem retard?" Again, the whole point of the construction is to run at least once, and it can be read as "repeat while" which perfectly describes its behaviour.

>for this very reason
for what reason?
there's a reason it has never happened. because programming isn't meant to be read like fucking english. dumb faggot

In which ()
actuate
{
...
}

try printing out row and y before you access row.
or use a debugger

> because programming isn't meant to be read like fucking english.
take that back.
esolangs.org/wiki/Rockstar
esolangs.org/wiki/Homespring

en.wikipedia.org/wiki/Larry_Wall

I've never really found a good explanation of how to do type introspection with macros. All I know is that you definitely want a procedural macro, not a macro_rules macro. Maybe looking at serde will help.

perltutorial.org/perl-do-while/
makes u think

hereby (x)
whereon
{
f();
} with respect to (x - 1)

Attached: tea shake.gif (498x280, 2.64M)

veni {
x += 10
} vidi (x < 20) vici

Attached: 1400960825303.jpg (1280x720, 52K)

announcing ()
in participation of
)

}
by accordance with()

Hmmm... Is this something we should be worried about?

Attached: 122121221212122.gif (553x471, 64K)

me on the right

a lot more than we should be worried about do-while loops