Old thread: Lisp is the most powerful programming language.
What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
github.com
github.com
github.com
rbcs-us.com
pyret.org
pastebin.com
man7.org
stackoverflow.com
blog.mindorks.com
npmjs.com
youtu.be
twitter.com
>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!
Just started my MtF transition. Wish me luck, /dpt/!
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
>>/lgbt/
>langwar bait in the OP is now normal
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.
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.
I'm writing an interpreter for my own scripting language:
I guess that's the only way to post code for now
>lambda@DN0a23822
what
rbcs-us.com
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
University-given hostname. Lambda's just the name of my computer.
check out pyret.org
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.
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.
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
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.)
>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.
>#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?
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
>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
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
JavaScript is the most powerful programming language.
well at least Lisp > C++
correct
you can make anything with it
except 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?
oh, new thread already?
I'm showing some guy on /sci/ a python routine to generate all the words for a given alphabet
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.
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
>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?
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?