Old thread: Lisp is the most powerful programming language.
What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
not anime girl pic
stop using any other lisp flavor but Shen
I thought Racket was the most powerful programming language.
Use my wife in the OP next time.
Your waifu a shit! A SHIT!
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.
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.
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.
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.
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
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.
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
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.
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
Careful big guy. This is my wife you're talking about.
>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
31
21.
Makoto from Persona 5 (I think)
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)
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
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)
quick rundown on fediverse?
consider {
f();
} thereupon (x);
>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
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);
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);
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
esolangs.org
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
makes u think
hereby (x)
whereon
{
f();
} with respect to (x - 1)
veni {
x += 10
} vidi (x < 20) vici
announcing ()
in participation of
)
}
by accordance with()
Hmmm... Is this something we should be worried about?
me on the right
a lot more than we should be worried about do-while loops