[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Language

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 37

File: 1487820592296-1.gif (937KB, 500x357px) Image search: [Google]
1487820592296-1.gif
937KB, 500x357px
What are you working on, /g/?

Old thread: >>60341904
>>
>>60349876
First for right tool for the job
>>
>>60349911
This is objectively wrong.
>>
>>60349876
Lain is best daughteru.
>>
File: C vs C++ book.jpg (1MB, 2576x1932px) Image search: [Google]
C vs C++ book.jpg
1MB, 2576x1932px
>all of C: 274 pages
>most of C++11: 1324 pages

defend this
>>
File: 1485002137932.png (704KB, 2015x2204px) Image search: [Google]
1485002137932.png
704KB, 2015x2204px
(S n) for OOP is the wrong tool for every job
>>
>>60349920
Is it subjectively objective or objectively subjective or objectively objective and how can you tell the difference? If its objectively best for you does that make it subjectively objective for me or objectively subjective?
>>
>implying you guys actually program

You just shitpost all day.
>>
>>60349952
Defend what?
>>
>>60349952

language complexity > code complexity, because the standard is better than you.
>>
>>60349911
FPBP
>>
>>60349985
>the standard is better than you
Nope. I created the standard.
>>
>>60349969
No, I have a PhD in math 300k starting
>>
>>60350101
Nice /sci/ meme kid.
>>
13th for DY
>>
>>60350137
>meme
>>>/v/
>>
>>60349876
Messing around with Roslyn.
>>
>>60349876
Currently working on my shitty problem solving skills. I've always had issues with converting word problem into an algebraic format even though I never have a problem with algebra on its own.
>>
Begginer lispfag here.
I want something like...
[code
(setf (cdrn 5 list) nil)
; make cdddddr of list nil, like
[/code]
How would I do this?
>>
Is there some kind of compiler directive to allow GCC to build my program so it only uses 16 or 32 bit pointers?
>>
>>60350646

You target a 32 bit or 16 bit architecture.
>>
>>60350603
If you're not bothered by bad performance,

(defun all-but-last (xs)
(reverse (cdr (reverse xs))))
>>
the wolfram language is fucking garbage

>https://reference.wolfram.com/language/ref/NumberForm.html

with options->NumberFormat you can print numbers like 1.9e7 but they'll be like 32.e which is retarded and there is no apparent way to make it 1.9e7 but 32. or 32.e0
>>
>>60350603
>>60350712
How can anyone take lisp seriously when it goes ((())) all the time?
>>
File: 1482459435387.jpg (567KB, 595x842px) Image search: [Google]
1482459435387.jpg
567KB, 595x842px
>>60350712
Of course he isn't, he's using Lisp.
>>
>>60350762
Does it bothers you?
>>
>>60350712
Faggot, the (last) function exists.
>>
>>60350603
Use nthcdr.
>>
>>60350762
()'s make it extra cute.
prove me wrong, you can't, that's right.
>>
>>60350795
>>60350819
Wasn't lisp literally made by jews?
>>
>lisp chars are 42 bytes long.
>>
>>60350834
If it was, so?
>>
>>60350762
Why would that be a reason for treating it like the joke it is? Surely you understand that there are more valid reasons.
>>
>>60350834
Who cares, Jews have 110 IQ average, so anything they make is better by default.
>>
>>60349426
If you need to redesign your api every time you want to add a feature or change the UI, you should rethink your design to make it more extensible.
>>
>>60350762
this. even before the (((joos))) meme lisp was a ridiculous shit language. there's a reason why C-like languages won out historically even though lisp is old as shit.
>>
>>60350855
It looks very silly when a meme language is powered by echos.
>>
>>60350889
Fuck off, inane faggot.
Make useful posts and stop meming, nigger.
>>
>>60350888
Checked. But I'm going to use Lisp anyway.
>>
>>60350810
He doesn't want the last element.
>>
>>60350888
Lisp is faster than java, faggot.
>>
>>60350861
>110 IQ average
>average
>so anything they make is better by default

>>60350889
>meme
Oh, I see. Of course someone of your kind would find it "silly".
>>
>>60349962
No, see, there aren't actually all these combinations of things. There's subjective and objective, that's it. If something is objective for me, it's objective for you, no "subjectively" about it. That's what objective means.
>>
>>60350904
CLISP literally has a menora for the logo.

>>60350935
When a meme language is calling itself a jew language made by jews, it looks very silly indeed.
>>
>>60350889
>>60350965
>meme
>>>/v/
>>
>>60350866
thanks this is actually a great idea, which makes my old code look allthemore ridiculous in hindsight,

i do sometimes wonder how i manage to miss such obvious concepts
>>
>>60350965
>Lisp, a family of languages is defined by CLISP, an implementation of Common Lisp
Do you hear yourself?
>>
> nu-/g/ shits on Lisp

Lisp satori is life-affirming. Millennials must leave.
>>
>>60350977
>LISP isn't a meme
What did he mean by this?
>>
>>60350998
Meme magic is real my friend, even lisp must call out its jewry using the echo meme.
>>
>>60350998
>Lisp satori
Elaborate.
>>
>>60350998
t. took babbys first computer science class and baby duck syndroming lisp
>>
>>60350998
>He takes a language literally powered by memes seriously
Neo-/g/ everyone.
>>
Are hash tables really just a meme?

People bitch about tries like "a dur a dur it's a tree it's log n, muh hash tables iz constunt tim"

but actually, computing a hash for a variable-width key is linear in the size of the key

WELL GUESS FUCKING WHAT

looking up a variable-width key in a trie is ALSO linear in the size of the key, AND it never EVER!!!!!! suffers from unpredictable dips in performance due to long chain reactions of collisions and/or having to resize the table


AND FURTHERMOOOOORE!!!!!!!!!!!!!
shut the FUCJK up if ur one of the fagots hoo are like

>waaah muh cache, muh OOP baaad

you literally don't even have to store tries all over the place you can just stick the whole damn thing in an array EG FUCKING ZACTLY like you would with a binary heap except it's 256ary and not a heap
>>
How do I drop n elements from an array, efficiently, in Common Lisp.
My implementation converts it to a list, drops, and converts back, too inefficient desu.
>>
>>60351057
Fuck off we're bitching about Lisp
>>
>>60351019
>Meme
>>>/b/

>>60351048
>literally
>memes
>>>/v/

>>60351057
>meme
>muh
>dur
>waaah
>>>/r/abbit
>>
>>60351073
Fuck Lisp, functional programming is shit
>>
>>60351057
No, they're to association lists what vectors are to lists.
>>
>>60351073
I'm making fun of lisp, no wonder /g/ worships that fat jew stallman, it's full of them.
>>
is there any way to get a python script to open itself multiple times but each in a different time? (like first one is 0 minutes, next is 30, next is 60, etc)
>>
>>60351030
Becoming proficient in Lisp opens a new plane of existence, wherein you are at one with the machine.
>>
>>60351075
>>>>/v/
FUCK YOU VIDEO GAMES ARE AN ART FORM AND WILL CHANGE THE WORLD
(war games are shit though)
>>
>>60351096
How many levels of memery do I need to be to get (((lisp)))?
>>
>>60351076
t. imperative nigger
I bet you have point to your mouth to garbage collect in your obsolete languages.
This is why I use Lisp, which garbage collects and saves me from having an unfun time.
>>
>>60351104
The fuck are you on about, Ruby garbage collects just fine, isn't obsolete, isn't verbose or restrictive, and by the way Lisp is a poo
>>
>>60351104
>(defun ...)
lol
>>
>>60351125
Jews made it, it's far from a pajeet language.
>>
>>60351067
Look for adjust-array in the hyperspec.
>>
>>60351096
>new plane of existence
Elaborate. I need more details.
>>
>>60351134
Who said anything about a pajeet language? The word "poo" isn't copyrighted, you know. Lisp is a poo. Deal with it.
>>
>>60351156
(((lisp))) is merchant.
>>
>>60351156
Back to The_Donald, pleb.
Poo is synonymous with Pajeet.
>>
>>60351173
Merchant is a poo
>>
>>60351152
Does this work with strings?
>>
>>60349876
Hanami API
>>
>>60351175
>Back to The_Donald, pleb.
But Donald Trump is a poo.
>Poo is synonymous with Pajeet.
No. It's synonymous with Lisp and everyone who uses it
>>
>>60351205
I've never seen this meme.
You're just a hater.
I bet you use C or Ruby.
>>
>>60351100
most game developers kinda suck tho
>>
Why does /g/ loves (((lisp))) so much?
>>
>>60351199
Yes.
CL-USER> (adjust-array "hello" 4)
"hell"
>>
>>60351242

it's hipster
>>
>>60351242
Because it's esoteric and old and muh metaprogramming.
>>
>>60351221
>I've never seen this meme.
It's not a meme, it's a poo.
>You're just a hater.
It's fuck a yoo.
>I bet you use C or Ruby.
Both actually. They're great. So are C++ and Java, but Java least so. Lisp, Scheme, and Haskell are all a poo though. Python, Lua, and JavaScript are alright.
>>
>>60351257
>>60351262
But it's a bleeding meme, right down to the ((())) and nobody uses it anymore.
>>
>>60351225
Yeah, I know, 'cause they all busy making war games. Fuck war games, war games suck. They do nothing but reinforce America's excessively pro-war nationalist culture.
>>
>>60351266
>Python
>JavaScript
>alright
Opinion discarded.
>>
>>60351242
4channers love to be contrarian edgelords
>muh lisp
>muh haskell
>muh linux
>muh GPL
>>
>>60351292
Nationalism is good
>>
>>60351262
>>60351305
>muh
>>>/v/
>>
>>60351313
No memes, can you please ponder your situation?
You respond to posts with "meme" and suggest /v/.
A really sad situation. Change it please.
>>
Is JavaScript: The Good Parts still a recommended book to read?
>>
>>60351304
Fuck you, you're probably a dirty functional programming lover. Recursion is evil, stateful iterative programming is what computers are made for, right down to the serial physical structure of all computer memory.
>>
>>60351305
Lisp is a good language and can get you a very good paying job if you know what you're doing like COBOL.
>>
>>60351339
>JavaScript
>>>/g/wdg
>>
>>60351326
>memes
>>>/b/
>>
>>60351347
Iteration is linear recursion.
>>
>>60351347
implying proper compilers wont expand tail recursion into loop, no cost and you end up with elegant and easy to understand functions
>>
>>60351154
Imagine a programming language in which you can do anything with minimal syntax; so minimal, in fact, that as soon as you comprehend the problem, the solution itself crystalizes from the ether in front of your third eye. Imagine a programming language so plastic, so flexible that anything is possible; that the language itself is simply a constructed of itself, and manifestation of its simply being.

This is Lisp.
>>
>>60351347
>Recursion is evil
I agree, looping is evil.
>iterative programming
That's not a real word.
>>
>>60351379
Lies, I can express myself better in Haskell than Lisp.
>>
>>60351312
Nationalism is a real problem. We owe our allegiance to the human race as a whole first and foremost, and our own countries second only to that. A country is a good place to be until it forgets its place in that hierarchy.
>>60351313
FUCK YOU VIDEO GAMES ARE AN ART FORM AND WILL CHANGE THE WORDL
>>
File: thedonald.png (1MB, 920x599px) Image search: [Google]
thedonald.png
1MB, 920x599px
Reminder who is really The Donald.
>>
>>60351386
Haskell's type system is a fucked up BDSM nightmare, and it's not even that expressive.
>>
>>60351401
>what are pragmas
>>
>>60351371
>Iteration is linear recursion.
That's wrong at the hardware level, and I just explained why. It's more accurate to say that recursion is self-referential iteration.
>implying proper compilers wont expand tail recursion into loop, no cost and you end up with elegant and easy to understand functions
Except that they're neither elegant nor easier to understand. Iterative solutions are generally much prettier to look at
>>
>>60351396
>>>/k/thedonald
>>
>>60351386
> a language in which input/ouput is a fucking headache
> socially-awkward, introverted autists
Made me think.
>>
>>60351379
So I can do anything which is possible in it?
>>60351386
Haskell would be only slightly better.
>>60351401
>Haskell's type system is a fucked up BDSM nightmare
In what way? This is correct, but I don't think you know why.
>>
>>60351439
>he can't understand monads
brainlet pls go
>>
>>60351426
>nor easier to understand
Are you genuinely a double digit?
>>60351452
What is there to ""understand""?
>>
>>60351379
>>60351386
>>60351443
All of you are wrong, functional programming is hideous and unintuitive. In iterative programming the solutions are always so much clearer in one's mind before they're written and so much cleaner afterward
>>
>>60351401
You also can't even have subsets types.
Like with integers.
What a joke.
>>
>>60351470
Quick, somebody propose a problem to solve in any language, and /dpt/ writes in a solution, which we all then judge and determine which solution/paradigm of programming is clearer and easier to do.
I'll wait.
>>
>>60351464
>Are you genuinely a double digit?
138 actually and by the way functional programming is a poo
>inb4 someone calls me out on using such childish arguments despite supposedly having an IQ of 138
it's intended as a measure of intelligence, not of maturity
>>
>>60351470
Have you tried writing a nontrivial program in a functional pl senpai?
>>
>>60351473
What is a "subset type"?
>>
>>60351470
Good thing Lisp has loop!
>>
>>60351504
My IQ is 139, and you're wrong.
>inb4 >my IQ is (+ (your-iq) 1)
>>
>>60351511
A great many actually. Lisp was the first language I ever learned and I stuck with it for many years.

It's a poo.

Iterative programming was hard to get into after getting so used to functional programming, but once I did, I never looked back
>>
>>60351531
Which immediately makes it broken.
>>60351537
>I stuck with it for many years.
Yes. We can see that by your retardation.
>>
>>60351533
My IQ is 138 and you're wrong. Functional programming is a poo
>>
>>60351527
He's probably talking about something like this:
(deftype nat ()
`(integer 0 *))
>>
>>60351548
>Yes. We can see that by your retardation.
I think you mean autism. I understand to someone not educated about the disorder, the two may sometimes seem similar. That being said, fuck you.
>>
>>60351537
>I stuck with it for many years.
How exactly? Did you get a job as a lisp programmer?
>>
>>60351533
>(+ (your-iq) 1)
no, my iq is your-iq++
>>
>>60351578
No, I mean retardation. Only someone who is quite literally retarded will use Lisp for more than a few minutes.
>>
>>60351594
What do you mean "how"? Are you implying you need a job to do something?
>>
>>60351527
A subset of a set is a set who contains at most (length set) items in itself.
>>
>>60351603
>No, I mean retardation. Only someone who is quite literally retarded will use Lisp for more than a few minutes.
That's demonstrably inaccurate. RMS isn't retarded. I'm not defending the man, I'm just stating medical facts.
>>
>>60351602
My IQ, by definition, is the highest in the thread.
Hence why it's (your-iq) and not *your-iq*
>>
>>60351630
RMS is retarded. This is a medical fact.
>>
>>60351533
my iq = your iq^2
>>
File: 1482316520950.jpg (119KB, 839x835px) Image search: [Google]
1482316520950.jpg
119KB, 839x835px
n1[SIZE] = {'+', '3', '5', '1', '\0'};    // +153
n2[SIZE] = {'+', '2', '1', '\0'}; // +12
n3[SIZE];
multiply(n1, n2); // multiplies n1 with n2 and stores the result in n1
// the result is supposed to be 6, 3, 8, 1... or 1836.

How can I build the multiply function? It's supposed to be a calculator of ints supporting 28 digits, that's why I need to store each digit separately inside arrays instead of the whole number. Don't ask, the professor told us to do like this.
>>
>>60351602
>>60351633
My IQ is 138 and IQ is a poo
>>
>>60351646
Multiplication is just repeated addition.
>>
>>60350956
>All these hot opinions

Wew
>>
>>60351642
He's not though. That's a medical fact.
>>
>>60351630
RMS probably has assburgers or something
>>
>>60351252
What if I want the the latter part to go away?
>>
>>60351568
That's subtyping.

>>60351613
A type can be interpreted as a set in most languages.
"subset type" would mean "subset set". Which doesn't make any sense in English.
>>
>>60351677
That's irrelevant.
>>
>>60351644
Again, (your-iq) is a function, so it determines the output based on what's it's used for.
It will always be the highest.
>>
>>60351685
It does make sense.
>>
>>60351658
I thought about this, but repeating additions of very long numbers will take a lot of time, won't it?
>>
>>60351679
If you're just working with simple arrays, then you'll likely be better served with subseq.
>>
>>60351713
I'm only working with strings, so thanks.
>>
>>60351703
The sentence "You also can't even have subset sets." makes no sense in English.
>>
>>60351606
Well, yeah, non trivial language usage kinda requires some form of a job. So you were extensively using Lisp for research or for your degree? How were you "stuck" with it exactly? I am not trying to argue here, just want to understand.
>>
>>60351737
Are you troll?
You're probably the same retard who responds by suggesting people to go to a different board or place.
>>
>>60351751
He's a troll, don't listen to him.
>>
Is it that bad to code something that may lead to a buffer overflow if the chances are almost infinitely small?
>>
>>60351711
basic arithmetic functions on numbers are hardware accellerrated
Basically, you can do math on numbers of any base by doing it like you would on paper, on a base 2 system like binary you just keep carrying numbers over to the left
>>
>>60351711
https://en.wikipedia.org/wiki/F%C3%BCrer%27s_algorithm
>>
>>60351751
>Well, yeah, non trivial language usage kinda requires some form of a job.
psh
nah
>How were you "stuck" with it exactly? I am not trying to argue here, just want to understand.
I wasn't stuck with it, I just didn't want to learn anything else because I thought it was so great. Changing my mind was the best decision I ever made, though.
>>
>>60351783
Yes.
>>
File: yukari_succ.png (50KB, 232x428px) Image search: [Google]
yukari_succ.png
50KB, 232x428px
>>60351646
The key is to realize that multiplication is the unique covariant endomorphism of the groupoid of integers that.
>>
>>60351779
Lisp is a poo
>>
>>60351765
Anything which is a set will have the empty set as a subset of it. So it's impossible that there exists no "subset set".
>>
>>60351646
https://gmplib.org/
>>
>>60351785
>>60351788
I just had an insight, but thanks for the replies.
>>
>>60351305
Fuck off, idiot
>>
>>60351862
I wouldn't be able to use gmplib. Herr Professor wants us to do everything the hard way.
>>
I want to write company backend for emacs.
I'm going to generate the suggestion candidates by parsing the whole project.
How should I parse the data into emacs?
Using elisp is one option but calling some other program to execute would be better because emacs is not multithreated.
I looked into flex and bison but apparently you need to compile the template, also you need to write sepples so fuck that.
Is there some parsing tool that I can just give input file that defines the source structure, the files to parse and get some useful output?

the code is like
module Mod {
proc function_name() {
}
var variable_name:type value;
}
>>
when it comes to programming projects, do employers care if the project was solo, or a team effort (2 people, specifically)?
>>
>>60351948
Don't use emacs, use vim.
>>
>>60348263
the entire point is to not use recursion you idiot. you have no idea what you're talking about, stop replying to my posts
>>
>>60351980
very novice vim user here. I've always used vim because honestly I'm too scared of emacs. There's some honestly for ya.
>>
>>60352024
Emacs is too complex.
The keybindings are also unintuitive and tedious.
You're right to stay in vim.
>>
>>60351980
Using vim doesn't solve the problem that I need to extract the function/variable names from source code.
>>
File: 1489534162788.png (1MB, 992x1048px) Image search: [Google]
1489534162788.png
1MB, 992x1048px
>>60351420
What do you mean?
>>
File: ran_tewi_wink.png (82KB, 350x238px) Image search: [Google]
ran_tewi_wink.png
82KB, 350x238px
>>60352042
>Emacs is too complex.
Thanks for keeping the brainlets out of the userbase, friend.
>>
File: ss1.png (200KB, 1380x718px) Image search: [Google]
ss1.png
200KB, 1380x718px
>emacs vs vim
Daily reminder spacemacs is the best of both worlds.
>>
>171 replies
>30 posters
huh. there's probably a core of the same 20 people in each thread too. I post in here about once or twice every few threads.
>>
>not using nano
>>
>>60352117
Just mix everything together! It's all compatible! It's all the same!
>>
reminder that vim and emacs are literally the same program but with a different name
>>
>>60352138
>I post in here about once or twice every few threads.
same

this is such a cancerous circlejerk
>>
>>60352117
first impression is that it looks neato, but I really should stick to something for once. Need to improve my vim skills big time.
>>
>>60351948
Never mind, chapel actually provides tool for parsing the source code.

>>60352117
spacemacs sucks. It's slow and configuring vanilla emacs is easier.
>>
>>60352172
Trolling too hard anon.
>>
File: 1450180280284.png (294KB, 562x562px) Image search: [Google]
1450180280284.png
294KB, 562x562px
>>60351030
Satori's favorite language
>>
>>60352254
Satori has shit taste then
>>
File: orin_beg.png (59KB, 391x261px) Image search: [Google]
orin_beg.png
59KB, 391x261px
>>60352281
Fuck you
>>
>>60352214
That's the point, spacemacs uses vim keybindings.
>>60352215
> It's slow
I agree, but it's tolerable.
> configuring vanilla emacs is easier.
No it's not. I've been able to replace my 1k lines emacs config I've collected over the last 8 years or so with the default spacemacs config with all the layers I need plus ~50 lines added so far, and I like it more now. Basically, layers do everything for you, all you have to do is to include them.
>>
File: 1494436559100.jpg (513KB, 720x1280px) Image search: [Google]
1494436559100.jpg
513KB, 720x1280px
The "live" RethinkDB example on the RethinkDB homepage has nothing to do with RethinkDB.

I was hoping to just see what the proper usage approach was for RethinkDB; e.g.
>whether I should use plain HTTP/AJAX and keep polling the server for changes (no idea how I would track what a client received and what to send back)
>or use websockets and just send everything whenever
>and then there's the problem of sending the current state to a new client to synchronise with each other
>>
File: 1492109307976.png (410KB, 612x568px) Image search: [Google]
1492109307976.png
410KB, 612x568px
>>60352315
>>
>>60351076
>lisp cannot be imperative
where did you get this idea from buddy?
>>
What's the status on guilemacs?
Is it dead project? I though they got it ready but it was terribly slow because some text encoding stuff but it was also said that once guile 2.2 is released thing should be faster.
>>
>>60352373
>whether I should use plain HTTP/AJAX and keep polling the server for changes (no idea how I would track what a client received and what to send back)
>or use websockets and just send everything whenever
>and then there's the problem of sending the current state to a new client to synchronise with each other
Is there anywhere I can read the full story?
>>
Also for emacs if I'm going to store a lot of function names for lookup, should I just have them in memory or use db like sqlite?
>>
>>60352528
Sorry? There's nothing more, really. I just wanted to try out/learn RethinkDB but found more questions than answers. My original post is just a list of things I can't seem to figure out myself.
>>
>>60352591
Where did you quote this from? I want to read the full story.
>>
File: halp.png (269KB, 1948x1080px) Image search: [Google]
halp.png
269KB, 1948x1080px
Can you guys help me with number 2. I finished 1 and some of two but i cant find any information online
>>
>>60352658
No story, it's:
>just a list of things I can't seem to figure out myself

Maybe to rephrase: I wanted to make something with RethinkDB but cannot seem to be able to design the application properly. Hence those 3 questions.
>>
File: 1482816856333.jpg (25KB, 479x490px) Image search: [Google]
1482816856333.jpg
25KB, 479x490px
>It's another "I really need to work on this project but can't get myself motivated" episode
>>
>>60352672
try reading the book?
>>
>>60352784
i did i was skimming the section and looked through the index for the terms
>>
>>60352771
same
>>
>>60352807
>skimming
No, I said try READING the book.
>>
>>60352771
same
>>
>>60352672
See sticky, mr. undergrad
>>
>>60349876
A nice little server for sharing tagged data.

json.Unmarshal me senpai

I'm also watching hentai from a horribly slow site and programming while it buffers.

:3
>>
File: 1458275386152.png (167KB, 348x342px) Image search: [Google]
1458275386152.png
167KB, 348x342px
What's happening here, the $wc -c
is missing the count
//basename
//Takes file names as arguments
//Prints NAME with any leading directory components removed.
//TO-DO If specified, also remove a trailing SUFFIX.
//TO-DO Mandatory arguments to long options are mandatory for short options too.
import std.stdio;

void main(string[] args)
{
foreach (arg; args[1 .. $])
{
string current_file_name;
foreach (character; arg)
{
current_file_name = (character == '/') ? "" : current_file_name ~ character;
}
current_file_name.writeln();
}
}


user0@primary:~/devel/proj/test-d$ ./basename abc/def/1234
1234
user0@primary:~/devel/proj/test-d$ ./basename abc/def/1234 | wc -c
5
user0@primary:~/devel/proj/test-d$ uname -o
GNU/Linux
user0@primary:~/devel/proj/test-d$ uname -o | wc -c
10
>>
>>60353494
What language is that?
C#?
>>
>>60353521
D
>>
>>60353521
this >>60353555
aren't all C# mains' static?
>>
>>60353229
I know and you guys have done my HW several times
>>
Since I don't know who's saying what:
>>60353494
>>60353555
>>60353579

What's your motivation to learn D specifically?

I can't say I know it, but I can offer general advice that getting a filename is more easily done by starting from the end of the string and looking for the first "/" that shows up.

Handling paths is also the type of thing that's likely to be in a standard library. Then again, it's good string manipulation practice to do it yourself.
>>
>when C# babies reinvent the error monad
cute

https://codereview.stackexchange.com/questions/163171/a-failablet-that-allows-safe-returning-of-exceptions
>>
>Be me
>Buy a used book on Haskell for the hell of it
>tfw I read it and realize that monads are just a pretentious name for objects
>tfw I realise that Haskellfags shit on OOP all day and they're too dense to realize they're using it
LMAO! I can't fucking take it. This is too much. I'm literally crying and struggling to stop myself from laughing. This is too rich.
>>
>>60353658
That's just because some people here are so insecure about their abilities that they use HW help threads/posts to prove to themselves that they aren't complete garbage at what they consider themselves skilled at.
>>
>>60353494
Looks right to me, 1234 + a newline
Also, you could just split on '/' (there's a library function) and get the last index of the array
>>
>>60353662
>What's your motivation to learn D specifically?
I want to build a large scale desktop app in future. D is a very sweet spot if you want performance similar to C++ but productivity similar to python.
>>
I'm writing a compiler for a language called C++++ which is like C++ without the OO
>>
File: 1493912512062.jpg (56KB, 720x644px) Image search: [Google]
1493912512062.jpg
56KB, 720x644px
>>60349400

yahoo still hasn't blocked me and I almost finished converting my whole vocabulary database

>captcha: HOPE CITY
>>
>>60353755
Why not call it c++-- then?
>>
>>60353712
Is calling a library for this really worth it?
>>
File: 1493208554272.jpg (92KB, 700x566px) Image search: [Google]
1493208554272.jpg
92KB, 700x566px
Hello komrade,

I have making of program that has gotten a little, how you say, out of kontrol? How to be stopping it. I have made a terrible mistake.

Thank you
>>
>>60353778
Because that would imply that removing the OO makes it worse
>>
>>60353801
If it's a standard library then yes.
>>
>>60353801
It reads cleaner, and the performance overhead is neglectable.
>>
>>60353814
Give it the ol' ^D.

Works every time.
>>
>>60353755
So Rust?
>>
>>60353899
D fag gere, does Rust have CTFE?
>>
>>60353820
But if you say it like that it will make it seem that C++ was an improvement over C.
>>
>>60353892
Dearest komrade,

Sadly the progrom is made to of replicate and spread. I cannot press ^D. Police will press ^D on my freedom soon.

I must go but we are two of soul.
>>
>>60353899
Rust is partially OO
>>
>>60354002
It doesn't
Also can't wait for Stephan to finish on the new CTFE, the current one is utter poop
>>
>>60354024
Sensible*

The curse of being a general purpose PL
>>
File: chen_peekaboo.png (113KB, 815x371px) Image search: [Google]
chen_peekaboo.png
113KB, 815x371px
>>60353814
Put int exit(1) or something lol
>>
>>60354007
Blame the NSA.

Works every time.
>>
>>60354038
The new CTFE is finished I think.
I'm more intrigued about what he's trying to do with template generators actually.
>>
File: script.png (98KB, 1280x800px) Image search: [Google]
script.png
98KB, 1280x800px
If you were here almost 3 years ago, you might remember me, I'm back and more massochistic than ever with another 1000+ line batch script

>>60353755
This sounds kinda neat. Anywhere I can get a beta?
>>
>>60353814
>komrade
>>>/r/ibbit
>>
@60354024
You can't be """partially OO"""
>>
File: 1493812465183.png (605KB, 900x900px) Image search: [Google]
1493812465183.png
605KB, 900x900px
>>60354007
>we are two of soul
>>
>>60354139
>@
I love this meme that nerve caught on
https://www.rust-lang.org/en-US/faq.html#design-patterns
> Many things you can do in OO languages you can do in Rust, but not everything
So, borrowing some shit form OO but not going full hog OO, i.e. partial
>>
>>60354208
>actually replying to the gate keeper
Are you new?
>>
File: 1493934512902.gif (1MB, 328x198px) Image search: [Google]
1493934512902.gif
1MB, 328x198px
>>60354289
Good counter argument
>>
>>60354208
There exists a procedure which will always decide whether or not a language is OO. It's impossible for a boolean to be "partially true".
>Many things you can do in OO languages you can do in Rust
That would be the vast majority of even remotely popular languages.

@60354289
>le ""gate keeper"" meme
No, are YOU new?
>>
The only gate keeper around here is me.
>>
>>60354336
>le
>>>/r/ibbit
>>
How much better would the world be if Lisp was the standard?
>>
File: 1489343969523.png (156KB, 244x298px) Image search: [Google]
1489343969523.png
156KB, 244x298px
>>60354091
>1000 line batch script
>there's an entire plugin for notepad++ to handle functions in batch scripts
>still working in XP
fucking christ im so uncomfortable
>>
>>60354208
>>60354336
>meme
>>>/v/
>>
>>60354336
>It's impossible for a boolean to be "partially true"
I get what you're saying, but I wasn't talking in absolutes, hence the use of partial.
Rust borrows from multiple programming paradigms, hence being partially OO, partially functional, partially Iterative, and I do realize this applies to a lot of languages these days, but that doesn't make it any less true.

>>60354472
Still not an argument.
>>
>>60354488
>>60354326
Anon, I think you need to learn to grow a think skin. I love Rust as well fyi
>>
>>60354533
thick*
>>
>>60354548
T H I C C*
>>
File: oldbatch.png (90KB, 1280x800px) Image search: [Google]
oldbatch.png
90KB, 1280x800px
>>60354447
It's the normal function list plugin - It just happens to work for batch scripts.

Still working in XP because I didn't feel like waiting for Windows Vista or 8.1 to boot, so I'm on an MCE2005 laptop.

Pic related is my last completed program, coming in at 74KB for 3748 lines.
>>
File: 1478132983326.gif (431KB, 181x140px) Image search: [Google]
1478132983326.gif
431KB, 181x140px
>>60354662
>>
>>60354662
I FUCKING LOVE BATCH SCRIPTS
DID YOU STILL MAKE SOMES? ANY FORUM?
>>
File: 1493477884182.png (106KB, 185x300px) Image search: [Google]
1493477884182.png
106KB, 185x300px
>>60354533
Still not an argument, I'm not mad or even frustrated, just pointing out who ever I'm arguing with that he have yet to provide an actual count argument.
And yes, I do know, me posting this will be replied to with yet another "you mad" post, but I'm buzzed out of my mind, and if you cant argue with that, then just post some shit, I wont drag this out any longer.

Have a cute girl image, if you feel like having the last word in this discussion, just reply to this post, and it's yours.
>>
>>60354488
>I get what you're saying
Then disagreeing with me would be contradicting a pretty basic law of logic.
>hence the use of partial
Using "partial" with decidable propositions / booleans doesn't make sense unless you're delusional.
>"partially" functional, "partially" Iterative
That's nonsense for the exact same reasons. Also FP isn't even contradictory to POO and "iterative" isn't a real paradigm.
>>
>>60354744
you mad?
>>
>>60354800
no, this >>60354773 is what mad looks like
>>
>>60354692
It's all worth it to see the reactions

>>60354739
I'm working on one as we speak. No forum, but I have an old (out-of-date, looks like the 90s) website with most of my programs on it. Was going to move to C++ but it would have caused a sever reduction in functionality, so I decided against it. The only real advantage was arrays anyways.
>>
File: 1475782564656.jpg (46KB, 500x500px) Image search: [Google]
1475782564656.jpg
46KB, 500x500px
>>60354744
>Have a cute girl image
Not him, but thank you.
>>
>>60354936
site link pls
>>
>>60354892
I know lol
>>
File: 1492957175322.jpg (41KB, 314x336px) Image search: [Google]
1492957175322.jpg
41KB, 314x336px
>>60354950
You're welcome.
>>
File: 1494333405593.png (1MB, 1920x1080px) Image search: [Google]
1494333405593.png
1MB, 1920x1080px
C-Can I join in?
>>
>>60354954
http://sites.google.com/site/aiosysdesign

Was made by a friend and never updated the homepage much, but the Games and News page are frequently updated.

>>60354996
Certainly, friend. Post your programming.
>>
>>60355032
module deduplicate_string_array;

//re creating the array without duplicate values
//updates the array, returns void
void deduplicate_string_array(ref string[] elements)
{
for (int i = 0; i < elements.length; i++)
{
for (int j = i+1; j <= elements.length - 1; j++)
{
if (elements[i] == elements[j])
{
elements = elements[0 .. j] ~ elements[j + 1 .. $];
}
}
}
}
>>
>>60354413
Hardware garbage collection
>>
File: 1493659744061.gif (512KB, 200x200px) Image search: [Google]
1493659744061.gif
512KB, 200x200px
>>60355676
>Hardware garbage collection
>>
I need to work on a large C codebase. I know how to write simple programs and understand pointer manipulation but would reading K&R still be worthwhile?
>>
>>60349876
What language would lain use?
>>
Do string in Common Lisp have a slot for the storage of it's length, like in Python?
>>
>>60356003
Lisp. She can use any type system in her head so it's acceptable.
>>
>>60356003
Lisp
>>
>>60356056
SBCL
STRING names the built-in-class #<BUILT-IN-CLASS COMMON-LISP:STRING>:
Class precedence-list: STRING, VECTOR, ARRAY, SEQUENCE, T
Direct superclasses: VECTOR
Direct subclasses: SIMPLE-STRING, SB-KERNEL::VECTOR-NIL, BASE-STRING,
SB-KERNEL::CHARACTER-STRING
No direct slots.
>>
>>60353707
I literally just did his homework right now to prove to myself that I still know what's going on.
But I don't need to pay it on here.
>>
>>60356157
Also refer to http://www.lispworks.com/documentation/lw51/CLHS/Body/t_string.htm
>>
>>60356180
Good for you anon, doing your own homework, you're a step above most people here.
>>
>>60356066
>>60356107
When will technology make lain real so I can love her and give her many headpats and love.
>>
>>60356307
You have to learn Lisp.
>>
common lisp vs scheme?
which should I learn?
>>
>>60356307
Lain IS real, I am Lain, you are Lain, he is Lain, Lain is all of us, let's all love Lain.
>>
what's monad for dumbers
>>
>>60356366
better yet:
emacs or nock
>>
>>60356366
Common Lisp
>>
>>60356429
just answer the question
>>60356518
but sicp uses scheme??
>>
>>60356307
She isn't even real in her own anime, anon.
>>
>>60354739

>I FUCKING LOVE BATCH SCRIPTS
Really? Because it's kind of a terrible language to write scripts in. I mean, if you're forced to use Windows, you should probably be using Powershell anyways.
>>
>>60356535
If you're reading that, use Scheme then. They use an early version of it though. Outside of this, you'll typically see Scheme as an embedded language (see GUIX or LilyPond, which use Guile Scheme). Common Lisp can be embedded too.
>>
>>60356366
Learn the common one.
>>
>>60356642
i just want to learn the lisp magic
what's a good reference for common lisp
I know other languages already so I'm not new to programming
>>
>>60356681
Practical Common Lisp has projects you can jump into. It doesn't have any exercises though, so it's more learning by following along. You can also read ANSI Common Lisp and On Lisp, both by Paul Graham. If you want to learn more about the magic side of it all, definitely go through the latter part of On Lisp, especially when he discusses read macros and the like. Get a copy of the Lisp Hyperspec as a reference.
>>
>>60356772
thanks anon I appreciate it
>>
>>60356789
Of course. And if you have questions, I'm sure someone around here can answer. Or say Lisp is shit.
>>
I want to get into python!
>>
>>60356929
break out the rope my friend
>>
>>60356929
How do you plan to do it?
>>
>>60356949
what?
>>
>>60356789
Lisp is shit though.
>>
>>60356957
I don't know what do you suggest?
>>
>>60357000
Write a web crawler.
>>
>>60357016
?
>>
>>60349876
Any good haskell books that are heavy on the math and theory of it? Learn you haskell for great good is insulting and aimed at children.
>>
>>60357049
Popular search engine before Google.
>>
>>60349876
>What are you working on, /g/?
Nothing, like the rest of /dtp/ nobody here does anything of use, to anyone.
>>
>>60357079
Just go all the way and learn abstract algebra.
>>
>>60357080
I don't understand anything you are saying, can you just tell me what I should do in order to write the code in order for me to write the code two two
>>
File: 1455947477437.png (129KB, 314x278px) Image search: [Google]
1455947477437.png
129KB, 314x278px
Okay, I am a bit concerned about variable shadowing. Is it safe to have the same argument name between two chained functions?
Tldr: should belongs_to have "items" in its argument?
void print_basename(string[] items) 
//items in the argument, so anything within the scope knows what "items" is
{
bool is_null_terminated = belongs_to("-z", items);
writeln(is_null_terminated);
}

bool belongs_to(T)(T target, T[] items)
//items called again. Remember, this function is called from print_basename()
//it should aready know "items", since it was passed from the previous function
{
foreach (item; items)
{
if (item == target)
{
return true;
}
}
return false;
}
>>
>>60357079
Maybe pic related?
>>
Hi guys, just finished running my pure Python script to sum all primes below two million
>>
>>60357117
https://www.webcrawler.com
>>
New thread:

>>60357228
>>60357228
>>60357228
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!
>>
>>60357079
>Any good haskell books that are heavy on the math and theory of it?
Why would a haskell book be heavy on the theory behind haskell? Just start learning category theory and type theory.
>>
>>60357121
Looked through and didn't to be what I'm looking for. The math isn't really related to functional programming, type theory, category theory. Just general math and logic stuff.
>>
>>60351076
Lisp is multi-paradigmed.

Unless you know Lisp, you don't know what it means to be multi-paradigmed.
>>
File: Screenshot_2017-05-12_22-14-38.png (15KB, 685x391px) Image search: [Google]
Screenshot_2017-05-12_22-14-38.png
15KB, 685x391px
please enjoy my first pygame, I had fun writing it.

let me know if you find any bugs or have suggestions, I'm sure it could be improved.

http://www.mediafire.com/file/up9q57gqhardp5c/feels_dodger.tar.gz
>>
Lisp vectors have their elements be next to teach other in memory, right?
>>
>>60358805
no
it is a linked list essentially, so the elements aren't necessarily next to each other
Thread posts: 318
Thread images: 37


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.