3,829 karma · joined September 11, 2022
Reach me at tmt_vdl@gmx.com.
(~> orders
(filter (lambda (order)
(timestamp> (order-date order)
(timestamp- (now) 7 :days))))
(group-by #'order-customer-id)
(mapcar (lambda (group)
(reduce #'+ group :key #'order-total)))
But I prefer the typical Lisp code where I get the sums of the totals of the orders with the same customer ID which were placed in the past week, instead of the orders made the past week grouped by customer ID their totals summed together.Gentoo may not have the highest percentage of users who compile from source because there's binary packages available now. Maybe Exherbo, Source Mage, or Lunar may have the highest percentage outside of LFS.
Let's write some very silly code to turn an integer into a list of digits in Common Lisp:
(deftype Digit ()
"A non-negative integer smaller than 10."
'(Mod 10))
(defun integer->digits (integer)
"Turns a given INTEGER into a list of digits."
(declare (type Integer integer))
(labels ((digit-loop (integer digits)
(declare (type Integer integer)
(type List digits))
(if (< integer 10)
(list* integer digits)
(multiple-value-bind (quotient remainder)
(truncate integer 10)
(declare (type Integer quotient)
(type Digit remainder))
(digit-loop quotient
(list* remainder digits))))))
(declare (ftype (Function (Integer List) List) digit-loop))
(digit-loop (abs integer)
nil)))
(digit-loop 2026) ; => (2 0 2 6)
(digit-loop "2026")
; The value
; "2026"
; is not of type
; INTEGER
; when binding INTEGER
;
; Type HELP for debugger help, or (SB-EXIT:EXIT) to exit from SBCL.
;
; Restarts:
; 0: [ABORT] Exit debugger, returning to top level.Statements are terminated by either a dedicated graphical character, in which case it's easy to forget the character and have a problem, or by a newline (or maybe a different white space character, but I haven't encountered that yet) in which case decent formatting of code may require a dedicated graphical character to indicate that the newline DOESN'T terminate the statement, in which case we have the same problem. Having newline-terminated statements without continuation character would be consistent, but would hamper readability because identifiers would need to be strictly limited in length to keep certain lines from exceeding available screen space (or alternatively readability would suffer from lines only being partially readable).
And that's before getting into the weeds of how mathematical notation is tricky (most people have learned infix notation at maths class in school, so they mightn't appreciate how horrible it is), how different types of brackets (round, square, curly) can have inconsistent semantics, the downsides to the various ways of indicating lexical blocks (brackets, white space, keywords,...), et cetera.
The ideal programming language would probably be one which allows switching between different syntaxes based on what works best for the user (for example, someone could write code in S-expressions, another person could have that code automatically translated into SRFI-119 Wisp expressions and work with it like that, a third person could then have it rendered into something more Lua-like,...). Which is something I think the Racket people are working on, but I may be mistaken.
I actually don't mind Ant very much, but I haven't had good luck using Ivy for dependency management. Maven's been very nice in the decade and a half I've used it, Gradle's always felt off to me. I think there was also another Java build tool written in like Ruby or something, but I'm blanking on the name at the moment.
> it's considered very beautiful
Funny, I've heard it described as 'porridge with fingernail clippings', which doesn't seem to me like a description evoking a 'very beautiful' image.
> it takes a long time to become fluent in it
Not more so than many other programming languages. Of course, most people don't start with Lisp, so their frame of reference is off.
> it "expands your mind"
A fairly meaningless statement which is claimed of a great many things. Is Lisp any more or less mind-expanding than, say, marijuana?
> in theory it can "work on the street" but in practice people reach for other tools
What do you mean, 'in theory'? Lisp has been used, in practise, by NASA, for running a robot on Mars: <https://www.corecursive.com/lisp-in-space-with-ron-garret/>. If that isn't 'working on the street', then, by golly, that's a mean street you've got there.
> The 1TB OLED model
That said, I thought HN was annoyed at Valve for taking a 30% cut, so that's probably how they can keep the Deck under 1k.
Yes, and the only way to know that Vector and Hashtable exist is... to know that they exist.
> I also wanted compile-time attributes à la Rust/C# and there’s no clean way to add those to Lisp’s syntax without seriously cluttering it up
That's what declarations are for, a Lisp could have something like:
(declare (type Foo bar)
(derive Clone bar))
(define bar
(bar:from-string "Hello, World!"))
Or something like: (db:with-connection (con (db:get-connection my-database))
(declare (db:read-only con))
(db:query con
:table "students"
:where (> "score" 80)
:sort-by "name"))
> Lisp is neat but it just doesn’t fit in the future of programming that Rust and C# have shown us.C♯ and Rust are dead languages, you make a change and you have to recompile the entire program and restart it from scratch. You can't ask a running program things like 'how many users are connected at the moment?'. That isn't a future I would like to see.