/dpt/ - Daily Programming Thread

Old thread: Lisp is the most powerful programming language.
I don't care about what you're working on.

Attached: Lisp.png (256x223, 37K)

Other urls found in this thread:

vim-adventures.com/
lispcookbook.github.io/cl-cookbook/web.html
github.com/reddit-archive/reddit
borretti.me/lucerne
shirakumo.github.io/radiance
internals.rust-lang.org/t/diversity-on-the-governance-teams/2048/3
shortcutfoo.com/app/dojos/vim/beginner-text-navigation/train
twitter.com/SFWRedditGifs

Lisp homos out this is now a C/Haskell thread

Attached: 1568110113056.jpg (640x480, 138K)

>Haskell is slower than Lisp
L O L

good post i approve

You can open 200 files side-by-side? Damn, you must have one wide-ass screen to do that.
Either that or you're a coping retard.

Haskell is a fascist language. It doesn't allow you to do whatever you want. You have to play by its rules or it'll tell you no. It's very obtuse, slow, backwards, and ultimately the wrong choice.

Lisp is basically freedom in a language. It doesn't tell you what to do or how to do things. It lets you solve problems as you wish. It even lets you make new languages within it to do so. Lisp is the language for freedom loving peoples.

C++ is the most powerful programming language

Anone! You have been doing great with JavaScript! Good job!

Attached: 9407e09745cec64bff0d911afc92c791.jpg (600x900, 58K)

>(((lisp))) is for kikes
>Haskell is for white men

stopped reading at
>fascist

t. 720/1080 pea brain

Haskell isa
suck my dick

Attached: 1567758961636.jpg (891x717, 77K)

Thread off to a shit start

You asked for this for letting the previous one get to 344 posts.

Well, I'm learning Vim through the Vim adventure site and I have no idea what this means. Help please I can't get into the chest.

vim-adventures.com/

Attached: 83.png (222x269, 60K)

If Rust is a tranny lang then is its predecessor C++ the trans/non-binary lang?

Attached: Gaylord.png (1049x589, 103K)

programming is gay.

>1920 / 200 = 9.6
if you have 10 monitors
>1920 / 200 * 10 = 96
that's a fuckton of monitors, still not enough horizontal space to see shit
if you split vertically
>1920 / 200 * 10 * 2 = 192
not only is it still not enough horizontal space, you also lose vertical space

this is for see peepee con 2019 btw
Other speakers are addressed "his" "her"

Attached: cripples.png (1140x800, 286K)

Simon is great

>Interested in undefined behaviour
Gee

Are you fucked in the head? Haskell's expressivity makes your filthy imagination the only limit of your programs. At least you're not spending your youth on mutually recursive shitfuckery on a Lisp machine (or in your Emacs configuration) because of a type error. Bloody wanker.

I don't mind JavaScript, not really terrible though it obviously lacked design early on. It's coming around though.

I want to start writing web applications using JS for front-end stuff, obviously, and Common Lisp on the back-end. Anyone do this? Tips?

why does this work
set -- foo///// bar//; shopt -s extglob; echo "${@%%+(/)}"


but this does not?
function remove-trailing-slashes() { shopt -s extglob; echo "${@%%+(/)}"; shopt -u extglob }; echo foo///// bar// | remove-trailing-slashes


what am I missing?

>Haskell's expressivity makes your filthy imagination the only limit of your programs
What if I imagine mutable state

>Haskell's expressivity makes your filthy imagination the only limit of your programs.
data F f = F { fI :: f Int, fB :: f Bool }

ff :: F (\x -> x)
ff = F 3 True

>parse error on input \

Easily expressible within a monad.

Reddit used CLisp in the early days for backend. Other than that not many stories about lisp powering backends in the recent years. There was this user that made an imageboard using lisp on the backend, don't remember the name tho.

>mutable state
What if I imagine you disappearing

Attached: 1562490837109.png (388x496, 199K)

What didn't Gamma write another book in 20 years? What's the deal with design patterns in current year

lispcookbook.github.io/cl-cookbook/web.html

I would unironically use IORefs

>37 KB

Attached: 1568574458523.png (256x223, 12K)

>CL on the back-end
The fuck? Why? Get Go or Java/C# or C++ or something, even bloody F# has a pretty framework somewhere

github.com/reddit-archive/reddit

>cringe
fac n = snd (until ((>n) . fst) (\(i,m) -> (i+1, i*m)) (1,1))


>based
fac n = product [1..n]

did you remove all the unnecessary parens

Common Lisp has web frameworks.

I'll more than likely be using SBCL. I hear a lot of clojure stories for lisp in general but nothing about Common Lisp. But there are some interesting framework-type things for CL: borretti.me/lucerne shirakumo.github.io/radiance and lispcookbook.github.io/cl-cookbook/web.html lists some web server stuff.

I don't program but I have strong opinions about programming languages, like Rust - it's fucking shit and for trannies.

This but unironically

You are doing everything right, my man.

nice

Attached: 1568413815146.jpg (726x422, 30K)

I literally haven't written code in months and the last thing I wrote was a tiny amendment for my window manager. Who needs to code in 2019 everything already exists.

>if your language's lexer can't handle multiline lambdas then your language was designed like trash
meanwhile in C
\
\
\
>my man
gay

It's reminding me of the Gabfolk discovering the Fediverse, saying stuff like "eww why are there furries and queers and (((jews)))??". Well yeah? They litterally built the thing, my man!

Attached: file.png (500x520, 67K)

Are the language battles actually important or is it just banter?

PHP gonna do exactly that this year.
Rasmus Lerdorf truly is a clueless retard.

Commands are locked until the point in the game when it starts teaching you them.
You backtrack to that chest when you finish the free portion and there's a notice inside that says "Pay up, goyim."

internals.rust-lang.org/t/diversity-on-the-governance-teams/2048/3
cringe

XMonad?

>programming practice is to convert integers to roman numerals
>not allowed to use loops
I'm gonna have to use case, aren't I? FML

>FML
F isn't valid
what are you even trying to say

What;s wrong with cases?

The only important thing to understand is that such banter ("rust is for transgender crabs :

Nope, i3. Used to use awm but switched to i3 for reasons I cannot remember.

In Lisp, this is just
CL-USER> (format t "~@R" 777)
DCCLXXVII

Probably same as mine so yeah, I understand

Even if it weren't true it's important to insult trannies and keep them out of the public eye

case 9:
foo;
break;
case 8:
bar;
break;

etc
it's java, unfortunately

No, not really. Rust Evangelism Force is an amusing phenomenon though. People literally feel obligated to defend a programming language on internet forums for no reason, that's something

Are you trying to justify your own closet? lol

Dilate

It's pretty common around tech related fields, and as a total ignorant guy I can't really tell what is exactly going on. I would need to be good at coding to know differences between languages in all honesty.

...

I'm struggling to see how you're gonna do this without using loops. You're gonna have to parse the characters in the string somehow.

Hello /dpt/! Newbie here, rate my fizzbuzz on c!

Attached: fizzbuzz.png (488x473, 15K)

nvm just realized it's integer -> roman not roman -> integer. Then yeah you can avoid loops but it's gonna be boring, ugly and it sucks. No way around it tho I guess.

this desu, not even my favourite but I agree

Don't you need newlines (\n) for fizz buzz and the other case?

If I had to explain why Rust is Love™to a 5yo, I'd say that it prevents you from doing bad things that endanger people and computers. It's a railing against our mistakes.

If you have a larger conceptualisation capacity, I'd say that a *bunch* of failures, of flaws, of security incidents, were caused by the very things Rust's computational model prevents, building on maths and not tomfoolery and goat sacrifices (looking at you, C++).

Do you have any other questions?

Please put some spaces around your if conditions, that's hella confusing to read. Also, the else{} closing bracket's indentation is wrong, same as the return statement.

Otherwise it's ok

you get 5 out of 10 points for figuring it out.

That game is only free for the first 10 mins. Just learn it with vimtutor

for the love of god fix your indentation

Oh, so the bracket should be at the dotted line? Thanks for the advice.

Attached: fizzbuzz.png (475x465, 25K)

Is it really that important? I thought it was a purely aesthetic factor.

Use shortcutfoo.com/app/dojos/vim/beginner-text-navigation/train

Well what the fuck did you expect?

Yes it is. As Knuth said: “Programs are meant to be read by humans and only incidentally for computers to execute.”

def fizzbuzz(start, triggers)
Enumerator.new do |yielder|
i = start
loop do
parts = triggers.select{ |(_, predicate)| predicate.call(i) }
i_result = parts.size > 0 ? parts.map(&:first).join : i
yielder.yield(i_result)
i += 1
end
end
end

enumerator = fizzbuzz(1, [
['Fizz', ->(i){ i % 3 == 0 }],
['Buzz', ->(i){ i % 5 == 0 }],
['Zazz', ->(i){ i < 10 }],
])

loop { puts enumerator.next }

>playing a videogame to learn to use a text editor
fucking kids these days

At first sight I'd say OP wanted dependent types, but also didn't know how to write (a -> b) in a typesig.

>purely aesthetic
this is true, but if you like not being a dipshit and making your code legible you'll follow sensible style guidelines.

You can make it look a lot neater by reversing the order you check things in and simply using if (a%5) { style instead of explicit equality checking.

and what does that have to do with forcing him to use your preferred indentation style

>C/Haskell
Don't clump C with your shitty haskell fag.

if this is your best solution, just kys already

>it prevents you from doing bad things that endanger people and computers
I'd laugh if someone told me this even if I was 5 years old

Rate my fizzbuzz
#include
#include
#include
#include

namespace {
const ::uint32_t fuzzbuzz_length = 15;
const ::std::array fizzbuzz_formats
{ "%d", "Fizz", "Buzz", "FizzBuzz" };
const ::std::array fizzbuzz_lookup
{ 3, 0, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 0, 0 };
const ::uint32_t limit = ::std::numeric_limits::max();

void fizzbuzz(::uint32_t start, const ::uint32_t end) {
::uint32_t counter = start % fuzzbuzz_length;
for ( ; start

I was not the one who was rude to OP, but I'd say that code hygiene is part of maturing as a developer. Just like kids don't stop shitting themselves after a while, it must be taught.

Here's a classic:
#.(loop for i from 1 to 100 do
(format t "~:[~:[~a~;Buzz~]~;Fizz~:[~;Buzz~]~]~%~@*" (= 0 (mod i 3)) (= 0 (mod i 5)) i))

Yeah tell me about it…

module FizzBuzz
DEFAULT_RANGE = 1..100
DEFAULT_TRIGGERS = [
['Fizz', ->(i){ i % 3 == 0 }],
['Buzz', ->(i){ i % 5 == 0 }],
]

##
# Makes an array of FizzBuzz values for the given range and triggers.
#
# @param range [Range] FizzBuzz integer range
# @param triggers [Array] An array of [text, predicate]
# @return [Array] FizzBuzz results
#
def self.range(range=DEFAULT_RANGE, triggers=DEFAULT_TRIGGERS)
enumerator(range.first, triggers).take(range.size)
end

##
# Makes a FizzBuzz value enumerator, starting at the given integer, for the
# given triggers.
#
# @param start [Integer] The first integer to FizzBuzz
# @param triggers [Array] An array of [text, predicate]
# @return [Enumerable] Infinite sequence of FizzBuzz results, starting with `start`
#
def self.enumerator(start=DEFAULT_RANGE.first, triggers=DEFAULT_TRIGGERS)
Enumerator.new do |yielder|
i = start
loop do
parts = triggers.select{ |(_, predicate)| predicate.call(i) }
i_result = parts.size > 0 ? parts.map(&:first).join : i.to_s
yielder.yield(i_result)
i += 1
end
end
end

end

in python this is just
for i in range(1,101):print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)

What fucking mental gymnastics math are you doing retard? Anyone with a 4k monitor can easily do 200 characters and still split evenly. It doesn't harm vertical spacing at all. Jesus christ and in the end it's 100% based off your font size.

I remember that one. Another classic.

H-how would a better solution look like? Like this ?

The ruby one is a lot more robust. You can change which words to use and use different triggers (foo%5=0, foo>10, etc) via parameters

>easily expressible by jumping through 100 hoops because Haskell is a piece of shit