[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


One more week until /g/ is actually fun and interesting for a brief moment.
>>
ETA - 7 days 23:26:14
>>
File: 1504828724874.jpg (280 KB, 741x571)
280 KB
280 KB JPG
what language is everyone using?
>>
where do people who like saying nigger and posting anime girls but now actually know how to code hang out?

this place is a cesspool :(
>>
>>103275276
nigger
>>
File: bruh.png (25 KB, 741x197)
25 KB
25 KB PNG
>>103275756
>>103275758
>>
>>103275750
C++
>>
>>103275750
python just werks for these kind of problem
>>
>>103275750
Will try using Rust, then probably give up and switch to Python, then just give up entirely
>>
>>103275750
Rust. I used it last year and used Go the year before.
>>
File: cheatsheetv1.3-1920x1080.png (346 KB, 1920x1080)
346 KB
346 KB PNG
>>103275750
ARM ASM.
>>
>>103275750
Rust
When i have time I'll also redo it in zig cause I'm curious if it's decent or if g is full of contrarians
>>
>>103275750
chatgpt
>>
>>103275750
C++ and Haskell
>>
>>103276103
How do you handle file IO when using assembly? Do you just use stdin?
>>
>>103276350
File IO? I just attach the input to the ROM.
>>
>>103276350
>How do you handle file IO when using assembly?
system calls
>>
>>103275276
>paganism
Not even once
>>
>>103275750
I do not know C but I think I will try to learn it by doing as much of this as I can in C and then maybe fallback to something else if I can't. But I feel like practical usage of a language is the best way to learn it so this should be fun
>>
>>103275750
I'll just use python. I'll never code for a living so I don't need more
>>
>>103275750
python for initial solution then rewrite it in rust. did the same for c++ and go the previous 2 years
>>
sometimes, i just hide the whole entire catalog because it's such shit and wait to see what pops up like an hour later. usually, it's just more shit.
>>
copy and paste on a notepad++
>>
Last year I had to stop because I got covid and couldn't get myself motivated again to resume after I recovered. How do I stay motivated this year?
>>
>>103275756
they got jobs and post in "professional" discords
>>
File: aoc2-1asm.png (245 KB, 1080x1920)
245 KB
245 KB PNG
>>103276350
I did about half a dozen puzzles in assembly and used either STDIN or Linux's openat syscall:
https://man7.org/linux/man-pages/man2/openat.2.html
>>
>>103277221
for your kind there's https://hanukkah.bluebird.sh/5784/
now leave us in peace
>>
>>103277270
it makes no sense to use c for aoc. c is awful for parsing and you have no easy access to dynamically allocated data structures
>>
Love the idea of AoC but after doing it for three years, I'm bored with text parsing into data structures. Wish there was something similar to AoC but with more variety. I've seen a few other challenge of the day type events but they're even more narrowly focused than AoC.
>>
>>103278971
>Advent of Code
>Hanukkah of Data
What's next? Twelve Days of Numerical Analysis? Ramadan of Reverse Engineering?
>>
>>103279075
>tranny case
>tranny opinion
>>
>>103279578
Diwali of Frivolous Pull Requests
>>
>>103279578
Saturnalia of SQL
>>
>>103279578
Yule of YACC
>>
they made the puzzles more difficult after LLMs. It's a lot less fun and just feels like work
>>
I'll go with javascript like last year.
or maybe with typescript, I don't know
>>
>>103280156
It was that and absolutely no room for optimization. Previous years had more opportunity for finding approaches to solve the problems whereas last year was "this algorithm is objectively the best way to solve it"
>>
File: 1712578084145241.jpg (408 KB, 1920x3532)
408 KB
408 KB JPG
>>103275750
I shall be using Standard ML.
>>
planning to do it with my own language this year
the parsing parts might be hard - file I/O, reading by line, splitting, scanf, strings. I don't have them implemented yet.
>>
>>103279075
>you have no easy access to dynamically allocated data structures
#define STB_DS_IMPLEMENTATION
#include "stb_ds.h"
#define ARRAY(x) x
#define HMAP(x)
#define SHMAP(x)

whoah that was hard
>>
>>103275750
same as last year, Rust :v
last year was actually where I finally first enjoyed using rust and felt like i "got" it...
>>
File: BIGBOY.png (48 KB, 1204x195)
48 KB
48 KB PNG
>>103275750
Refal-5 until I hit the first hard question and switch to Python
>>
>>103281428
your deque, your heap/priority queue?
>>
>>103281827
<50 lines of code
any undergrad can do it his eyes closed
>>
File: 1725773374970683.webm (317 KB, 320x240)
317 KB
317 KB WEBM
>>103275750
Scheme probably cause I've just finished watching the 6.0001 series from 1986 and really want to use it more, probably I'll regret it.
>>
>>103275276
one more week until it inevitably gets derailed by obnoxious attention seekers
>>
>>103275750
Haskell. If you don't write your solutions using monadic lazy evaluated solutions you're literally a code monkey
>>
>>103275750
Javascript. I'd rather use Go or Python but I'm starting to look for jobs and based on the postings I think I might have to take the webshitter pill.
>>
>>103275276
For me, it's the end of NNN.
>>
>>103275750 rust
>>
>>103275750
Swift
>>
>>103275750
I'm learning Kotlin now, so probably that.
>>
File: 1732010909013173.jpg (1.65 MB, 1432x1840)
1.65 MB
1.65 MB JPG
>>103275750
Typescript, because I need a job soon.
>>
>>103284275
advent of typescript exists too
>>
>>103275750
Working on a personal website right now, so HTML, CSS, and a sparse amount of JavaScript.
>>
>>103275750
Maybe Squirrel, for fun
>>
>>103275750
I will use Haskell for the first 6 days and then be filtered on day 7 and quit
>>
>>103275750
C++ for leaderboard autism, then again probably in Elixir if I have time.
>>
Last year I used Nim for the first ten days or so before I got fed up and just used python. The year before, I tried Clojure, but lasted only a few days. I think this year I will try Swift.
>>
>>103278425
do it for your waifu
>>
>>103278425
>oh no i have a mild coof i cant code
ngmi
>>
Common Lisp
>>
>>103279578
Lent of Lexical Text Parsing
>>
>>103275750
Elixir. I was going to learn Rust specifically for this but ran out of time due to having a mental breakdown and being lazy.

Maybe I'll learn as I go
>>
File: 1708102692062883.jpg (42 KB, 420x512)
42 KB
42 KB JPG
You do have all 450 stars, r-right anonymous?
>>
>>103288182
Lol
>>
>>103279578
>>
File: 1475261809016.png (99 KB, 288x405)
99 KB
99 KB PNG
>code gives correct solution for sample input
>gives incorrect solution for actual input
reee
>>
test run 999

all tests passed

based
>>
>>103288405
>advent of reading comprehension
>>
>>103275750
I will use Python, I will complete every day without cheating, and and I will make the leaderboard on at least a few days
Memelangs are cope
>>
>>103288489
cheating?
how do you cheat in advent of code? using AI?
>>
>>103288717
Copypaste solutions.
>>
>>103288717
copying other people's solutions
>>
>>103288779
>>103288824
that's not really cheating
that's how programming in the real world works
>>
>>103287798
It wasn't a mild coof, I had a high fever for a week.
>>
>>103288839
This isn't the real world.
We are writing solutions to silly little problems that don't really reflect real world applications.
>>
>>103275750
I usually use python but this year I might try C++23
>>
>>103288933
Does have C++23 better string parsing? I tried C++17 last year and the main challenge was string handling.
>>
>>103288899
Don't call helping Santa save christmas silly!
>>
>>103288977
This. Show some respect.
>>
>>103275276
didn't knew there were so many parsing enthusiasts in /g/. Gotta see how this time's advent of parsing will be.
>>
File: intcode_odin.png (819 KB, 898x4060)
819 KB
819 KB PNG
>>103275750
Trying out Odin
>>
>>103275750
Got a free currybook at work, so I'll try Swift this time, so far it's been quite comfy
>>
>>103275276
I tried to make a general on C and ASM but no one got interested.
Found neat sources and material too
>>
File: poke brats.jpg (363 KB, 2048x1210)
363 KB
363 KB JPG
>>103275750
I'll try with Go even though Im a beginner at it (learning as I go, hehe)
Might also do Advent of Typescript just to strengthen my skill at it.
>>
File: day_4_2022.png (561 KB, 1372x3030)
561 KB
561 KB PNG
>>103289277
ODINBROS
WE ARE SO BACK
>>
File: img-2024-11-24-16-25-15.png (170 KB, 2108x904)
170 KB
170 KB PNG
>>103290603
should've used idiomatic Rust
>>
debating whether to do it in c# or c++ this year..
c++ has been my goto for years, and i like how much control it allows me to have. I can optimize every single computation in the solver, which is part of the fun...
on the other hand i've recently taken to learning c# and i honestly do like it for higher level development. I'd probably learn more if u use c# this year, but it would also make it less satisfying as i cant care about optimization as much
>>
>>103290674
i normally use rust but might do c# as well to brush up and learn the new things added. i tried f# one year but that ended up not great. some anons had nice solutions the past year or two with it but it wasn't for me outside of aoc
>>
File: faggot_2.jpg (91 KB, 779x781)
91 KB
91 KB JPG
>>103290672
I’m not a troon
>>
>>103291062
egg
>>
>>103289277
>>103290603
noice!!
>>
>>103290672
Behold, the insanity of FP.
How many methods one has to memorize to be proficient in FP?
>split_terminator
>map
>array_chunks
>fold
Disgusting.

Also disgusting the fact of casting a bool to a u32. FP is a one awful abstraction.
>>
>>103291480
brainlet filtered
>>
>>103291480
peak cnile moment
>casting a bool to a u32
a bool is just a 1 bit unsigned integer. casting it to a wider integer is just fine, dumb retard
>>
File: Untitled.png (1.37 MB, 491x10000)
1.37 MB
1.37 MB PNG
>>103291480
>How many methods one has to memorize to be proficient in FP?
This is the absolute minimum. Keep in mind that Rust isn't even an FP language.
https://github.com/rust-lang/rust/pull/61505
>The size of the Iterator doc page is reduced from 14.4MB (latest nightly) to 724kB.
>>
>>103291480
WTF bros how are you supposed to remember FOUR functions that you use almost every day for 25 days???????? Madness
>>
ETA - 6 days 11:42:11
>>
shit forgot to ntpdate, close enough
>>
File: 1715371517907.jpg (5 KB, 250x250)
5 KB
5 KB JPG
where can i learn how to prepare properly for this? i dont want to fall behind and get locked out
i dont have a main language like everyone else but i can code mediocre code in most c like languages, currently studying c#
>>
>>103291786
try a previous year to get an idea of what the challenges are like. you can't practice for competitive programming tasks without doing them, then fill in your gaps of knowledge

you probably can't do this in c at all. the higher level the language, the better. something like c# is a better choice, python and js are very popular
>>
>>103291803
i did a few days from 2022 and 2023, last year i got filtered by having to do lookups in
[ 0 ] [ 0 ] [ 0 ]
[ 0 ] [ 0 ] [ 0 ]
[ 0 ] [ 0 ] [ 0 ]
a 3x3 square or bigger and i could see how to do it in a impaired programming way but it was cumbersome so i kinda forgot about it
>>
>>103291853
incomprehensible post
>>
>>103291853
2d arrays are a very early foundational thing you should have a grasp of. you need to study the basics, not worry about aoc
>>
File: weird.jpg (44 KB, 1024x440)
44 KB
44 KB JPG
>>103291541
Hoooolyyyyy
>>
>>103291786
Make sure you remember how to do all of:
breadth-first search/Dijkstra's algorithm
dynamic programming/memoization
coordinate compression
implementing virtual machines/reverse engineering assembly
optimization (I think they've all been linear)
cellular automata
parsing
modular arithmetic/solving linear congruences
>>
File: pepe_smoke.jpg (112 KB, 1194x1200)
112 KB
112 KB JPG
>>103291541
>Keep in mind that Rust isn't even an FP language
And every FP language has slightly different names for the same functions. While procedure chads use the same word: FOR.
Procedurebros, we can’t stop winning!
>>
>>103291919
i know what a 2d array
my approach was to go linearly and just try:catch index+1/-1 in a cross, and if i go out of bounds i just pass the error, but i dont think that's how you're supposed to solve it
>>
>>103291516
I think it's 1 byte, wherein 7 bits are just filler. But yes.
>>
File: file.png (35 KB, 46x952)
35 KB
35 KB PNG
>>103291541
These are the only functions
>>
>>103290672
If you want terse syntax, you should’ve just gone with Python. Top AoC solvers in the leader board use Python.
>>
>>103291974
>>103291541
>>103291480
is that really the difference between procedural programming and functional programming? i always thought it was much more? like some fundamental difference in how you approach problems

but its literally just
for(thing : things.split()){ otherThing = transform(thing); otherThing.Something(); }
 
vs
split().transform().something();?
>>
>>103292030
>procedural programming
>functional programming
define those terms
>>
>>103292050
idk i cant i never knew what functional programming really meant. Just know people call regular programming procedural.

But from the way you guys are talking it seems all "functional programming" amounts to is a API design
>>
>>103292030
yes, it's literally just applying and composing functions
>>
>>103292050
in one you program with functions
and in the other with procedures
>>
>>103292087
so isn't every programming language a functional programming language?
>>
>>103292108
c is not a functional programming language

many modern languages have aspects of fp but aren't traditionally thought of as fp. it's a blurry line between the two because even haskell can be written imperatively/procedurally (when you want to do anything useful lmao)
>>
>>103292030
Yes, just pipes and creating new arrays/lists (garbage) instead of reusing old ones because muh immutability.
>>
>>103292147
>new arrays/lists (garbage)
retard who only knows javascript spotted
>>
File: pepe_keks.png (741 KB, 798x770)
741 KB
741 KB PNG
>>103292151
https://wiki.haskell.org/GHC/Memory_Management
>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages.
>>
File: hum.jpg (63 KB, 941x941)
63 KB
63 KB JPG
>>103292151
JavaScript/Lisp/FP they are all quite similar, and have common inspirations.
>>
File: Giga_Chad.png (708 KB, 664x846)
708 KB
708 KB PNG
>>103276283
t.
>>
>>103292171
yes, haskell has its own issues especially with regards to laziness and is a case study in how not to do it. a lot of other languages optimize streaming/functional apis to that of loop iteration code
>>
>>103279075
>c is awful for parsing
fscanf is very flexible
> no dynamically allocated data structures
aoc generally doesn't require those
at most you need an array to cache results
>>
>>103292228
>aoc generally doesn't require those
this is a bait
just google Advent of Code in C and you'll see hundreds of people saying to not bother to use C cause it's just a waste of your time
>>
>>103292186
Lisp isn't a functional programming language
>>
>>103292314
>waste of your time
Advent of Code itself is a (fun) waste of time.
There are people doing it in assembler or excel. I don't see how c can be too burdensome for some meme puzzle event, unless you're trying to hit the global leaderboard.
>>
>>103292362
It has lambdas, and a cult following
>>
>>103292394
so use brainfuck instead of c, it's all just a waste of time xD
>>
File: Screenshot_21.png (252 KB, 773x653)
252 KB
252 KB PNG
>>103290672
>he really did the meme
https://x.com/void_zero2/status/1860114650593132728
>>
>>103292757
>two loops vs one
functional wins again
>>
>>103292757
No one knows what """"meme"""" you're referencing
>>
>>103292790
I know it
>>
>arrays.aslist 1 2 3 4 5 6 7 8 9 0
>[]int 1 2 3 4 5 6 7 8 9
bros, your magic number generator suck,
>>
>>103292757
in Rust this is just
println!("Squared Even Numbers: {:?}" ,(0..=10).filter(|i| i % 2 == 0).map(|i| i * i).collect::<Vec<_>>()
>>
File: Screenshot_22.png (50 KB, 772x284)
50 KB
50 KB PNG
>>103292883
>>
>>103292883
that's a lot of boilerplate just to say
print("Squared Even Numbers:", [x**2 for x in range(11) if x % 2 == 0])
>>
>>103293046
>x**2
ugly
>>
>>103293046
i hate list comprehensions so much it's unreal
>>
[x*x for x in range(0, 11, 2)]
>>
>>103275276
I don't know much about data structures or algorithms. Would this be a good exercise for me or is it too hard?
>>
>>103293212
already filtered
>>
>>103293212
yes treat it as a learning experience
>>
>>103293212
You don't need to know too many data structures or algorithms, but if you don't know them beforehand, you won't get past day 5. AoC is good for practice, but not for learning.
>>
>>103293240
>AoC is good for practice, but not for learning.
disagree
>>
>>103293046
nums = np.arange(1,11)
nums[nums%2==0]**2
>>
>>103293212
no, you're better off going through leetcode to get a footing. you actually need a solid amount of first/second year cs theory and application
>>
>>103275756
They used to be in the coomer generals but those are banned now.
>>
File: 1729365389405599.png (153 KB, 342x403)
153 KB
153 KB PNG
>>103275276
I filter all these annoying threads.
>>103275758
I concur.
>>
>>103293439
Sounds like you are the one who is filtered.
>>
>>103292228
You'll spend the vast majority of your time on recreating basic data structures and algorithms instead of solving the actual problems
>>
>>103293529
that's the fun part
if I didn't want to have fun, I'd do it in python
>>
File: math.png (10 KB, 456x142)
10 KB
10 KB PNG
>>103293129
Filtered by mathematics
>>
File: 1703752508107282.jpg (41 KB, 512x564)
41 KB
41 KB JPG
>>103293528
Good one. I just don't get how people don't get tired of this shit after a decade.
>>
>>103293604
how do you tell the computer to interpret that?
>>
>>103293604
Curious how the order is not the same at all, precisely my issue with comprehensions being retarded
>>
>>103293599
Haven't you done all that multiple times already? How is writing a bunch of boilerplate that requires zero thought fun?
>>
File: fpeepee.png (379 KB, 731x887)
379 KB
379 KB PNG
>>103290672
>>
>>103291480
We really need to permaban students and Indians
>>
>>103293707
How is this not trolling LOL
>heh... all you need is MOV and JNE kid..... get gud
>>
>>103293924
Only students use FP because they don’t ship anything
>>
>>103275276
>glorified reddit tier leetcode bullshit
>fun and interesting
>>
>>103293942
>>heh... all you need is MOV and JNE kid..... get gud
So trve. This is why `for` is such a good abstraction.
>>
>>103293944
Everyone can tell that you're projecting. Disgusting.
>>
>>103293988
Golang’s job market alone is probably bigger than all FP languages’s combined.
>>
>>103294208
C# and to a lesser extent java have both created FP libraries and at least in C# world are the default way of programming now. Discord is written mostly in rust and elixir (they dumped Go after trying it).

And did you forget about Javascript? It sucks but it's fp. And SQL is more like FP than not.

The day of the monad is coming.
>>
>>103294257
are you talking about linq or F#
>>
>>103294298
Linq. F# is ok but it's dead. The kind of people who use C# and like corpoware generally aren't excited about ML family languages
>>
>>103294309
>aren't excited about ML family languages
they've gobbled up tons of ML things from F#
>>
>>103294314
I know but the syntax and "branding" is totally different
>>
>>103294309
linq is indeed nice
>>
>>103294257
It’s very obvious that you have never seen production code.
>>
>>103294368
Why is that, because I have standards and you can't ship anything without creating horrible spaghetti dogshit?
>>
>>103275750
lua
>>
>>103292362
it was at the beginning
>(defun eval (expr env) ...
>>
File: 1720030123404.png (213 KB, 716x641)
213 KB
213 KB PNG
i dont want to fall for the cnile bait
how do you even solve the problems in C when you need to use maps, dynamic arrays, buffers?
do you just do char buffer[2147483647] ?
>>
>>103294550
Cniles on /g/ generally don't actually write code. It's just a cargo cult for low IQ students.
>>
>>103294550
you implement them it's not rocket science, retard
Protip: you do it once and you copy paste the files in your current project
you can copy paste, can you?
>>
>>103294550
yes, really big arrays then they get filtered by runtime or memory requirements in part 2
>>
>>103294571
>>103294613
>>103294639
// Helper function to read entire file content
// Returns a buffer pointer.
char* read_file_to_buffer(const char* filename) {
FILE* file;
char* buffer;
long file_size;

// Open the file using fopen_s for safety
errno_t err = fopen_s(&file, filename, "r");
if (err != 0 || file == NULL) {
perror("Error opening file");
return NULL;
}

// Determine file size
fseek(file, 0, SEEK_END);
file_size = ftell(file);
rewind(file);

// Allocate buffer and read file content
buffer = (char*)malloc(file_size + 1); // +1 for null terminator
if (buffer == NULL) {
perror("Error allocating memory");
fclose(file);
return NULL;
}

fread(buffer, 1, file_size, file);
buffer[file_size] = '\0'; // Null-terminate the string

fclose(file);
return buffer;
}

is this enough to just read the file including the \n inside a buffer
then i just write a loop to check if char == \n and process each line if i need to?
code was generated by chatgpt because i never worked with files in C so i wouldnt know
>>
>>103275756
I'm still here from running the old cyberpunk radio station days.
>>
>>103294686
int main(void) {
const char* filename = "test.txt";
char* data = read_file_to_buffer(filename);

int sum = 0;
while (*data != '\0') {
if (isdigit(*data)) {
char tmp = *data;
sum += tmp - '0';
}
data++;
}
printf("sum: %d\n", sum);

return EXIT_SUCCESS;
}

for example like this, this will sum all the digits, this shit is too tedious, how do people even write more complicated shit?
>>
>>103294686
>rewind(file);
el oh el
Rewinding a file. Kek.
>>
>>103294795
don't reply to someone spamming ai shit
>>
>>103294613
Why are make libraries yourself?
>>
>>103275276
Last year was a drag for me, I thought I was done doing these after so many years but I'm kinda feeling it right now... FUCK
>>
File: Screenshot_23.png (319 KB, 777x590)
319 KB
319 KB PNG
>>103294421
Get a job, nigga
>>
>>103292147
>>103292171
>pipes and creating new arrays/lists (garbage) instead of reusing old ones
educate yourself on persistent data structures
https://youtube.com/watch?v=SiFwRtCnxv4&t=7m35s
>>
>>103275756
literally Blind
>>
>>103294903
>make libraries
otherwise known as programming
gee, why would you use a programming language to program?
>>
Where is my idiomatic rust user?
How do I make a const array of all permutations for https://adventofcode.com/2015/day/21 ?
I just used zsh to do it and then included the output into my script.
>>
>>103293212
Don't listen to those fags, i've done 2 years and i have no cs degree and never finished a programming book.
You'll probably need to google a pathfinding algorithm tho.
>>
>>103294208
JavaScript alone has a bigger job market than Go
>>
>>103296005
how the hell is javascript fp
>>
>>103296192
map, filter, reduce, closures
>>
>>103296225
this enrages the FP cultist
>>
>>103296192
Because it's an absolute dumpster fire. OP is right, JS is peak FP.
>>
>>103275276
>letting others control your life
N
>>
>>103275276
threads have been shit since covid desu
>>
>>103275750
learning clojure with a friend



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.