/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

pastebin.com/GHS7sH8Q
github.com/redox-os/redox/issues/1136
lispworks.com/documentation/HyperSpec/Front/X_AllSym.htm
en.cppreference.com/w/cpp/symbol_index
twitter.com/NSFWRedditVideo

post a screenshot of your code

Reminder that Lisp is the most powerful language in the universe.

>she doesn't understand what premises are
>she doesn't understand how to argue her position rationally
>she doesn't understand why anyone would want to
>she chooses her tools based on feels
Affirmative action was a mistake...

>2018
>a case insensitive language is any good

>le currant year

By default Common Lisp reader converts everything to upper case by default but you can change it read using mixed case.
Common Lisp is case sensitive.

in a not portable way, sure dawg

>case insensitive
>lisp
pick one
also, use your brain

The fucking standards defines that you can modify the reader you fucking retard.
It's not standard compliant compiler if it doesn't support it.

I guess he means it makes your CL environment unable to correctly handle standard CL code?

looking over pastebin.com/GHS7sH8Q
jesus christ I didn't know one could
#'(setf something-seftable)

>not setfing setfable things on a regular basis

What is the learning curve for programming VM instances on a cloud server?

I've never done it and don't know where to start, is it similar to programming once you get over the initial start?

my brain died parsing this shit

I posted that yesterday.
I should've used defmethod instead of defun there. To avoid that horrible typecase.

Nice. Imma look for the docs on #' just to understand wtf is happening.

Occasional JS master-race reporting in.

Clojure does it in a more general and intuitive way tho. #(set! something-set!able %)

pop that x and y like my ghetto bitch pop dat ass am i right

Is SLIME paramount to using LISP or are people just autistic about it

Well, this is how real lispers do it, so get used to it.
Also, it's very parsable.

Sharing a post from /wdg/ with you guys since you may know a thing or two about how to store stats in games.

struct dip {
char name[25];
char surname[25];
float salary;
};

I'm the brainlet from the previous thread, this is my structure.

I made a procedure to load the structure, i need to sort it by surname (doable in the same function as the first one) and then one to find the average salary and one to find min/max salary.
All without pointers.

Of course adding and a # and a % is more intuitive than the generic dispatch macro for function #'

Originally %expand-bind and %expand-extract were in define-widget macro. That would make it harder to parse.

#'x means (function x)

>web
why would you want to care about speed and such, just add more RAM?

TL;DR

I think you using typecase here was correct.
Srs, what's the difference between typecasing and manually writing methods for each class.
You're literally doing the same thing each time, except writing methods makes them be all over the place, as opposed to typecasing, which puts them in a nice little function.

void carica (){
int i;
struct dip dipendente[4];

printf("Inserire dati dipendenti. \n");

//Caricamento
for (i=0;i

I don't give a fuck about speed, JS nerds do.

Now that I'm looking at it, this swap doesn't swap anything. Oops.

>Of course adding and a # and a % is more intuitive than the generic dispatch macro for function #'
Yes obviously since multiple people didn't know that #'(setf something-setfable) was equivalent to (lambda (val) (setf something-setfable val)) However the Clojure version is a known shortcut for a lambda-form that's way more flexible than this arcane trick. btw is that a feature of #'function or of #'setf that makes it work? Or is it not even standard by any chance?

This is now a lisp wars thread btw

Yes, but if I had to write that code for every single GTK+ Widget, it should be better to write individual methods, common ones with a helper macro.

Threadly reminder to use `#![feature(nll)]`.

Threadly reminder not to use Rust.

#'(setf something-setfable) is a reference to (function (setf something-setftable)). Not setf, nor something-setftable.
Function's name is "(SETF SOMETHING-SETFABLE)", sorry for caps.

What the fuck is wrong with you?

Using complex native libraries in Rust is a fucking pain. I'll just write it in C or C++ and expose a simple ABI for Rust to link against.

I want a From that returns an Option ;_;
#[derive(Debug, PartialEq)]
pub enum Action {
Quit,
}

impl Action {
pub fn from_char(c: char) -> Option {
match chr {
'q' => Some(Action::Quit),
_ => None,
}
}
}

#[cfg(test)]
mod test {
use super::Action;

#[test]
fn from_char_quit() {
let action = Action::from_char('q').unwrap();
assert_eq!(action, Action::Quit);
}

#[test]
fn from_char_none() {
let action = Action::from_char('x');
assert_eq!(action, None);
}
}

void testVariant6()
{
Variant v = "Hello, World!";
}
main.cpp:161:9: error: static assertion failed: Ambiguous constructor call
static_assert(1 == (size_t) number_of_ctors_called, "Ambiguous constructor call");

How come I can make a better Variant than the standard committee?

Why's that?
I thought Rust was obsessed with just werks?

I agree.
That looks unintuitive.
#(..) reminds me of a vector, so no thanks
>%

I don't think loading 4 at a time can be done without pointers. However you can do it one at a time:
struct dip charge() {
struct dip dipendente;
/* qualcosa */
return dipendente;
}


Any reason you do it 4 at a time?

It just works, if you only use Rust. Using any non-trivial C libraries is a chore and bug-prone. It can be done, but requires far too much work.

Is common lisp the height of lisp?
will any other lisp ever compete

Ah I get it thx

github.com/redox-os/redox/issues/1136

>16 hours
>all these issues

And Rustfabs were boasting that Rust is some magical panaceum that will make their programs Just Work (tm).

That's just gonna return one struct tough,
If Ineed to make a function to find the average salary I need all of them, don't I?

All Lisps made by men are mere approximations of the perfect Lisp used to create the universe.
Mortals cannot look upon the universe Lisp, as they will instantly go mad.

Clearly not. It has a shitload of technical debt and cannot into using punctuation marks in symbols for some unexplained reason. In addition, it's a lisp-2.

How's that arcane, it's just a way to get a function object from a name.

syntactic abstraction is an enterprise design pattern

>unctuation marks in symbols
Most retarded idea.
You can do it but it's fucking stupid.

>when you can't even write a robust toy microkernel in your "safe" toy language but expect to be taken seriously by real kernel devs on your claims of superiority

The only way to make it work without using pointers would be a global array.

The Common Lisp standard from 1994 defines more symbols than C++14. That's all you need to know about CL.

>nilp

>technical debt
explain
>punctuation
(quote |you.were%saying#nigga|)
>lisp-2
this is better than having a symbol only have one slot for values

>trying to load Twitter's website makes the browser freeze
Alright, this one is understandable. Twitter's site is absolute fucking cancer.

>too lazy/cheap to pay for proper QA
>mask it as a "challenge" to your braindead community and smug people who like to shit on rust
>all this free labor & publicity
Mozilla really are learning from the big boys.

>programming languages are an "enterprise design pattern"
This is your brain on anti-Lisp biggotry...

ouch

So? One can easily remember most of them if categorized

Of course, C++ can't define symbols, they are static keywords.

>Rust is great because it's memory safe!
>unsafe {} unsafe {} unsafe {}

>defines more symbols
And by that you mean "has a more extensive standard library", which you're trying to somehow equate to C++ having a massive amount of arbitrary rules and syntax.

If you're afraid of the star symbol, you can cheat out of it:
float salaire_moyen(struct dip ds[25]);

translates to
float salaire_moyen(struct dip* ds);


Since when are pointers haram in Italy tho?

>C++ can't define symbols, they are static keywords.
Symbols =/= keywords. Standard library function names are exported symbols.

>float salary;
Don't. Use an intenger counting cents. Read how IEEE 4-bytes float works.

Array access is pointer arithmetic. The professor can claim he's not using pointers, but keep down, he knows he is and should feel bad about it.

French code spotted. Disgusting. Code in American next time filthy frog.

P-pls

Cyкa Блять

i haven't seen the python version. does it matter so much?

>Hasn't taught us how to use pointers yet
>tells us to write something that would make 100% sense using pointers
>I have either to find a workaround or understand what the fuck he actually meant

It's the second time this happens,
last time I just resorted to writing one long procedure for everything I needed and just had one line of code in the main.
Absolutely stupid.

c++ is the greatest language of all time

I want to program in french too but I dislike how C++ identifiers don't accept accented characters. I believe the standard permits it, but only clang currently accepts unicode identifiers, not gcc.

To be clear, I'm comparing
lispworks.com/documentation/HyperSpec/Front/X_AllSym.htm
to
en.cppreference.com/w/cpp/symbol_index (without C++17)

You may say what you want, but CL is fucking bloated, especially for an outdated standard from 25 years ago, with a standard library what doesn't have Unicode, networking, multithreading, algorithms, regular expressions, etc.

>everything dsl
>everything mutable
>everything goes duck types
>everything linked lists
>no polymorphic functions
>all features macro preprocessor
>"powerful programming language"
stay beautiful, Sup Forums

>duck types
what did he mean by this?

I agree but it desperately needs a build/project management system like Cargo that lets you easily add dependencies with versioning that will be automatically pulled and compiled for your architecture. I wish I wouldn't have to worry about building all the libraries in their specific versions manually and had a project manager that would take care of it for me. Being able to cross compile from any supported platform to any other supported platform with a single command would also be a plus (provided the libraries support that platform).

.section .data
directions:
.ascii "Choose an option: 1) red 2) blue 3) green 4) yellow \0"
selection:
.ascii "\0"
red:
.long 1
.ascii "RED\0"
blue:
.long 1
.ascii "BLUE\0"
green:
.long 1
.ascii "GREEN\0"
yellow:
.long 1
.ascii "YELLOW\0"
.section .text
.globl _start
_start:
jmp menu_directions
menu_directions:
movl $4, %eax
movl $1, %ebx
movl $directions, %ecx
movl $52, %edx
int $0x80
jmp standby
standby:
movl $3, %eax
movl $1, %ebx
movl $selection, %ecx
movl $6, %edx
int $0x80
jmp selected
selected:
movl selection, %edi
cmpl $49, %edi
je option1
cmpl $50, %edi
je option2
cmpl $51, %edi
je option3
cmpl $52, %edi
je option4
option1:
movl $4, %eax
movl $1, %ebx
movl $red, %ecx
movl $3, %edx
int $0x80
jmp terminate
option2:
movl $4, %eax
movl $1, %ebx
movl $blue, %ecx
movl $4, %edx
int $0x80
jmp terminate
option3:
movl $4, %eax
movl $1, %ebx
movl $green, %ecx
movl $5, %edx
int $0x80
jmp terminate
option4:
movl $4, %eax
movl $1, %ebx
movl $yellow, %ecx
movl $6, %edx
int $0x80
jmp terminate
terminate:
movl $1, %eax
int $0x80

shit code is about all i am capable of

>I want to program in french
Programming languages that support non-ASCII characters in anything but strings should be banned.

>everything linked lists
Actually everything in Lisp is a binary tree, but lispers lack basic CS education to know proper terms, so they call them "lists".

can't say I disagree
yesterday I gave up trying to build and link to openssl

>being so fucking retarded that you take something said by your fellow mindless anti-lisper and projecting it on lisp programmers
Don't reproduce.

There is a difference between being obsolete and being complete.
Alexandria, babel and bordeaux-threads are considered standard.
CL doesn't need a new standard when it can expand itself.

>>technical debt
>explain
Actually I take it back. It has a clean tabula rasa design. My impression was false.

>>punctuation
>(quote |you.were%saying#nigga|)
Yes I know about the || syntax. Remind me why it's rarely used and what the rationale is for not supporting simple stuff like nil??

>>lisp-2
>this is better than having a symbol only have one slot for values
Implicit admission that the symbol table automatically takes twice as much space. For what benefit? Yeah you can meme with a variable and a function that share the same name even tho they are different objects. So useful. And you have to pepper your stuff with funcall and #'.

Currently learning Java because I hear it works on all platforms because of JVM and I want to eventually build a neato little /fit/ related app that I could maybe make some money from...

Anyways, it's early, but my questions are:
>What other programming language should I start learning after Java?
>Is Java really slow or is that just a meme?
>With apps like Chrome dropping Java, is it better to not get too invested in the language and instead maybe learn Python?

That and defining a new standard takes awhile and is expensive. So why do it when everyone agrees to a de facto standard anyway?

Well, I got the Java one and would like to compare implementations. It's that THAT important, but it would be nice. It's the only "coding/programming" interview that I didn't find.

your app wont run on my computer because I wont install java runtime bloatware

* like (nil? ...). fucking codetags that don't codetag up continuous words.

Defining a new standard requires an interest from the industry, companies ready to pay salary to people sitting in the committee, this is why COBOL and FORTRAN are getting updated and CL isn't - no one uses it, not one is gonna waste money on the new standard.

Claiming CL is "complete" is a funny statement because it assumes nothing has changed since 1994 and never will.

>>What other programming language should I start learning after Java?
C, some scripting language, some academic wank language.
>>Is Java really slow or is that just a meme?
Mostly a meme.
>>With apps like Chrome dropping Java, is it better to not get too invested in the language and instead maybe learn Python?
Or anything that transpiles to JS.

CL-USER> (defun what? () (print "what?"))
WHAT?

>Or anything that transpiles to JS.
that's every relevant language, though

#' makes it explicit that it's a function
having a symbol have a normal value and a function value is really useful
>(let ((list some-list)) ...)
>now can't use the list function
>have to use dumb names like lst instead

I have a question for /dpt/

If a Ruby implementation were implemented in Common Lisp instead of C, wouldn't it run faster than CRuby because it gets compiled to machine code (implying a compiled CL implementation is used) instead of interpreted by some poor written interpreter.
CRuby would use less memory, but it will be faster.
Compared to an LLVM based, it may be a bit slower, but it would not take ages (and lots of memory) to load a new file.