Previous thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Going to write a language in Haskell
nothing :
; chess.sat - chessboard in saturn
; alternate ' ' and '#' to make chess tiles
; board is a square of size SIZExSIZE
main:
int SIZE, 8
int r, 0
int c, 0
int mod_result
int check_result, 0
col_loop:
cmp c, SIZE
jeq exit
row_loop:
cmp r, SIZE
jeq nextline
mov mod_result, r
mod mod_result, 2
cmp mod_result, check_result
jeq print_space
out stdout, '#'
jmp after_space
print_space:
out stdout, ' '
after_space:
inc r
jmp row_loop
nextline:
inc c
out stdout, newline
mov r, 0
cmp check_result, 0
jeq set_cr_1
jne set_cr_0
set_cr_1:
mov check_result, 1
jmp col_loop
set_cr_0:
mov check_result, 0
jmp col_loop
exit:
Probably the hardest thing I've done with this.
Outputs for 8 and then 10:
λ saturn chess.sat
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
λ vim chess.sat
λ saturn chess.sat
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
Whoops!
Looks like you forgot to use an anime image in the OP!
In fact, the OP image you've chosen has little to do with programming or Sup Forums!
Don't worry, everyone makes mistakes on their first day.
I'll help you by providing you with your very own programming-related anime image.
Feel free to save it!
Don't forget to collect more!
- /dpt/
nice, care to describe it in some more detail?
Missed copying the last line on the output for 10, don't worry it works
Haven't started yet
Will likely be pure and dependently typed but with primitives and without a proof checker
this seems assembly tier
almost, but not quite
could probably very easily be converted to assembly
esoteric one?
is the language fast though?
Blimey.. Saturn is back!
Hell no.
It's written in C but it's probably slower than Python for this.
im still kind of scared of implementing dependent typing. i've cut back some features from my own languages to make type checking/type inference easier. have you ever tried implementing dependent types?
what happened to julia guys
I wanted to learn it, but it seems like its faded into nothing these days
I've only ever heard of it as "unnecessary" and "easily beat by competitors"
no but there are a few tutorials out there
nice, any good links for me to check out?
It got squished between R, python and Jupyter. While data science is fascinating, it's not big enough to maintain 3 competing languages (not even counting the normie-tier SPSS and the like)
Trying to link but Sup Forums keeps saying my post is spam
augustss.blog
spot.co.uk/2007/10/simpl
er-easier-in-recent-paper-sim
ply.html
math.andrej.com
for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
if ((i ^ j) & 1)
putchar('#');
else
putchar(' ');
}
putchar('\n');
}
What's currently the best solution for making GUIs that aren't ugly as fuck in Java?
>SPSS
Why do people use this garbage? R is easy enough even a normie could use it.
oh wow that's pretty awesome, thanks user. keep us updated on your language please
int i = 0, j = 0;
while (++i
X-Posting sorry
It's unique_ptr
I'll X-post this for you then:
>different type of pattern matching, they don't refer to the same thing at all
It still is pattern matching. The answer to "guys, does javascript have pattern matching?" is yes. Think about what you write.
>are you trying to tell me that Go and Fortran are functional languages?
I'm trying to tell you they have functional programming features.
I'm going to controversially agree with Regex IS a kind of pattern matching, and can (mostly) be generalised to all lists
just saw it in the other thread.
the question was clearly asked in a specific context, I was answering based on that. that's like someone saying
>I really like functors in SML, does Haskell have functors?
and then answering yes because there's an entirely different concept called a functor, even though that's not what they mean in the question.
closures predate functional programming and come from imperative languages, hence I would not consider them a functional programming feature.
I guess so, but for that comparison to make sense you'd have to show that JavaScript can generalize regexes (which it can't afaik)
It still pattern matches strings
Someone gave a correct answer to the question and you corrected him with your meaningless "pattern matching ≠ regexes" remark.
in fact this is exactly what Parsec does
(and Parser monads in general)
x* = many x
x+ = many1 x
capturing a group - >>=
not capturing: *>
for instance,
x+ is x(x*)
-- do notation
do
a
size = take 8
board = iterate tail (cycle " #")
main = (mapM_ putStrLn . map size . size) board
Clueless computer science major here
How late is it to start a portfolio? I'll be a junior this fall and I basically have no personal projects for an internship next summer. If I start now will recruiters be like "ha gotcha you lazy fuck" when I eventually apply a few months from now?
>in saturn
Is this something you made yourself?
Just upload it to GitHub at once, then tell them you previously had it stored locally
POST YOUR PREFERRED METHOD OF MULTI LINE COMMENTS OR THIS CROW WILL FUCK YOUR SHIT UP
danm, this solution is very elegant
yeah, finished it about a year ago
/*
* Loonix
* Colonel
* Style
*/
that's a kiwi u dum fuc
also
{-
- comments here
-}
/* This is a multi-line comment.
* As you can see, it spans multiple lines.
* It is useful for writing detailed comments.
* Poo in loo.
*/
does smaller binary size mean more efficient?
Of course not.
Not in all cases but smaller binary size for Linux kernel for example almost always means more efficient because more code fits into cache. Or at least so Linus claims.
No.
If it does the same exact thing, still no.
I'm a noob when it comes to hardware, but I'm 99% sure that something with a slightly larger binary could still be more efficient with something slightly smaller because of pipelining. (read: order matters)
/**
* This is example for style of commenting to be favored.
* It will be used for converting to javadoc files for the purpose of documenting as needful.
*
* @author Abhay Rajesh Patel
* @version 1.0.0.10.2
*/
>Rajesh
kekd
Switch to c#
none at all
#if 0
#yolo
#endif
/*
* This is a detailed multi-line comment about an algorithm or someshit.
*
* Kill yourself.
*/
/*
//stay
//mad
//fagets
*/
No more efficient means cpu usage and ram usage
damn, reposting my lame K code from dead thread
chess:{`0:,/x#((x#" #"),"\n";(x#"# "),"\n")}
chess@5
chess@7
it depends, it doesn't necessarily mean it's more efficient but it's very possible for it to be more efficient, like on older smartphone cpus you could even compile with -Os instead of -O3 and get both a smaller size and faster run time
one more:
: line ( f i -- ) 0 DO DUP I 1 AND = IF ." " ELSE ." #" THEN LOOP DROP 13 EMIT ;
: board ( x -- ) DUP 0 DO I 1 AND OVER line LOOP DROP ;
5 board
7 board
the entirety of Sup Forums is so fucking shitty, retarded and autistic
look at this shit, they don't even have any rational arguments for why corsair keyboards are shit, it's all emotional delusions . i'd sure as hell appreciate a better suggestion for a keyboard as long as it fits my programming needs, i don't want some gimped """"connoisseur"""" keyboard
You're always welcome to leave, fag.
>>>/q/
>dependently typed without a proof checker
What does that even mean? A proof checker is simply a type checker. What use is a typed language without a type checker?
i've only been here for a few days after leaving for weeks at a time, i may very well leave again
Sup Forums in various threads and /biz/ and probably all boards have really dense and vapid sperg shits
kill yourself
Nobody cares, fuckface.
How is whining in the programming thread going to fix anything?
def chess(size):
for j in range(size):
for i in range(size):
if i%2==j%2:
print(" ",end="")
else:
print("#",end="")
print("")
lmao wtf is this kona shit
seems cryptic
>5 section version string
For what purpose? I can only a use for three sections to indicate API breaking changes, feature additions and bug fixes.
It's more """art""".
open source version of K language:
en.wikipedia.org
modern descendant of APL
#Don't drop that Pickle-Pee
#Heeeeyyy
#Don't drop that Pump-a-Rum
?????
I see.
seems like a niche lang too
So I decided to learn x86 assembly by writing my own """kernel""".
I haven't felt this lost in a long time.
Been writing filters for a while now.
>niche
good paying niche tho unlike
shit's apparently hot among Wall Street folks who need to wrassle billions of data stat
what lang?
how do I get into images?
I think you're making this up
It's pretty cash if you can get in, just to clue in what kind of money we're talking about here: official developer license for K from Kx systems costs ~100 000$
the system itself that you buy for that heap of money is 26 Kb exe with text files and *.lic file
>what lang?
C#
>how do I get into images?
Well, I didn't exactly read much. Just sort of did it. The "grip it and rip it" approach, if you will.
What's a good 2d array like data structure in C++? I'm playing around writing a little game using ascii output, and I'm trying to work out what I should use to store the map.
At the moment I'm using std::vector tiles;, and then using tiles.push_back(std::vector()); to add each Tile after I've set it's values.
But I'm a pretty terrible C++ programmer, is there a better way to be doing this?
>100,000
danm
do you have such a job
tell me more
That vector will be HUGE. Use pointers to Tile (Tile*, std::shared_ptr or std::unique_ptr).
Yeah that's what I was really worried about. But what kind of size do you think that it would actually start being an issue at?
Why do people use IDE's? I believe they make people less meticulous. The same goes for most debuggers. Most languages and editors already include features for debugging. Vim is a hell of a lot better than any IDE I've used.
guys, I have no idea how to do this
It depends on sizeof(Tile). For example, in an old project I did, I used the same structure, for a roughly 500x500 map. My tiles take 64 bytes of memory (a pointer takes 8 on 64-bit). The 400th cell of the 400th row will be at an offset of ~10 MB, if I store raw pointers it will be at ~1 MB.
Actually, that's not so huge. Seeks through the vector will still be much faster.
anyone know what the font of this is?
What languages can you reliably access the source code of a program for and it isn't mangled by a compiler? I've heard virtual machine interpreted stuff like Java and C# it is possible, but is that it?
Why do people use """"text editors""""? I believe they make people less meticulous. The same goes for most terminals. Most languages and editors already include features for neckbearding. Notepad is a hell of a lot better than any """"text editors"""" I've used.
There are cases where you may want to lie
java and C# can still be optimized and obfuscated by e.g. proguard, and you can still decompile C/C++, just without most meaningful variable/function names and with things being rewritten (but functionally identical) compared to the original source code.
3/10 for making me respond
git gud
>you can still decompile C/C++, just without most meaningful variable/function names and with things being rewritten (but functionally identical) compared to the original source code.
Not if you program functionally and inline a lit
a lot*
anything the program does at run time, you can reverse engineer if you have it running on your system.
the program does everything at run time
user was talking about using pure functions and inlining things, but all that does is obscure how you generated some magic numbers and you can do it in java and C# as well, you can still reverse engineer what the program actually does with the magic numbers
Writing an exokernel for ARM64
anyone else addicted to assembly?
My Tile struct is very small, only 8 bytes, so it's not all that huuge. Just tested changing to pointers, and the code that generates the map went from 180ms to 124ms, so not really enough to bother about anyway, as it's only running once per load.
And even on a massive map, the rendering code was still fast enough for the sizes that it runs at anyway. Bigger problem is that I haven't implemented any kind of viewport yet, if I do that even a ridiculous map will render in a snap I think.
Yeah, in that case don't even bother. Rendering won't be bottlenecked by that vector ever.
As the old mantra goes: Never listen to /dpt/, and if you do, test the changes yourself.