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
wiki.haskell.org
youtube.com
youtube.com
clojure.org
gigamonkeys.com
picolisp.com
twitter.com
github.com
Where were you the day the borrow checker was invented?
how to make program?
I want make program have visualstudio but no know how
write code and compile it
Here in my mother's basement, shitposting.
Why should I use lisp instead of haskell?
how make exe of program so I can give friend
you should use both
macros
compiler errors you can read
make new project, write code, click build
shekels
>compiler errors you can read
>implying
>lisp
>haskell
>money
lol no
thnks
I'm learning FORTH.
why
Stop posting shitty non-anime threads.
fuck you bugman
I have some rust code that does a dns lookup:
extern crate dns_lookup;
use dns_lookup::{getaddrinfo, AddrInfoHints, AddrInfo};
use std::env;
use std::io;
use std::process;
fn main() {
let args: Vec = env::args().collect();
if args.len() != 2 {
eprintln!("usage: {} ", args[0]);
process::exit(1);
}
let hostname: &String = &args[1];
let hints = AddrInfoHints::default();
match getaddrinfo(Some(hostname), None, Some(hints)) {
Ok(iter) => {
for addr_info in iter.collect::() {
match addr_info {
Ok(info) => {
println!("{}", info.sockaddr.ip())
},
Err(e) => {
eprintln!("WARN: getaddrinfo(): {}", e)
}
}
}
},
Err(e) => {
let err: io::Error = e.into();
eprintln!("getaddrinfo(): {}", err);
process::exit(1)
}
}
}
I think it's ugly to have two match statements. The return type of Result is strange because getaddrinfo has no way to communicate errors through struct addrinfo entries, I thought the return type would be Result - but I digress.
How can I eliminate the matches while still communicating error conditions? How can this be more idiomatic?
are you autistic?
Monads could have solved this
God told me to learn it.
please stop talking about monads
>/dpt/ thinks computers perform mathematics
What is a random number?
finish your retarded argument in the old thread please
I would separate the process of obtaining a result or error from displaying it. That way you can just use ? in the main part of the program and have a single match with prints at the end. You'll of course want another enum so you can distinguish between the two errors.
none of you fuckers better respond to this bait
I will when they stop being relevant to solving problems.
they don't perform mathematics
but functional programming has never been useful for anything
>/dpt/ thinks
stopped reading there
good
even sepples is getting monad functions for optional now
nice
Why do you think computers perform mathematics?
useful enough to filter your posts on normiebook
>samefagging this hard
wtf i hate monads now??
I just asked a question.
Migrated some services to v4 of aws api
Will probably replace metrics libraries in our small services next, then POC using a collection of maps instead of a h2 sql db in memory
I need a project for my resume and I keep memeing myself into doing useless stuff. Give me something meaningful to do.
No, don't give me the Jow Forums programming challenges, literally narrow it down to a few options because I need to be spoonfed. When faced with options I just get analysis paralysis like a little bitch.
youtube.com
youtube.com
dont mind me just posting some history
too bad the guy today is making shitty VR games and fell for the AI meme
Besides macros like DDP, it isn't that you can't do it in Haskell, but it's really easy in lisps.
I make good money programming in Clojure
clojure.org
>I need to be spoonfed
Stay poor
make HTTP server
what is ddp?
It literally could be anything. Do something like a fun twitter bot or something, you uninspired retard.
Data driven programming. It's a meaningless acronym. TLDR is that instead of making a DB call from inside a function, you'd formulate data in such way that when passed to an execution agent, it will do the action for you. Pretty neat separation of IO and logic.
>i put 2 switches along a wire, that's what boolean and IS
What if one of the switches fails?
not him, not sure what you mean & why it's better in lisp than haskell
>only propositional logic exists
What does it mean to be a "declarative" language?
it means you focus on declaring what you want rather than how you want it to be done
It means you tell it what you want done and it figures out how to do it
you don't have to worry about types, just write whatever and let the other function handle it.
Also, I want to qualify I'm not sure it's called DDP, I might have had a brain fart there.
Regarding "types assure my program is correct", the best counter example is `sort`'s type signature. It's meaningless.
Clojure, for example, provides different means of schema enforcement. Pretty comfy
>being proud of programming in the worst lisp
>Regarding "types assure my program is correct", the best counter example is `sort`'s type signature
you have no idea what you're talking about, stop spreading lies, please
>Working on ancient codebase
>Almost everything is done with c macros
>We finally get approval to start moving towards C++
>Look up all the features because I never use the damn thing
>It's just a more obtuse way to use macros
Aside from the object system none of this shit seems like it can't just be done with a goddamn macro. What is the point?
you seriously dont understand what's wrong with macros after using C?
fite me irl faggot clojure is an excellent lisp.
Reader support for vectors, maps, sets, separation of symbols and vars, atoms, JIT, dynamic optimization by the JVM.
It's not bad user, you should try it.
does sort's signature guarantee in any way that the function you're using actually sorts the array?
whatever ddp actually is, i don't see what this has to "ddp" in particular. lots of people who don't like haskell have that sort of complaint (it's more like a matter of taste imo)
Do the axioms of whichever logical system you've implemented in a machine become invalid when a mechanical component fails in that machine?
I think that people who don't know how to safely use macros think there's something wrong with macros in C. If you can't use them properly you're pretty stupid.
spoken like a true non-lisp programmer
with lisp, you don't have to fight with the compiler.
Post some sexy macros.
From the little I've played around with it, I didn't dislike it.
Can't say I fully GET Haskell yet, but I plan on getting back to it. Really didn't like LYAH, got any other recommendation?
I write C++ professionally.
The C++ subset that my team uses is very similar to C. You'd probably get used to the codebase very quickly. The main features we use are:
* better support for defining ADTs
* static_cast, dynamic_cast, etc for compiler support in casts
* RAII
We generally steer clear of exceptions and make minimal use of the object system.
We basically write C and sprinkle in C++ where it makes it easier to manage complexity.
>does sort's signature guarantee in any way that the function you're using actually sorts the array?
yes
quicksort : TotalOrder a lte
-> (xs : List a)
-> (ys : List a ** (IsSorted lte ys, Permutation xs ys))
It's not even a Lisp
read the book by Graham Hutton
*less obtuse
C macros fucking suck balls and nearly every C++ alternative to them is superior
why should the axioms be valid? You have no idea what you're talking about.
You mechanical component failure can perfectly be incorporated in the the deductive system
there's the haskell book if you can find a pdf somewhere, it's pretty long and slow though
Nice. I take it back
Why do you say so?
thanks
I'll find it, don't worry
macros are extremely ambigious. You can use them well of course, but they're better represented as a less ambigious language construct
>why should the axioms be valid? You have no idea what you're talking about.
Is it axiomatically true the axioms don't need to be valid?
I meant invalid, sorry typo
Reading this - gigamonkeys.com
He says "a good Lisp compiler can generate machine code quite similar to what might be generated by a C compiler."
Is that true? What's the speed difference? I need my Hello World to run at extreme hypermax lightning sonic efficiency
>everything is done with C macros
Lucky sod. I'm working in a code base with no macros at all. Only defines.
My biggest gripes is the lack of abstraction for even the most basic things. You don't need to type out atoi everywhere. And why did you type -64 when converting that A-Z value to an int? Was that intentional? It's replicated everywhere but none of the code touching it would respond differently to 0.
Why is this variable used as a pointer, error code, index and pointless temporary storage in this massive function? Why is it used as an index here? It contains an error you never checked. It could be -1!
If the person before you uses macros and functions then I'm sure it's a godsend compared to my codebase. It's harrowing because this software isn't unimportant either.
Ambiguous in the sense that using one doesn't really say anything about what it is or?
>Why do you say so?
it doesn't have the primitives ATOM, CONS, CAR, CDR, and EQ
post some LISP codes or GET OUT
How do I see the assembly that my C/C++ compiles to?
Is that IDA or is there another way?
Ambigous in the sense that you can literally do anything with a macro and define TRUE as FALSE and AND as OR
macros basically have no rules so it's quite difficult for another programmer to step in and understand what's going on
just use objdump
do some benchmarks and make the determination yourself
in lisp, you have DISASSEMBLE and TIME at your disposal
there are also optimization declarations you can use with DECLARE
godbolt
There's no standard way.
On GCC and Clang use the -S flag to produce assembly.
#define NewSolverType(type, varname)\
Type ## type * varname = ctmalloc(Type ## type, 1);
#define GetSolverType(type, store, idx, varname)\
Type ## type * varname = (Type ## type *)((store)->data[(idx)]);
I replaced a huge list of structs recently with a macro that will generate all the types for you, and these will let you create/access them by just saying the name of the type you want rather than having to do TypeWhateverTheThingIs all over the place.
It's a big codebase with a really verbose naming scheme so this is more useful than it sounds.
Clojure is less tightly coupled to the cons cell, instead there is the sequence interface, which is implemented by lists, vectors, maps, sets, etc.
The higher level of abstraction would translate thus:
CONS -> conj
CAR -> first
CDR -> rest
ATOM -> (complement sequential?)
EQ -> =
It lends itself to cleaner and more reuseable code
The trillion dollar mistake.
There's many disassemblers. You can usually find them in IDEs too.
>submitting your code to the anglosphere botnet
Good plan.
4
here's an ancient read-time fizzbuzz i did a long time ago
#.(loop for i from 1 to 100 do
(format t "~:[~:[~a~;Buzz~]~;Fizz~:[~;Buzz~]~]~%~@*" (= 0 (mod i 3)) (= 0 (mod i 5)) i))
observe its beauty
Sorry, you'd use `coll?` instead of `sequential?`
That seems to be the best I can make of C++, especially for performance reasons. constexpr is cool and all but it's still not really any better than just using a macro, which is always compile time.
I disagree. I find most C template systems extremely hard to read compared to nested macro systems.
> with no macros at all. Only defines.
That's what I mean by c macros. There's a huge #define system.
To LOOP or not to LOOP, Lispbros?
What the flipping heck is this picolisp.com
It has a built in database and you can use C and Java with it.
Neat user. I admit the only time I've used macros is shorten long expressions.