/dpt/ - Daily Programming Thread

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

Attached: lisp_.png (165x256, 30K)

Other urls found in this thread:

github.com/wc22m/5yearplan
github.com/tfili001/lexer/blob/master/parser.cpp
github.com/tfili001/lexer/blob/master/fnexample
rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf
pyret.org/index.html
pastebin.com/kuS34Bi0
man7.org/linux/man-pages/man3/err.3.html
stackoverflow.com/questions/31476632/what-is-the-equivalent-of-gnus-wrap-linker-flag-in-os-x-linker
blog.mindorks.com/understanding-higher-order-functions-and-lambdas-in-kotlin
npmjs.com/package/dignity
youtu.be/0HtZclfnnQw
twitter.com/NSFWRedditVideo

>Lisp is the most powerful programming language.
stop pushing your shit in OP of /dpt/ you fucking retard.

Hoi, Anone~ It's YOUR turn now to learn JavaScript with me! Let us begin!

Attached: de0544ea3956bd913f8a95abef7a7131.jpg (1912x2868, 196K)

Just started my MtF transition. Wish me luck, /dpt/!

Attached: qt.jpg (450x600, 47K)

Just a little program I wrote in C. It converts hex to octal, which makes for a handy reference if you want to printf a specific stream of ASCII or Extended ASCII characters using octal escape codes and your ASCII table only lists codes in decimal and hex.

#include
#include
#include

int main( int argc, char **argv ){
int len = strlen( argv[1] );
// BEGIN BUILD LOOKUP TABLE
int lookup_table[256];
for( int i = 0; i < 10; i++ ){
lookup_table['0'+i] = i;
}
for( int i = 'a'; i < 'g'; i++ ){
lookup_table[i] = 10 + i - 'a';
}
for( int i = 'A'; i < 'G'; i++ ){
lookup_table[i] = 10 + i - 'A';
}
// END BUILD LOOKUP TABLE
int num = 0;
for( int i = 0; i < len; i++ ){
num += lookup_table[argv[1][len-i-1]] * pow( 16, i );
}
printf( "%o\n", num );
return 0;
}

Cut it out, user. It triggers the C++ers and then they make the thread miserable.

>economic calculation isn't possible
Heh, hold my beer...
github.com/wc22m/5yearplan

>>/lgbt/

>langwar bait in the OP is now normal

Attached: lqCa05E.jpg (698x658, 106K)

You must've stumbled upon the wrong thread, user. This is /dpt/, a thread for cute boys who dress as girls and wear programming socks.

Attached: 1445573554067.png (1200x1080, 835K)

Sinking time into resolving some stupid shit while I'd rather work on the interesting part of the program, that's what I'm working on

I'm an unemployed debugger. Help.

Shut up and hang yourself already.

Dilate :)

I'm working on an embedded codebase that's a complete mess right now, so I want to add unit tests to make my life a little less awful.
I'm having a lot of trouble using cmocka to compile a simple test. I brew install cmocka, so I have it in my library search paths. However, after I link it I get the "Undefined Symbols" error from the linker. Even though you link against the library, how do you make sure that, after compilation?

Tangentially related question: should I be using makefiles or CMake? I kind of don't want to learn yet *another* way of writing compilation files, but I'll do it if it's easier in the long-run.

Attached: Screen Shot 2019-07-19 at 11.58.37 AM.png (3738x884, 403K)

I'm writing an interpreter for my own scripting language:

github.com/tfili001/lexer/blob/master/parser.cpp

github.com/tfili001/lexer/blob/master/fnexample

I guess that's the only way to post code for now

Attached: 2019-07-19-150150_456x365_scrot.png (456x365, 12K)

>lambda@DN0a23822
what

rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf

Cope, salarie.

I made an alternative thread for people who DON'T want to fight over languages.
We'll see how it goes.

Delete that thread.

check out sscanf

nice

Attached: lll.png (534x748, 14K)

University-given hostname. Lambda's just the name of my computer.

check out pyret.org/index.html

Attached: g.png (1440x2025, 410K)

Is that memory-safe?

user you still have that picture??

so you ssh into the university server from your pc?

yes bb
i see you moved on to Haskell

Yes it's useful obviously, stop making excuses for being a lazy fuck

Essentially.

I'm still a bit lost on this. Is there a way to check if I'm including the actual static library? I'm not sure I am at the moment.

what do you mean by that?
You'd only use it to convert a string to an integer, if you check the return value I can't think of anything bad that could happen.
I also just remembered that you could just use strtol.

Yeah, once again interviewers have literally no idea what's useful for the job. Are you retarded?

are you?

cmocka_unit_tests doesn't seem to exist (at least the compiler didn't encounter it). Are you sure you included the right header/spelled it correctly?

Erlang will be next.

Okay but why do you have a collar around your leg...?

I'm 95% sure I got the path correct. I triple-checked and used the "Copy as Pathname" utility Mac OS X. I even re-arranged the command, but to no avail.

Attached: Screen Shot 2019-07-19 at 12.28.17 PM.png (1876x1370, 409K)

I haven't used cmocka myself, but looking at their website makes me think you meant cmocka_unit_test and not cmocka_unit_tests.

trying to find unistd.h on windows

i made a simple path finding algorithm, i should probably rewrite my recursive function since i get stackoverflows with bigger mazes.
dont know if i will, im still a beginner and this is just a fun program.

Attached: maze.png (603x604, 31K)

Look up tail call optimization

>figure out a way to make bottleneck significantly faster
>implement it
>open up a pandora's box of tricky race hazards because everything else in the application was built under the assumption it will be complete way before the bottleneck

Attached: 1555901636721.jpg (1200x1200, 117K)

needs docs

That's like trying to find windows.h on Linux (without mingw anyway).

I started playing with Powershell, I made this script for fun, basically it searches desuarchive for a random image in a thread and views the same image (View Same) across the board based on the file hash used on the site.

I know it's silly, but it's a start.

(Sorry, it's a screenshot, I tried pasting the code, but I get connection error every time.)

Attached: PS-screenshot.png (906x384, 26K)

>being this jealous

oh, does the uni stand for unix?

what algorithm did you use?

Originally yes, it's POSIX standard now.

Look in MSDN for the functions you're trying to use, should tell you which header to #include.

>I typo'd
bruh.

Thank you, though! You've saved me a mild headache today!

>connection error
DESU, I think it's Jow Forums's spam filter kicking in. I've had similar issues when uploading ruby code.

dont use recursion for pathfinding you silly sod

your bracket style is disgusting

I already fixed the issue, was just curious.

>2019
>you still have to write header guards

>#pragma once

protip you can rewrite any recursive function as an iterative depth-first traversal of a tree of fake stack frames

thanks

it seemed like the easiest solution, but looking at the code again it turns out i just needed one goto to solve it without recursion.

no idea what it's called i have the most fun figuring stuff out myself so i dont look it up.
i search for open spaces, or spaces with a higher number of moves, and save the number of moves i need to get there in it. when i reach the goal is just go backwards taking the field with the next lowest number. this should get me the shortest path.

#pragma once is supported by every compiler worth using.

Looking into Clojure libraries to implement a fully async high performance http client.
Going to write some mocks and stress testing

The press challenge from the previous thread:

>

I _think_ I handle 0's correctly. Hard to be sure, it's not specified very well.

pastebin.com/kuS34Bi0

>#include
what

>be self taught but aware of avg cs course cirriculum
>talking to retard cs semi dropout who assumes superior programming ability and knowledge
>ask what classes he's taken
>java, hurr durr, hurr (basically just java 1-3)
>I say something like "oh so you haven't taken any algorithms courses yet or anything"
>he replies with "lol dude.. it's basically all algorithms" in a condescending manner like i'm the retard

it happened awhile ago but i still think about it

>i still think about it
He probably doesn't. What does that say?

you won't get decent perf diffs unless you fork the runtime into using a high perf async IO C lib and make heavy use of that in your standard class lib implementation
It's retarded but that's just how it is on the jvm.

people can be shitty.

just focus on what you can do to improve your life. ignore toxic people. you'll be fine user.

I still think about a lot more pathetic things, you're still in the safe zone user

I'm running into some weird issues with mocking.
Is the -Wl,--wrap= option to the ld linker supported on Mac OS X?

Attached: Screen Shot 2019-07-19 at 1.58.03 PM.png (1882x1544, 529K)

The JVMs NIO is good enough for me at the moment, the challenge is is making sure the http client is completely non blocking at evety step, there are libraries using nio already, but you can still fuck it up.
Aiming at maximal throughput.
But I'm autistic enough to fork the runtime

I tried the cell phone keyboard challenge, but I hit a wall and cannot figure out how to continue from here. Currently the program just converts single numbers into characters 'a', 'd', 'g', 'j', 'm', 'p', 't', 'w'. It cannot handle repeated digits such as "22333".
The language is Fortran, because I just like it

program cellphone_keyboard
implicit none
integer, parameter :: maxLength = 100
integer, parameter :: keyCodeLength = 4
character (len=keyCodeLength), parameter, dimension(12) :: keyCodes = &
(/ ' ', 'abc ', 'def ', 'ghi ', 'jkl ', 'mno ', 'pqrs', 'tuv ', 'wxyz', '^ ', '+ ', '., ' /)

character (len=maxLength) :: inputBuffer
character (len=maxLength) :: outputText

outputText = ''

print '(a)', 'Enter key codes: '
read (unit=*, fmt='(a)') inputBuffer

outputText = press(inputBuffer)
print '(a, a)', 'outputText: ', trim(outputText)

contains

character (len=maxLength) pure function press(input)
implicit none
character (len=*), intent(in) :: input

character :: currentChar
integer :: i, j, inputLength, currentCharInt
character (len=maxLength) :: scratchString

scratchString = ''
inputLength = len_trim(input)
j = 1

do i = 1, inputLength
currentChar = input(i:i)
read (unit=currentChar, fmt='(i2)') currentCharInt

if (currentChar /= ' ') then
scratchString(j:j) = keyCodes(currentCharInt)(1:1)
j = j + 1
end if

end do

press = scratchString
end function

end program

Dumbass.
man7.org/linux/man-pages/man3/err.3.html

>a.c:1:17: fatal error: err.h: No such file or directory

kys

There's a small memory leak when malloc fails.

This is the fixed version:
int
get_press_info(const char *string, struct press_info **press_info)
{
struct press_info start = {0};
struct press_info *it = &start;
int err = 0;

while (*string) {
it->pi_next = malloc(sizeof(struct press_info));
if (!it->pi_next) {
err = -1;
break;
}

it = it->pi_next;
it->pi_button = *string;
it->pi_count = 0;
it->pi_next = NULL;

while (*string == it->pi_button) {
string++;
it->pi_count++;
}
}

*press_info = start.pi_next;
return err;
}

check ld --version
--wrap is GNU ld only afaik
maybe this helps you: stackoverflow.com/questions/31476632/what-is-the-equivalent-of-gnus-wrap-linker-flag-in-os-x-linker

I'm learning Kotlin and I think I may actually be retarded, because I can't wrap my head around higher-order functions. Any good resources for learning this shit? The official documentation isn't helping much

what part of it do you not get?

what is the problem? they are just functions except you can pass them around and assign them to variables

blog.mindorks.com/understanding-higher-order-functions-and-lambdas-in-kotlin

JavaScript is the most powerful programming language.

well at least Lisp > C++

correct

you can make anything with it

Attached: 1563571322.5099726_-_b55eb43c485267a1fa878b1f24dba3ca.jpg (512x512, 28K)

except dignity

npmjs.com/package/dignity

?

including system drivers, performant and small binaries, and arm-desktop programs?

>tfw programmer but studying mgmt in business school
>get to meme "real" uni programmers twice

Of course just compile to C

alias vim="emacs -nw"

What did you say?

Attached: 1563346891807.jpg (999x1446, 126K)

oh, new thread already?
I'm showing some guy on /sci/ a python routine to generate all the words for a given alphabet

youtu.be/0HtZclfnnQw

def make_words(chars):
words = [[]]
while True:
words = [word + [char] for word in words for char in chars]
# exit here in some way if you like


Basically this with some sugar
Now I want to do some more with sets, maybe in Haskell, maybe on AVL trees discussed here yesterday.

Attached: consum.jpg (698x465, 261K)

best ide for ruby on linux?
rubymine is great but it's paid

val identity_lambda : (Int) -> Int = { value -> value }

Wonder what made the Kotlin guys think the brackets around the input type are helpful

Attached: dogsha.jpg (726x733, 305K)

>using a paid, bloated, and botnet ide for ruby scripting
nigger just use a text editor like vscodium or emacs

What types of programming questions would you ask someone interviewing for an entry level software developer job?

>t. I dislike integrated debugger, autocompletion and 100 other features

Depends on the job and language.
Something with pointers and deleting stuff?

Attached: Scott Wlaschin.jpg (1000x734, 97K)

I think it makes sense when you can have functions of arity > 1

Like C#, C++, Java, SQL, etc.

as if it's not possible without the jetbrains botnet

What's the actual purpose of using pointers in cpp?
What's the advantage of them over references?