[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: SICP.png (46 KB, 221x221)
46 KB
46 KB PNG
>Lisp is a family of programming languages with a long history and a distinctive parenthesized prefix notation. There are many dialects of Lisp, including Common Lisp, Scheme, Clojure and Elisp.

>Emacs is an extensible, customizable, self-documenting free/libre text editor and computing environment, with a Lisp interpreter at its core.

>Emacs Resources
https://gnu.org/s/emacs (Site)
https://github.com/emacs-tw/awesome-emacs (Awesome Emacs)

>Learning Emacs
C-h t (Interactive Tutorial)
https://emacs.amodernist.com (Configuration Generator)
https://systemcrafters.net/emacs-from-scratch (Emacs from Scratch)
http://xahlee.info/emacs (Xah Emacs Tutorial)

>Emacs Distros
https://spacemacs.org (Spacemacs)
https://doomemacs.org (Doom Emacs)
https://ergoemacs.github.io (Ergoemacs)

>Elisp
Docs: C-h f [function] C-h v [variable] C-h k [keybinding] C-h m [mode] M-x ielm [REPL]
https://gnu.org/s/emacs/manual/eintr.html (Introduction to Elisp)
https://gnu.org/s/emacs/manual/elisp.html (Elisp Manual)

>Common Lisp
https://lispcookbook.github.io/cl-cookbook (CL Cookbook)
https://cs.cmu.edu/~dst/LispBook (CL: A Gentle Introduction)
https://gigamonkeys.com/book (PCL)
https://lem-project.github.io (CL editor/IDE)
https://nyxt.atlas.engineer (CL Browser)

>Scheme
https://docs.scheme.org (Docs)
https://scheme.com/tspl4 (TSPL4)
https://eecs.berkeley.edu/~bh/ss-toc2.html (Simply Scheme)
https://archive.org/details/Schemer (Books)

>Clojure
https://clojure.org (Site)
https://clojure-doc.org (Docs)
https://mooc.fi/courses/2014/clojure (Functional programming with Clojure)

>Guix
https://guix.gnu.org/manual/devel (Guix Manual)
https://systemcrafters.net/craft-your-system-with-guix (Introduction to Guix)
https://gitlab.com/nonguix/nonguix (Nonguix)

>SICP/HtDP
https://web.mit.edu/6.001/6.037/sicp.pdf
https://htdp.org

>More Lisp Resources
https://paste.textboard.org/52b08691

(define alt-names '(/emg/ /emac/ /lambda/ /lol/ /let/ /flet/))
(set! prev-bread >>100071263)
>>
Is there a fast version?
>>
first for C
>>
>>100123116
sbcl is probably the fastest.
>>
TEXMAC! powerful and simple!
https://texmacs.github.io/notes/docs/modular-scheme-graphics.html
>>
File: large-cover.png (102 KB, 545x717)
102 KB
102 KB PNG
>>100123116
>>100123174
heh, kid...
>>
File: .png (547 KB, 700x700)
547 KB
547 KB PNG
>fantasticware found
https://github.com/engstrand-config/dwl-guile
>https://youtu.be/FiVu7Lyfh9g?t=4
>>
>>100123116
not yet... carp came close but lost traction
>>
>>100122189
Do you actually use AllegroCL?
Is there a personal edition or something? Btw, I despise how both proprietary CLs have "email us for price" instead of just a pricing on their website.
>>
>>100125588
Never had any traction to begin with

>>100126203
Did you even look on the LispWorks site?
>On "BUY" page
>You can find the prices for our products here.
>>
>>100126319
You're right, I forgot they changed it a few years ago (incidentally, it is hidden behind about 5 clicks from where you see the first pricing link).
>>
>>100126203
What is the point of proprietary lisps?
>>
>>100126203
A little bit. I've been messing around with the free edition. It has nice libraries built in. I don't know if I'd want to use it long-term though.
>>
>>100126319
>https://raw.githubusercontent.com/carp-lang/Carp/master/examples/carp_demo.carp
still, woulda loved to try making a game in it..
>>
>>100126550
Government contracts. US DoD loves Common Lisp
>>
>>100123076
Vincent, fix yer shit email service.
>>
>>100127858
works on my machine
>>
Good morning sirs
It is once again monday
I hope you are all well and prospering inshAllah
>>
https://github.com/sharplispers/clawk
Amazing sirs
>>
>>100128594
Nice! Just what I will never need.
>>
>>100127495
Really, first time I'm hearing about this
In what kind of contracting is it used?
>>
>>100128903
Old AI darpa stuff was made in lisp. Search for DART logistics DARPA for smimilar shit.
>>
>>100128943
Oh so it's maintaining legacy systems basically? I thought there might've been a niche for lisp programmers working for contractors
>>
>>100128632
faak head
>>
How do I get a variable that persists for macrolets within a macro?
Precisely, I have
(defmacro some-macro (var &body body)
`(macrolet ((increasing-macrolet (n)
(incf macrolet-counter)
`(+ n ,macrolet-counter)))
,@body))

And I want macrolet-counter to count each invocation of the increasing-macrolet macrolet in the BODY of the macro. (ie. (increasing-macrolet 0) = 1, (progn (increasing-macrolet 0) (increasing-macrolet 0)) = 2).
Putting a (let ((macrolet-counter 0)) ...) either outside or inside of the quasiquote doesn't work, so I'm not sure how to approach it.
>>
>>100128959
No, I don't know about modern stuff because, one I haven' searched, and two I think technology has changed a lot in the spook sector, so they probably use everything, and it's not like they talk openly. We know about dart because darpa is a funding agency, so they disclose stuff about projects somewhat.
>>
>>100129010
>technology has changed a lot in the spook sector, so they probably use everything
It's an interesting subject. Probably very little info on it though. And I'm not american anyway so it's not like any of it would apply to me probably
>>
>>100128996
(defvar *nigger-counter*
(let ((nigger-counter 0))
(lambda ()
(incf nigger-counter))))

(defmacro nigger-macro (nigger &body niggers)
`(macrolet ((increasing-nigger (n)
`(+ ,n (funcall *nigger-counter*))))
,@niggers))
>>
>>100129164
Warning: Increasing nigger-counter may lead to instability
>>
>>100128594
what the frick sir that is incredible
>>
>>100128996
Do you need the count at comptime or runtime?
>runtime
Wrap the macrolet in another let that holds the local var, name created with gensym.
>comptime
To make it call-site local you're going to have to create a new special variable for each call.
>>
File: 1713217362213.png (60 KB, 207x238)
60 KB
60 KB PNG
what's the difference between :symbol and 'symbol in Common Lisp? i dont get it
>>
>>100129782
:symbol is a keyword symbol that isn't interned and exists only for its name.
'symbol is a regular symbol which can have all sorts of crap attached to it.
>>
>>100129839
Keyword symbols are interned in the KEYWORD package
>>
>>100129782
:symbol is a shorthand for keyword::symbol, which is a symbol interned in the keyword package
'symbol is a shorthand for <current-package>::symbol, which is a symbol interned in the current package
>>100129839
>:symbol is a keyword symbol that isn't interned and exists only for its name.
thats wrong. symbols printed as #:symbol are not interned. these are usually created using MAKE-SYMBOL or GENSYM or whatever
>>
>>100129839
i still dont get it
are you saying that the :symbol syntax is only used in function calls for assigning parameters in a non positional way?
>>
>>100129890
hes wrong, ignore him
>>
>>100129905
ok but i dont get your answer either

>:symbol is a shorthand for keyword::symbol, which is a symbol interned in the keyword package
>'symbol is a shorthand for <current-package>::symbol, which is a symbol interned in the current package
what does this imply practically? when should you use one and when the other?
>>
>>100129931
when you intern a symbol in the keyword package, it is automatically made external, and a self-evaluating constant, like T or NIL. so you can't assign value to it
there is generally no big difference outside of that. you are required to use :symbol when supplying keyword arguments.
people often use :symbol with property lists, but nothing stops you from using symbols in the current package, or even another package. it's just a neat way to visually differentiate between symbols as markers and symbols as data
>>
>>100129984
i see
it's weird that they cared about having such minutiae in a language with no syntax though
>>
>>100129931
Keywords are useful for package-independent symbolic values. Like ENUMs are often used.
>>
File: LOOP.gif (2.59 MB, 800x800)
2.59 MB
2.59 MB GIF
>>100123201
LOOPing
(define (fact-let n)
(let loop((n1 n) (p n))
(if (= n1 1)
p
(let ((m (- n1 1)))
(loop m (* p m))))))

https://www.shido.info/lisp/scheme7.html
https://www.shido.info/lisp/scheme7_e.html
>>
File: SI(C)P.png (1.74 MB, 1024x1076)
1.74 MB
1.74 MB PNG
>>100123119
>>100099365
>Ritchie: I have to admire languages like Lisp.
http://www.gotw.ca/publications/c_family_interview.htm
>>
>>100130244
"No syntax" is a bit of a misnomer
"No special-purpose syntax" is more accurate
There is a little bit of syntax, but it's all accessible to the programmer and can be repurposed
>>
I'm currently learning racket with the htdp book, im halfway through fixedsize data and love it but i fuuuuucking despise the drracket ide... and i dont know how to fucking use emacs.. is there no salvation bros?
>>
>>100132197
RTFM
https://docs.racket-lang.org/guide/other-editors.html
>>
>>100132197
>htdp
SICP but not as good
>>
>>100132335
im currently turbo speeding html/css/js and just doing racket on the side, ill read sicp right after tho
>>
Why the fuck did they rewrite SICP for JS? Has anyone read it?
>>
>>100123076
Lithp general
>>
File: {666}.png (320 KB, 2585x1462)
320 KB
320 KB PNG
>>100132841
>you vill uze ze javasoγcript and you vill be happy
>>
>>100133194
holy kek who's fucking idea was this
no wonder webshitters are a joke
>>
File: 1698871118315176.png (117 KB, 520x452)
117 KB
117 KB PNG
>>100133194
>this is the most popular programming language in the world
I wish things had gone differently.
>>
examples of good CL codebases used in production?
>>
>>100129782
'symbol is a a quoted symbol. 'symbol evaluates to the literal symbol, while symbol (no quote) may evaluate to something else

:symbol is a keyword, it always evaluates to itself
>>
File: nyarlathotep.png (1.19 MB, 2048x1433)
1.19 MB
1.19 MB PNG
>>100133184
Lithp... is the most powerful lovecraftian programming language... (((ΦωΦ)))
https://github.com/HeeJay1/Lovecraftian_Lisp
>>
>>100129782
you can imagine that the keyword package just contains of a bunch of lines of code that look like
(defconstant :symbol ':symbol)

where note that the symbol :symbol will be bound to the result of evaluating (quote :symbol), which of course just the symbol :symbol (i.e. :symbol gets bound to itself)

This makes all :symbols special in that you can't bind arbitrary values to them, but also they automatically evaluate to themselves, which is why they're used in places where you always want a symbol to unambiguously and without exception evaluate to itself, rather than 'symbol which is a situational kind of thing where you want to avoid the env lookup
>>
>>100133508
No because production code is not shared
>>
>>100133508
Maxima, SBCL, old AI code, Genera.
>>
>>100123076
https://youtu.be/bwAQs5hXQW0?OMq-pZhnNcWYg3qa
>>
>>100129010
I was quite sure that Russian intel/malware community standardized on Nim for the low-level capability AND real macros (not homoiconic tho, you need to drop down to AST like in Elixir first)

So a Common Lisp that can go down to Assembly is perfect for the purpose. Which commercials and SBCL can right? Just disassemble your functions and CLOS.
>>
Thoughts on Haskell?
>>
>>100140314
shitware
>>
File: アリス Haskell.png (13 KB, 128x129)
13 KB
13 KB PNG
>>100140314
Good for writing schemes in 48 hours.
https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours
>>
>>100140314
excellent learning experience
dogshit project language
>>
>>100140452
Like Lisp?
>>
In the absence of parentheses, chaos prevails.

- CIDER
>>
>>100140679
In the absence of parentheses, the syntax is inconsistent chaos.
>>
>>100140452
This
>>
I want to use emacs in server mode, but I find the thought of frames sharing history to be too annoying. like I don't want to go to a project and then alt-tab to another frame and then when I do "C-x left" it opens what I just had opened in the previous project instead of the relevant buffer to the project. or is that not how it works?
>>
>>100140442
I can write a scheme in Lisp in 48 minutes
>>
Has anyone had problems with c-ts-mode in Emacs? It segfaults immediately for me, even with -Q.
>>
>>100140972
You could close your buffers, or try perspective.el https://github.com/nex3/perspective-el. Personally I haven't tried it but it sounds like that fixes your problems.
>>
Good morning sirs
>>
>>100141578
I haven't bothered with any of the treesitter modes yet at all, seems like an ill-conceived idea to me to have x-mode and x-ts-mode for everything. Not exactly sure what I'm missing out on (I use puni which works fairly well across a lot of languages)
>>
So if I want to learn CL, I should learn Emacs first?
And that means learning ELisp before even CL
And I'm a vimmer, so that means climbing another editor learning curve all over again

Tried Lem SDL on windows but its window didn't even shows up properly
>>
>>100142712
Yeah it's a bit of a long journey but you can do it, I believe in you sir. You'll definitely be better off attempting it on linux though.
>>
>>100142712
>And that means learning ELisp before even CL
You don't need elisp to use and customize emacs.

If you get slime or sly running and unshittify base emacs then you are 98% there already
>>
>>100142797
I was gonna say that too but upon reflection anyone with a decent init is probably gonna have to use if let defun and shit so that's basically halfway there as much as lisp syntax goes anyway
>>
>>100129839
:symbol is an immutable constant like 5 or 2.71

'symbol creates a new unbound variable named "symbol" but due to quote is not evaluated


(eval :symbol)->:symbol
(eval 'symbol)-> error unbound variable symbol

(set :symbol 3)-> error assigning value to constant . It's like saying (set 2 3)

(set 'symbol 3)->ok
the variable named "symbol" is bound to 3
>>
>>100142773
>>100142797
Realistically, what can I expect to be better at after learning CL? Would for example the solutions for automation tasks be more succinct compared to Go or Python?
>>
>>100143288
Do you have any specific problem domain in mind? I prefer CL whenever I can because it's pleasant to work with but I have to admit that for larger projects I err towards whatever language has the relevant and popular tools.
>>
>>100142712
>And that means learning ELisp before even CL
They are very similar so most of your CL knowledge would carry over. The rest can be answered by stack overflow posts.
>And I'm a vimmer, so that means climbing another editor learning curve all over again
Install evil and call it a day. Then its only your configuration language that changes.

>>100143288
Succinct in terms of amount of total code? Yes
Succinct in terms of code clarity? If you stick with good practices, yes
Succinct in terms of can I download a library that does all the work? No
>>
>>100143335
>Do you have any specific problem domain in mind?
Just the go-to language for generic tasks
>>
>>100143694
Seems very non-specific, your best bet might be to learn Python if you're not already familiar with it.
>>
>>100143776
Like writing a web crawler or telegram bot or linux glue language
I know Python but it feels off...especially since declaring types seem to be good practice nowadays
And no single binary output and dependency issues
>>
>>100143831
>web crawler
Reasonable in python, CL, do not attempt in schemes
>telegram bot
I don't know the API so probably Python
>linux glue language
Perl or bare ass POSIX shell

Python dependency management/venv system is actually pretty advanced among these options.
>>
>>100141595
do you use server mode? do you just get used to it?
>>
>>100140972
buffer history is per window. what happens in other windows has no effect on what C-x <left> does in a window.
>>
>>100145375
ok that's actually not so bad. besides lsp servers remaining active in the background I think I can deal with that
>>
How important is Sussman's explanation of a program's "time" and "space" components to actually designing programs?
>>
>>100145601
Quite
>>
>>100145601
space efficiency isn't talked about a lot nowadays, but time efficiency is still absolutely critical and any half decent programmer must be able to look an algorithm and tell if it's O(1), O(n), O(n log n) etc
>>
>>100145761
>space efficiency isn't talked about a lot nowadays
Is it irrelevant because storage space is cheap? Are there types of programs for which space is important?
>time efficiency is still absolutely critical
I'm not sure if he'll get more in depth into this since I haven't finished the lectures, but if he doesn't, is there a good resource to learn about algorithmic time efficiency?
>>
>>100145803
>Is it irrelevant because storage space is cheap?
I think that's the reason, yes. both storage and memory are extremely cheap nowadays and having a faster algorithm that uses more memory is advantageous in 95% of the cases

>is there a good resource to learn about algorithmic time efficiency?
there wikipedia I guess. it's not too hard to learn, you can just pick it up intuitively by looking at examples
>>
>>100145855
Alright, thanks.
This makes me realize how little I know in the way of theoretical CS. I know how to code, but I don't actually know shit about anything related to algorithms, computational complexity, and other relevant subfields.
>>
>>100145761
>>100145803
Space efficiency is absolutely talked about a lot, especially if you are actually working on practical stuff.
A lot of problems boil down to memory-time tradeoffs and often certain algorithms have to be used to limit memory usage since if your algorithm is O(n^2) memory then for n = 1 million (say bytes, so one megabyte) you'd need 10^12 (ie 1Tb), which is obviously highly undesirable.
>>100145803
If you want something to study for the next year or so, The Art of Computer Programming (Donald Knuth) provides essentially all the information you will need about the analysis of algorithms.
>>
>>100145803
you just get a feel for it. it ends up being pretty obvious after a while, at least for the common cases like o(1)/o(n)/o(n^2)/o(log(n))
>>
>>100145761
>space efficiency isn't talked about a lot nowadays, but time efficiency
That's because space efficiency <= time efficiency
>>
O(1) -> the cost is always the same. packed array access
O(log n) -> the cost scaled with the size of the input, but slower than linearly. binary search on a sorted array
O(n) -> the cost scales linearly with the size of the input. linked list element access
O(n log n) -> the cost scales faster than linearly but slower than quadratically. idk a quick example for this one. finding if there are duplicates in an array? that would be O(n2) worst case but O(n log n) in average, right?
O(n2) -> the cost scales quadratically with the input. comparing each array element to each other
O(anything else) -> at this point you might as well just kill youself
>>
>>100146692
>the cost scaled with the size of the input, but slower than linearly. binary search on a sorted array
The cost scales logarithmically with the size of the input.
>>100146692
>O(n log n) -> the cost scales faster than linearly but slower than quadratically. idk a quick example for this one
Sorting
>>
>>100146692
Damn so O(fib n) really is absolutely disastrous
>>
>>100146195
>The Art of Computer Programming
Yeah I've seen this memed a few times alongside SICP. How hard is it?
>>100146399
It's an interesting subject. Is computational complexity theory an active field?
>>
>>100146692
I'd also note that for modern computers O(log n) and even usually O(n) are basically equivalent in performance to O(1) as long as you can fit everything into memory and don't have to access a disk or a network.
Also note that many theoretically more efficient algorithms are actually slower than you may think because, for example, constant doesn't mean SMALL and it could be that an O(n) algorithm beats the O(1) one until a billion inputs or more.
>>
>>100146809
>I'd also note that for modern computers O(log n) and even usually O(n) are basically equivalent in performance to O(1) as long as you can fit everything into memory and don't have to access a disk or a network.
but that's the classic mistake. big O isn't about being slow or fast, it's about how things scale. sure, on a modern CPU the time that it takes to access a linked list or an array is the same (basically zero), but the way it scales for is still completely different

an O(1) algorithm can be infinitely slower than an O(n2) algorithm in practice, but you can count on it always being the exact same cost no matter how large is the input
>>
>>100146809
I think a good example is the fibonacci sequence. The naive recursive algorithm is O(n), but there's a simple mathematical formula that's O(1). Only problem is it involves taking a bunch of square roots, which involves floating point numbers and thus both becomes wildly inaccurate AND any n big enough to need speedup to calculate is so gigantic it breaks the limits of even 64 bit double precision so you can't even calculate it at all. To use the "simple one step constant time" algorithm you actually need an entire computer algebra system which will be much SLOWER than just calculating it the normal way unless you need 100 billion digits of precision.
>>
>>100146692
wdym logn is slower than linear? that's just not true
>>
>>100147038
oh you meant the *cost* scales slower
>>
>>100146809
>I'd also note that for modern computers O(log n) and even usually O(n) are basically equivalent in performance to O(1)
No, this is never the case. A bisective search on an array will be far faster than linear.
>>
>>100147590
Yeah nanoseconds instead of microseconds, AKA the same.
>>
>>100147635
Not for certain applications.
>>
>>100146692
>O(anything else) -> at this point you might as well just kill youself
otherwise known as webshit complexity
>>
Sirs I'm in love and it's killing my productivity. I can barely focus. What do I do
>>
>>100140679
>>100140883
RPN woule like a word with you
>>
>>100148123
Masturbate then go back to work
>>
>>100148123
It all turns to dust
>>
>>100148123
COOM! powerful and simple!
>>
>>100148123
sex is temporary, sexp is forever
>>
>>100123076
programming is finding a way to represent real-world information -> data
then finding a suitable mathematical abstraction to solve the problem
then finally translating that to code (the easiest part by far)
this is why obsessively learning languages is retarded, unless you're doing it for pure optimization purposes

debate me
>>
>>100148938
you are mostly correct
but learning at least one procedural, one object sharted and one functional language would benefit everyone
>>
>>100148938
>obsessively learning languages is retarded
Yeah that sounds pointless. But why bring this up here? Is that what you consider learning lisp to be?
>>
>>100148938
>obsessively learning languages
lispfags are generally some of the least interested in learning other languages
>>
>>100142712
>And I'm a vimmer, so that means climbing another editor learning curve all over again
I was a vim user two weeks ago, I installed emacs, followed a short tutorial and then asked chat gpt how to install evil mode and configure two or three things. Now I'm an emacs user. It's really that simple.
>>
>>100142712
why not vlime?

also I don't use emacs or vim, just an editor and a repl in two terminal windows
>>
>>100149300
Thank god I'm going for the data meme and will never have to learn anything else than python and sql for my career
>>
>>100149797
>python and sql
>thank god
we are men of vastly different tastes
>>
>>100145265
I tried a little bit, but currently I do not. I just try to keep my startup times short.
>>
>>100142708
> seems like an ill-conceived idea to me to have x-mode and x-ts-mode for everything
Yeah, it's pretty annoying, since you need to install the module and then hook the ts mode to the major mode. Thankfully there's a package for that (treesit-auto) that does everything automatically.
> Not exactly sure what I'm missing out on
Better syntax highlighting and structural (AST-based) editing is what people usually say. I haven't found much of an improvement but thought might as well to use it.
>>
File: FACT.jpg (816 KB, 1920x1080)
816 KB
816 KB JPG
>http://harmless.cat-v.org/software/
>Mostly Harmless Software
>Scheme
>>
>>100146195
So R6Rs could include bytevectors but not bitvectors?
Also every time I return to Schemes it annoys me how opaque the system and libraries are, it feels like there's a big difference between the "compiler code" and "user code".
>R6Rs requires implementations to be able to map characters to their Unicode properties and general category
>But because that table is not exported by the compiler, it is not accessible from user code
>The only solution is to generate your own table from the Unicode documents
That is obviously the portable solution but it also requires a duplication of a table that is essentially required and takes up a few MB of the runtime.
>>
I am big dumb
>>
>>100151844
This class of issues is the biggest mistake of R6RS, I believe. I really like the size of it and amount of features, but the implementation of nearly all the features have weird concessions and edge cases that make me feel like I'm writing Java: Parenthesis Edition. The worst part of R6RS is how the syntactic and procedural record systems are totally different.
Regardless, I still use R6RS the most.
>>
>>100151894
Anon I would appreciate it if you would either
>provide more context, explain what you are doing when other anons ask
or
>stop posting screenshots with half the text redacted and some inane comment
>>
>>100152128
I am writing a Lisp without variadic arguments, hence no parentheses are needed. Strings are [encoded like this], which allows nesting of strings. Big ints, floats, and rationals are the native number types. Booleans, machine ints, and bytes are also supported. For collections, slices and maps exist. Maps can index any type to any other type. You can even have maps indexed by other maps (this is accomplished by marshaling the map to a string representation, then using the string to index).
A very important part of the language is that you can marshal any data structure into a string, including threads. This allows for dumping of program state to a string, then reloading it and resuming the program, even on another machine (undefined behavior in the case of machines not sharing a word size, although I am working on another project to alleviate that concern).
The results of side effects are persisted to disk. If, when running, a side effect is encountered, the disk gets queried to determine whether that operation has already occurred. This prevents the need to dump the entire program to disk on a regular basis, and also guarantees that you can always resume to the latest state of the program. A form of fault tolerance, if you will.
It is not a language intended for general use. Its features will assist in the development of more important, novel work, which unfortunately I will not yet discuss.
Pic related is the code that results in the bug I posted. I am a dumbass lol
>>
>>100152243
>This allows for dumping of program state to a string
weakly typed BTFO
ENTER
stringly typed
>>
>>100152243
Interesting.
Do you have different notions of equality?
Does the reader/parser produce a tree or just a stream? Also do you support parenthesis for code clarity?
>Maps can index any type to any other type.
I assume, if you define indexing by marshalling to strings, that equality of maps is defined by equality of all key-value pairs.
>A very important part of the language is that you can marshal any data structure into a string, including threads.
Does the string include type information for when you reverse the process?
>undefined behavior in the case of machines not sharing a word size
I would have assumed that by representing all data as a string you would become isolated from machine details like that. In what cases would reloading result in an erroneous state if the word size changed? Does this mean your language exposes the machines word size?
>the disk gets queried to determine whether that operation has already occurred
Couldn't you avoid disk access by just remembering whether the state has changed since the last dump?
>Its features will assist in the development of more important, novel work, which unfortunately I will not yet discuss.
Please do post status updates!
>>
so I've got a function that I can send an array and one or two indices and it'll perform an aref on the array, checking against the bounds of the array. I also can have it return something specific if the aref fails(out of bounds or just nothing there). I basically check to see if the array is 1 or 2 dimensions with a cond and go off of that(using functions defined inside a labels block). This is working just fine but what's the "proper" way to do this in common lisp?
>>
>>100152788
>Do you have different notions of equality?
No, values are equal if and only if they marshal to the same string.
>Does the reader/parser produce a tree or just a stream?
Trees, but far more flattened than you might think (only scopes are descendants).
>Also do you support parenthesis for code clarity?
No, but this might be a good idea to implement later on. You can use whitespace at the moment.
>that equality of maps is defined by equality of all key-value pairs.
Yup.
>Does the string include type information for when you reverse the process?
All types can be turned into strings. There are keywords for converting strings into any type. Pic related contains the dumped state of >>100152243
>In what cases would reloading result in an erroneous state if the word size changed?
Slices have finite sizes based on word size. One can imagine being unable to load a 64-bit slice onto a 32-bit machine and then indexing it using machine ints. This could also affect the callstack, due to it also just being a slice of frames.
>Couldn't you avoid disk access by just remembering whether the state has changed since the last dump?
Almost certainly, but performance is the least of my concerns right now, and simplicity in implementation is desired.
>Please do post status updates!
Hopefully...
>>
>>100123076
Can anyone point me in the right direction for Lisp on Windows? I don't know what am doing. I wanna learn CLisp on Windows.
>>
>>100154130
install Emacs + sly
install sbcl
follow a random guide on getting started with sbcl + Emacs/sly
come up with a demo project and try using it
>>
anyone know why restclient.el got archived a couple weeks ago? no news and development seemed relatively active. sucks, it's a good and popular package.
>>
>>100155022
well I found verb.el which seems to be a spiritual successor
>>
>>100147635
Not if you run it e.g. every frame.
I recall reading a post from the guy working on Dwarf Fortress performance, where a big performance issue was linear search through an array every tick, since most DF data structures consist of vectors of pointers. Sorting the array and doing bisective search ended up much faster.
>>
>>100147635
this line of thinking doesn't work for embedded or games. sure for your shitty CRUD app or scientific number crunching it won't matter but I can't imagine being that careless in general when it comes to performance
>>
>>100155658
>or scientific number crunching
Why do you think that ns vs ms does not matter for scientific number crunching?
>>
>>100149821
I didn't say I particularly liked using them. But the grass is definitely greener here than elsewhere, especially over in webshit where they have to work with JS and learn all these bullshit frameworks all the time. And don't get me started on """enterprise""" development with Java and C#
>>
>>100156105
You will be pushed into learning Django quite soon, and then you'll wish you were working with Lisp.
>>
>>100156105
>>100156156
And I'm saying this as someone who did go for the data meme, I have a MSc in machine learning. While I do data shit sometimes, *a lot* of time is spent doing more classic shit like servers, deploying some container, etc. Unfortunately, the fun data analytics part is often done more quickly than those.
>>
I sometimes feel like I'm useless, but then I see truly useless shit like this and I feel better: https://youtu.be/xTugbF4A1ds
>>
File: 1694959690383.jpg (21 KB, 460x460)
21 KB
21 KB JPG
>>100156168
>a MSc in machine learning
For what possible purpose?
>>
>>100156156
It's a very small company for now so I don't think so
>>100156233
It's probably the only CS master's worth getting at this point
>>
>>100156200
That dude is doing the bare fucking minimum
How come no one breaks his knees
>>
>>100156233
Because I thought it was interesting.
>>
File: JMChad.jpg (158 KB, 767x1024)
158 KB
158 KB JPG
>>100132061
>Learn some programming languages — at least C, Lisp and Prolog. It is also a good idea to learn one basic machine language.
https://www-formal.stanford.edu/jmc/whatisai.pdf
>>
>>100156266
And yet, Gnome is the most functional DE. KDE is a burning heap of alpha-stage trash. Tiling compositors are overrated memes. XFCE and friends are cool, I guess? I haven't really tried them.
Gnome is not optimal, and there are things I miss, but any time I try to switch away, I go back to it. And even if I used i3/sway for years I didn't miss them when I got used to gnome.
>>
What exactly is a lisp and why do i want it?
>>
>>100156842
it's a speech impediment and some people might think you sound cute with it
>>
hexl-mode corrupts a file after saving changes
what could be wrong
>>
>>100156798
What? Are we watching the same video?
>>
>>100157840
Lmao I misread and thought >>100156266 was a reply to pic in in >>100156233
He's a gnome maintainer and gets a lot of shit here on /g/ so I whiteknighted him.
>>
>>100156798
>Tiling compositors are overrated memes
1. at least they actually work. Gnome and KDE are both so riddled with bugs that they're unusable.

2. They let me focus on my applications instead of distracting me with panels and menus etc.
>>
>>100158203
>2. They let me focus on my applications instead of distracting me with panels and menus etc.
Gnome has very few panels and menus. I installed just perfect so now I don't even have the top bar. When I run Emacs the only thing of the DE I see is the title bar.
>>
>>100158203
>>100158327
Now you made me add (setq default-frame-alist '((undecorated . t))) so now nothing is visible beyond emacs. Wonderful
>>
Good morning sirs

>>100156798
Sirs I tell you to use cinnamon but you don't listen
>>
What is essentially the difference between CL and Scheme and why do people argue about which is better? I'm learning Scheme through SICP and wondering if I should bother with CL later or if the use cases are the same. How useful is it to know several Lisps instead of just using one?
>>
>>100158420
scheme is a barebones lisp that you will have to write a lot of functions yourself to do anything worthwhile. common lisp is a huge mess that can do most things you'd ever want to right out of the box. people argue because everyone wants to feel like they made the right choice and are morally superior to everyone else when in reality nobody does anything meaningful with either language so it doesn't matter.

also common lisp is better
>>
>>100158372
>Sirs I tell you to use cinnamon but you don't listen
I'm sure it's great! But Fedora has Gnome as the main version, which makes it the most tested out of all spins.
>Just use <not-fedora>
Not happening
>>
File: standards.png (55 KB, 610x500)
55 KB
55 KB PNG
>>100158420
CL = bloat
Scheme = shrimple
>t. /g/uy steele
>>
>>100158604
>1000 pages or more standard
Was this design-by-government?
>>
>>100158420
CL has the larger ecosystem which is ultimately what matters to me as I need to get shit done and not jerk off to simplicity
>>
(defvar *macro-var* 0)

(defmacro some-macro ( &body body)
(setf *macro-var* 0)
`(macrolet ((increasing-macrolet ()
(incf *macro-var*)
*macro-var*))
,@body))

(some-macro (increasing-macrolet))

Surprisingly this works. It assumes that the macrolets are macroexpanded right after the macro, which holds in SBCL but I am not sure how portable this code is. (It'd probably be more portable if I just made it require monotonicity instead of a specific sequence but can't be bothered).
>>100158604
Part of why scheem is a meem.
>>
>>100158460
>>100158604
>>100158642
>>100158760
Seems like Scheme is more of a teaching language while CL is the Lisp version which is actually useful in practice. I should probably learn CL later then
>>
File: clojure.png (282 KB, 1500x1500)
282 KB
282 KB PNG
>>100158782
>Lisp version which is actually useful in practice
Ergo, Clojure.
>>
>>100158834
Is Clojure really a Lisp?
>>
>>100158853
it has homoiconic syntax and macros, and there's
https://github.com/ruricolist/cloture and https://github.com/lokke-org/lokke so yes. Clojure IS a lisp.

Talking about Guile, anyone tried Hoot/Guile for Wasm new version yet? The IO feature looks neat, as is the resumable state image.

https://spritely.institute/news/spritely-goblins-v0130-object-persistence-and-easier-io.html
>>
>>100158834
if clojer is so useful, how come only sbcl can compete on the language benchmarks?
>>
>it's le modern
>it's le functional
"Programming is the only field as driven by trends as fashion"
I will use the old & tested, which permits for different programming styles (suited for different problems).
>>
File: clj.png (122 KB, 1200x600)
122 KB
122 KB PNG
>>100158853
It's Schrödinger's Lisp... but that's achyually a good thing.
>Guy Steele Says: Don't Iterate, Recurse, and Get rid of lisp cons!
http://xahlee.info/comp/Guy_Steele_parallel_computing.html
>>
>>100155984
because you're just gathering data infrequently for a report or experiment? if you have to wait 5 or 10 seconds who gives a shit if it's a one-off thing.
>>
>>100158996
>>Guy Steele Says: Don't Iterate, Recurse, and Get rid of lisp cons!
He didn't say that ex nihilo, but in the specific context of parallelization. Not everything is parallelizable, however.
Typical clojureturd dishonesty.
>>
>>100159028
>if you have to wait 5 or 10 seconds who gives a shit if it's a one-off thing.
But it can also be a matter of weeks instead of months. Or hours instead of days. That's way more important than "there's a 0.5 second pause when I click this button"
>>
>>100159079
sure, but that's almost never the case. even for large datasets you can expect to be done crunching in a couple of hours in a slower Lang like python
>>
I can live with a GC. but I wish SBCL had reference counting...
>>
>>100159119
>but that's almost never the case.
For you, maybe. In some other's cases it's a constant pain and a major issue.
>>
>>100159168
Why do you want slow code?
>>
>>100158941
>caring about synthetic benchmarks
how's this for a benchmark: The biggest bank in South America with 80 million customers runs on Clojure, including their backend, frontend, website and database. And instead of rewriting everything in a mainstream language as soon as they got big, they just keep digging deeper into the Clojure meme.
>>
>>100159227
embedded & games
fuck GC pauses. 2ms pause already caps my game at 500fps just by GC which is the refresh of some monitors nowadays.
>>
>>100159234
I fuckin ghate nubank I hope they burn. EVERY SINGLE DAY they send me 3 messages saying they will NEVER contact me asking for info. Jesus christ I think their algorithms classified me as an old boomer that gives his bank info away.
>>
>>100159353
>Wanting old people to get raped
Spotted the CL user
>>
>>100159367
I start using clojure if you guess correctly guess the interest they charge (hint, percentually it's more than 3 digits per anum)
>>
>>100159461
>guess correctly guess
>guess correctly*
>>
File: clojure scratch.png (32 KB, 1240x470)
32 KB
32 KB PNG
>>100158853
>Is Clojure really a Lisp?
Clojure is a Scratch
>>
>>100159490
wtf it looks great
this is clojure?
>>
>>100159246
Most successful 3D video game ever is written in a managed GC language.
Space probes ran Lisp with GC.
>>
>>100159514
so far it's just an idea for a Lisp/Clojure editor that I've thought of.
see >>100104431
>>
>>100159726
>>100159514
to be clear, the actual Clojure code looks like this:
(defn greet [occasion who]
(printf "Good %s, %s!" occasion who))

(greet "morning" "Anon")
>>
>>100159461
I know that south America has insane interest rates, but it's weird to be upset at a specific bank for that. If lower interest can be found elsewhere then just switch banks. If no lower interest rate exists, then maybe it's not the bank's fault that interest rates are crazy.*
>>
>>100160193
Anon, I...
>>
>>100159709
I kneel.
>>
I can't seem to wrap my head around the "counting change" program in SICP
>>
>>100160193
>if no lower interest rate exists, then maybe it's not the bank's fault that interest rates are crazy
My banking brother in christ the bank sets the interest rate it wishes. Funnily enough that is why we do not have a law that forbids "loan-sharks", they literally charge less.
> Uh Mr. senator, maybe forbidding 350% a.a loans will impact our profits!
>but it's weird to be upset at a specific bank for that.
It's not like america where you have a gazilion banks, some local and some national. we just have 5 + credit cooperatives.
Nubank and a few others have a insanse persecution rate, because they will sue for small amounts, make some bullshit interest rate, most clients are poor and will not pay, and then they file that under the big red "LOSS" folder so they can pay less taxes.
>uh you see Mr. Brazilian-IRS, that loan we gave out for 300$ at 500% .a.a? Turns out the standing debt is actually 500k $ after a couple years, and they didn't pay... It seems we can't pay taxes on that now...
Anyhow, I am derailing the thread...
>>
>>100161190
very relevant video, given who owns nubank:
https://odysee.com/@EldritchPenumbra:1/Rabbi-Yaron-Reuven---Usury---Weimar:b
>>
>>100161190
wtf I hate clojure now
>>
>>100161190
>It seems we can't pay taxes on that now...
Based
>>
>>100160369
It's using induction in a similar way the fibonacci program does.

you go through each coin, subtract from the total, and make change with the remaining total. This will walk through every permutation of coins.
And a selection of coins only makes change if the total is exactly 0 at the end.

The most confusing part to me was that SICP hasn't introduced lists yet, so you have to wrap your head around the way it is iterating through the 'list'. You rewrite the program later once you learn about lists, and it is much more straightforward.
>>
any updates on the concurrent mark and sweep GC for sbcl? remember hearing about it ~6 months ago but nothing else since.
would be nice to have it for a simulation game...
>>
What emacs mode(s) should I get to do sicp?
>>
>>100162582
Compile SBCL with --with-mark-region-gc --without-gengc and you'll have it.
>>
>>100162673
is that the concurrent one or just standard mark and sweep? I'm trying to see if it's possible to achieve sub ms GC time
>>
>>100162714
Yes, it's a parallel immix-like GC.
Should improve GC pauses on multithreaded computers (but depends on your thread count, the garbage you are collecting, adn the heap size of course).
>>
>>100162558
>go through each coin
>subtract from the total
I guess that's what's unclear to me. I've read the program several times, but I'm still struggling. Maybe I should wait until the chapter on lists?
>>
>>100162749
thanks, looks like I misunderstood. this is what I was referring to:
https://groups.google.com/g/sbcl-devel/c/VAA4SkQo3jM
the target of pause time maxing out at <100 microseconds is particularly exciting
>>
>>100163129
Oh? That's mighty interesting. I haven't heard at all about it.
Apparently not much work has been done on it since October; the branch has 0 commits, at least.
I should probably subscribe to SBCL-DEVEL, since it always has some interesting stuff posted to it. But anyways, here's a mail from two months ago:
https://sourceforge.net/p/sbcl/mailman/sbcl-devel/thread/trinity-3130499a-beec-4e22-a629-32c12c0d409c-1707698909103%403c-app-gmx-bs27/#msg58736400
>>
>>100162752
It is very confusing. working through it manually is helpful

so starting at
(cc 100 5)
evaluates to
(+ (cc 100 4) (cc 50 5))
then
(+ (+ (cc 100 3) (cc75 5)) (+ (cc 50 4) (cc 0 5)))
So each branch returns the instruction to evaluate the original amount with the next coin in line, plus restarting the whole process with the original amount - the coin value.


They are using kinds-of-coins kind of like an index, which they decode using the first-denomination function.
>>
>>100163296
Thanks anon.
Tree recursion (or just recursion in general) is really hard when you're used to normal imperative programming or OOP.
>>
>>100163364
Yeah it is confusing. I tried to force myself do the exercises in a recursive way when I could, but it is so much easier for me to do them iteratively. Most of the time it asks you to do them both ways anyway.
>>
>>100163391
Yeah. Funnily enough I just posted that but 1.11 is much harder to do iteratively than recursively
>>
i know this is an emacGOD general but has anyone here tried neovim for lisp development? is it usable
>>
>>100164095
>vim
>usable
>>
>>100158514
>>Just use <not-fedora>
blud is using fedora and acting shocked that only the foot is "usable"
>>
>>100159246
every single fucking time someone mentions GC in relation to gamedev in this board, it's some retarded take like that

1. 2ms pause doesn't mean it's gonna happen every single second. as crazy as that may seem, you still control memory allocations in GC'd languages. if you don't generate too much garbage, there's nothing to be collected
2. bro, literally no person in the universe cares about a 2ms pause in a game. it's so funny how people talk about it here. think about your favorite games, the ones you love the most. would you say "ughhhh no this shit is le unplayable" if it had a a 2ms pause every 30 seconds? like... this is bikeshedding on an astronomical scale. just make a good game and people will love it, performance is irrelevant as long as it runs
3. this is a personal estimate, I have no data to back it up, but I'd say 95% of all successful indie games are made in GC'd languages. there's the occasional outlier but most of them use unity and the ones that don't use stuff like XNA/monogame/FNA (hades, stardew valley), java/libgdx (slay the spire), love2D (balatro) and others in the same category. you'd be hard pressed to find a game developed by a small team in C, and even more to find one that sold, say, 1M copies. people just don't care about performance in the autistic level that it's discussed in this board.
>>
>>100166144
I used 2ms to show how even something considered really fast already limits your game to 500fps, just off GC. In CL, without working around it, you're easily looking at 10ms-20ms. 60fps is 16ms. on a high refresh monitor (e.g. 120) a 10ms pause keeping your game from having a stable frame rate is gonna make it feel laggy and tear. and yes you're right, it doesn't mean it's gonna happen every single second. that's part of the issue, it's inconsistent.
and yes most successful indie games are made in GC languages. they're also either a shitty 2d pixel game, or run like absolute ass (Minecraft, Rust, 7dtd, etc).
here's the thing; I want an *excuse* to use CL. I already know Rust and C. I have no reason besides wanting to for the hell of it. But there's no way I'm going to put myself in a ditch fighting against GC voluntarily. Even the guy that made Kambria or whatever it's called has bug issues open on his game's steam page about it being stuttery, and that's a fucking side scroller.
>>
>>100166305
rendering, physics and other bullshit can be done with fast code, other stuff can be done with regular gc shit. Crash bandicoot had the engine made in lisp.
>>
>>100166305
>here's the thing; I want an *excuse* to use CL. I already know Rust and C. I have no reason besides wanting to for the hell of it. But there's no way I'm going to put myself in a ditch fighting against GC voluntarily.
if your main use of programming is game dev then why are you even digging for excuses
>>
Any Magitians here? How do I make magit show the real date of a commit in the log instead of a relative date?
>>
>>100166421
yeah that's what I'm considering, embedding a scheme or something as a scripting language. though at that point it's not as cool lol..
>>100166442
I can't use CL at work, so I want something fun to do on my own time. I don't want to make another fucking crud app just to be able to use sexp syntax. also gamedev in theory would benefit a ton from the repl workflow given their interactive nature, it sounds really productive.
>>
>>100166457
Found it
>M-x customize-variable magit-log-margin
> value menu -> date using time format
>>
>>100164095
I've used NVIM for clojure, racket scheme and fennel development. It works fine just use conjurer or whatever it's called. Aside from that par-infer may also be something you need for the lisp you're working in (LFE and Picolisp need it).
>>
>>100164095
It should work
https://lispcookbook.github.io/cl-cookbook/editor-support.html#vim
>>
>>100166305
The 98% case in any reasonable GC is going to be 100 microseconds or less. That is barely above the noise floor of kernel task scheduling. And if your program is doing a GC more than once a second, you need to rethink your engine's design. Just because Unity's Mono runtime uses a barely operational hack for its GC (albeit a neat hack), that doesn't mean that you're going to notice GC latency in your game.
>>
>>100166305
kek what a retard
You will NEVER be a successful programmer
>>
>>100170101
I mean can't you literally just allocate all your memory at init and never do any GC at all the whole runtime if you want?
>>
>>100170491
There are plenty of options if you want to write Lisp and not use a GC. I don't think it's required though. It might be good on SBCL which iirc historically has had poor tuning for latency, but also there is a new Immix collector for it I've heard.
>>
>>100170491
How do you know how much memory you will need? If you count too low, your application will crash. Too high, and you're wasting user memory probably 99% of the time. There are practical issues too, like whether you allocate contiguous memory and hope that everything fits, even after allocations/reallocations. In that case, it might not be enough to decide how much memory you need, you need to decide beforehand how many instances of Person you have, all arrays and their length, etc.
Writing an app this way would be highly tiresome - way more work than just using Rust if you're terrified of GC pauses.
>>
>>100170632
It's not difficult if you design your program with it in mind. It's just a memory reuse strategy. Many people have done it numerous times.
>Too high, and you're wasting user memory probably 99% of the time.
Unused memory is swapped out.
>>
>>100170729
>It's not difficult if you design your program with it in mind.
So how do you know how many rows will be returned by your db calls? Or how many programs the user will be running when you're writing a scheduler?
>>100170729
>Many people have done it numerous times.
Of course, but that doesn't mean that it's feasible in the general case.
>>
>>100170749
Usually the goal with adding manually-managed objects in a GC language is not to eliminate allocation altogether but to reduce memory pressure in key areas. If you have a fast enough minor collector, you can use temporary objects to process your low-level data, which is substantially higher-level than Rust. I personally never do this except when I need certain space guarantees like when dealing with implementing a database.
>>
>>100170632
Well actually in a videogame you almost always know exactly how much memory you need since it's not like the player is dynamically allocating arrays. A certain area has a fixed number of assets, particle effects should probably just go into a circular buffer anyway to avoid slowdown, etc...
And any major changes to these parameters (entering a new area/building/level) takes loading time anyway so you can GC and load all the new memory at area boundaries.
>>
>>100170749
You bound everything by some fixed number. That's how no dynamic allocation code in general is written, how UNIX for example used to be written.
Probably easier in CL than in most languages since CL does genuinely have static allocation capabilities. (I quite like using serapeum:static-let occasionally).
>>
>>100170895
>takes loading time anyway so you can GC and load all the new memory at area boundaries.
A GC here would make it trivial to avoid a fragmented heap.
>>
>>100146911
>To use the "simple one step constant time" algorithm you actually need an entire computer algebra system which will be much SLOWER than just calculating it the normal way unless you need 100 billion digits of precision.
Or you just need to use the matrix method which basically amounts to using an ad hoc specialized implementation of arithmetic in Q(sqrt(5)). No "entire computer algebra systems" necessary.
>>
>>100172606
That's O(log n), the constant time algorithm is actually incomputable, even though you can write it down easily.
>>
>>100172673
What? Sure the exact method is logarithmic but using floats gives you a constant time calculation.
>>
>>100172955
That's not accurate at all as I said. We're not talking rounding error here either, I mean you can trivially compute integers with MILLIONS of digits even using the naive recursive algorithm in seconds, and no floating point library in existence can handle that without turning into arbitrary precision computer algebra.
Bigint is much simpler than bigfloat, and also much faster, as in order to get a high value sequence number we're talking about calculating sqrt 5 to millions of digits and them SQUARING IT, as opposed to just performing extended addition.

I mean I guess for a specific bounded case you could use fixed point and divide out the extra digits, but that still involves computing phi to a million digits, which in no possible world is faster than just adding two integers, no matter how large.
>>
Honestly, I'm surprised SBCL doesn't have more specialized array types. Like a array for CONSes or event just symbols. There's a large amount of places where this would probably result in decent performance/memory savings, at the cost of probably having more dispatches in the slow aref case
>>
>>100164095
I've used nvim for Clojure and wasn't too happy, although that's more due to Conjurer not being nearly as featureful CIDER.
But it's a lot lighter than a tricked out Emacs, which is relevant when you have to use it on a raspberry pi or a phone. It also comes with fairly good keybindings out of the box, so it might be for you.

There are several configs for Lisp programming btw. This one is heavily inspired by Doom Emacs:
https://github.com/nyoom-engineering/nyoom.nvim

This one was made by the dev of Conjure:
https://github.com/Olical/magic-kit
>>
Turns out switching from a struct with 3 slots (one (1) of them was an unsigned-byte 8 slot) to three arrays with the same content saved me ~600mb memory for my 10^6 element array (baseline is about 200mb dynamic space usage, so it still costs about 300mb, which is a lot more comfortable). Might be also a lot faster since a lot of the times I just access the unsigned-byte 8 slot
>>
>>100175176
Nice one phoe
>>
File: SICP.png (305 KB, 640x974)
305 KB
305 KB PNG
>>100162603
https://kchousos.github.io/posts/sicp-in-emacs/
>>
Something unrelated to eww in my config is making eww open all links in new buffers
Gonna have to bisect I guess
>>
>>100178361
thank you!
>>
>>100178988
Turns out it's hyperbole, I should've suspected it
>>
>>100179087
This behavior shouldn't be happening according to the hyperbole manual:
>'www-url'
> When not in an Emacs web browser buffer, follow any non-ftp URL
> (link) at point. The variable, 'browse-url-browser-function', may
> be used to customize which URL browser is called. Terse URLs which
> lack a protocol prefix, like www.gnu.org, are also recognized.
I think I'll just disable it as I rarely use it anyway
>>
>>100179139
you probably need to customize hpath:display-where
>>
>>100179087
i ended up just uninstalling hyperbole, it has fun ideas but it's wonky as fuck
>>
I just started learning Emacs and it feels part totally comprehensible and part clusterfuck.
>>
I really love Common Lisp just the way a really love Emacs.
Sure it has it's warts, idiosyncrasies, problems but it really is a well defined, thorough standard (even moreso if you include MOP as part of that) that reflects the languages that developed partly based on historical habits but also based on how large teams actually wrote large projects.
I also really like Clojure and Schemes but they don't have the same thoroughness and reflection of how things actually developed. They feel too idealised to the point where if you disagree with their dogmas or if they're not a good fit for your problem then you don't have much plan for recourse outside of forcing the problem to match the language or changing languages to match the problem.

Maybe soon I will truly understand why the Interlisp developers chose to go against the grain and define
(cdr nil) = nil
and why it became so popular afterwards.
>>
what is the coolest macro you've seen? It must be only a few lines long.
>>
In the same way Rust is written in Rust, could a Lisp be written in itself?
I guess it would have to be a statically typed/no GC lisp?
>>
>>100183667
SETF
>>
>>100183932
>I guess it would have to be a statically typed/no GC lisp?
A part of the runtime would have to be written in a subset of the language to ensure your values stay unboxed where required and you don't dynamically allocate in regions that operate with memory outside the GCd area but there's no reason it would have to be statically typed or without GC.
I believe the goal of SICL is to write a complete CL implementation only in CL. Usually this isn't done just for ease of bootstrapping and ease of portability though.
>>
>>100183932
Writing a GC requires byte-level memory manipulation, but that doesn't imply static typing
Before C, most systems languages were typeless like assembly, and even C itself is an extension of such a language (B)
>>
>>100183932
Loko Scheme is written entirely in itself, including the GC. I don't know if you can entirely call it Scheme code though, since it's handwritten in assembly using Scheme's constructs.
>>
>>100183932
Google metacircular evaluators.
Basically yes, lisp can implement itself in about ~100 lines, and infact the very first lisp was programmed ONLY in itself and hand-compiled into machine code.
You can program lisp into basically any language in a few hours, it was one of it's main selling points in the early days.
Or from another point of view chez scheme's compiler is almost 100% written in chez scheme.
You can ever write lisp in pure lambda calculus, and several people already have, including an amazing one only 300BYTES in size, small enough that you can post the entire source code in a single post.
>>
>>100184909
>Google metacircular evaluators.
This doesn't really answer any questions after "how do I write a basic eval".
>Basically yes, lisp can implement itself in about ~100 lines, and infact the very first lisp was programmed ONLY in itself and hand-compiled into machine code.
McCarthy's original S-expression language was specified in itself, not written in itself.
>You can program lisp into basically any language in a few hours, it was one of it's main selling points in the early days.
Unrelated?
>Or from another point of view chez scheme's compiler is almost 100% written in chez scheme.
Chez Scheme doesn't really do anything special here.
>You can ever write lisp in pure lambda calculus, and several people already have, including an amazing one only 300BYTES in size, small enough that you can post the entire source code in a single post.
Unrelated?
>>
>>100185385
You're unrelated.
>>
>>100183932
SBCL is written almost completely in Common Lisp. In general, most Lisps are written in themselves.
>>
Bug was corrected via duplication of certain data structures upon insertion into some other collection. All my homies HATE tempthreads.
Also, the 3rd
go run .
does not emit output due to those echoLine side effects already having occurred in the previous iteration.
>>
>>100185385
So what do you actually want to know? Your initial question was answered by a few people, yet you seem dissatisfied with the answers.
>>
>>100181438
>part clusterfuck.
Unfortunately, feeling like a clusterfuck is an unavoidable side effect of being created in the 80's.
>>
>>100185882
SBCL has some essential parts written in C, especially in the GC
It should be possible to rewrite most of that code in a restricted Lisp dialect but right now it's not an example of what that anon was asking about
>>
>>100186405
Lmao
Ok, time to work on parallelism now. If I'm correct in my assumptions and current construction, this should not be a horrible lift.
https://www.youtube.com/watch?v=qUIYjiMAlgk
>>
>>100187173
I'm not the one who asked the question lmao I was just refuting that answer.
>>
>>100123076
How am I supposed to learn doom emacs if every page of documentation I look up seems to be incomplete? Do you guys know good tutorials? Or is doom just a meme?
>>
>program code in scheme doesn't actually get read by read
Uuh and this thing is supposedly a lisp?
>>
>>100189475
Doom is one of the biggest memes there is
>>
>>100189475
Use Spacemacs
>>
>>100189475
>How am I supposed to learn doom emacs if every page of documentation I look up seems to be incomplete?
this was/is my biggest gripe with doom emacs.

I agree with >>100190990 that Spacemacs is a lot better in this department. It technically has even less documentation, but at least it's all in one place instead of hidden inbetween a thousand TODO stubs.

>Do you guys know good tutorials?
There's DistroTube's videos about Doom Emacs. If you're new to vim/evil keybindings, go through evil-tutor. Beyond that, the various howtos and workarounds on Doom's Discourse are probably the best resource.
>>
>>100189475
there's a bunch of video tutorials but im not sure what you're looking for? it's just emacs with evil mode configured about as well as it can be by default and whatever packages you choose to enable
i recommend looking at the modules you enable and seeing which packages that installs and then just reading the docs of those packages
>>
flymake seems like a major pain in the ass to set up compared to flycheck
>>
>>100191232
Everyone I know who tried to get into Emacs via doom bounced off, terrible experience.
Spacemacs Just Works and I haven't had to fight with it. Documentation is built in and easily searchable
>>
>>100191819
How so? If you use eglot, it kinda just works out of the box.
>>
I'm looking into trying CL for a game. Can someone with experience translate this shitty Rust benchmark I made to CL? I tried with what little CL I know and the discrepancy was obviously too big.

https://pastebin.com/SxJZ70Es
>>
I'm learning Emacs because it's getting a pain to use Nano, but I'm not sure exactly what I will need (I'm just doing C right now). I assume I could compile and run it with keybindings, it's getting annoying to switch windows on tmux to run gcc even if I just hit up and enter.
>>
>>100192396
sure, but then you've only got the eglot backend for flymake running
i can't get it to use flymake-kondor for example
maybe im just retarded
>>
>>100192974
there's the m-x compile command.
>>
>>100191819
Flycheck is basically a better flymake, so if it's easier to set up for you, you may as well use it.
>>
>>100192796
(defun random-array (size)
(let ((array (make-array (list size size size) :element-type '(unsigned-byte 8))))
(loop for i from 0 below (* size size size)
do (setf (row-major-aref array i) (random 3)))))
Λ> (time (random-array 256))
Evaluation took:
0.687 seconds of real time
0.686220 seconds of total run time (0.678617 user, 0.007603 system)
99.85% CPU
951,753,096 processor cycles
16,777,232 bytes consed

Seems like most time is just spent on the 'random call. Apparently that is not very optimized in SBCL (calling ironclad:crypto * 256 256 256 is about 5 times faster):
(time (crypto:random-data (* 256 256 256)))
Evaluation took:
0.099 seconds of real time
0.100386 seconds of total run time (0.004359 user, 0.096027 system)
101.01% CPU
138,878,826 processor cycles
16,777,232 bytes consed

If the Rust stuff is much faster it's probably doing vectorization or something, possibly with the hardware x86 RNG (SBCL only uses its own MT19937 random generator as RANDOM takes an optional STATE argument) which I presume is somewhat faster.
Luckily you'd want some noise function for terrain generation, not the #'random function, so this shouldn't matter too much I think.

Also, fastest random function I found on my Lisp image was this:
(time (cl+ssl:random-bytes (* 256 256 256)))
Evaluation took:
0.015 seconds of real time
0.018230 seconds of total run time (0.018098 user, 0.000132 system)
120.00% CPU
25,191,446 processor cycles
33,554,464 bytes consed

which just uses the OpenSSL random number generation.
>>
>>100193401
Wow thanks for that anon. Yeah the rust code is probably doing vectorization, is there any way to apply these types of optimizations in CL or do I have to do them manually?
>>
File: emac ibuffer.jpg (491 KB, 1080x2400)
491 KB
491 KB JPG
>>100192974
If you use emacs you don't really need tmux, because you can run terminals inside emacs.
You can also run emacs as a server/daemon so any command run in it will stay running even when you close the window and terminate your ssh session.

Ans yeah you can configure keybindings to run arbitrary shell commands.
>>
>>100193473
SBCL is about as fast as O2 GCC code if you disable all x64 extensions. What makes GCC faster is the better leveraging of CPU extensions that have come out since 2003. This is complicated to add to a compiler in a generic way. Implicitly converting normal code into SIMD code (autovectorization) is one of those methods. In my opinion, autovectorization is a huge mistake, but the GCC and LLVM devs have proven over and over again to prefer benchmark performance over stability and reliability.
All this to say, if you get a CL package that lets you write SIMD code, you can make some very fast programs.
>>
>>100193473
You have to do them "manually" but often writing vector operations as vector operations is simpler anyways (and autovectorization usually applies only in those trivial cases):
(defun random-array (size)
(let ((array (make-array (list size size size) :element-type '(unsigned-byte 8))))
(replace (sb-ext:array-storage-vector array)
(crypto:random-data (* size size size)))
array))

(Yes, this uses an SB-EXT function. I don't think there's a convenient way of generating a multi-dimensional array from a vector in ANSI CL annoyingly).
>>
>>100193676
>>100193904
Gotcha, that makes sense. Thanks! I'll play around with it and decide at some point if it's worth migrating what I have so far in Rust. I'm not relying on an editor for my game (just wrote my own Trenchbroom integration) so the only remaining concern is how annoying GC might be to deal with. An anon posted the other day something about a real-time GC in development so maybe that'll come out soon. I know I can do arena allocation and pre-allocate everything up-front but that sounds kinda annoying to manage if I'm being honest.
As an aside, would it be too crazy to just manually run the GC after a while? In my game the player can go to sleep, would be cool if I could just wait until the screen goes black, run the GC, and then the next day begins. If there's a lot of garbage would it take more than a couple of seconds to clear out?
>>
>>100193632
That's cool, is there no reason to use tmux or screen then? Are there things that only work on terminal emulators? Might as well just use Emacs as my term.
>>
>>100193985
I'm writing a game in (SB)CL myself, but its more of a turn based thing, so GC pauses are irrelevant for me.
>As an aside, would it be too crazy to just manually run the GC after a while?
No, and this is fairly standard practice I believe
>If there's a lot of garbage would it take more than a couple of seconds to clear out?
Depends on your heap size, I think.
Longest I've ever seen a (sb-ext:gc :full t) take was something like a second, on a 12 or 16 GB heap.
>>
>>100193985
Manually running the major GC at opportune times is a classic technique called scavenging. The technique is that you run the minor GC whenever because it has essentially no delay and gets rid of 99% of your objects, and then when you're in an idle state, you trigger a major collection.
I wouldn't worry too much about GC though. A good GC only scans references and potential references. I don't know how SBCL works, but in my Lisp of choice, a vector of numbers or bytes, even if it's gigabytes big, will be scanned instantly, because it is only seen as a singular opaque object with no references. If you keep your data relatively flat, then GC time should be very good. You'll have to experiment for yourself though.
>>
>>100194080
>>100194100
Thanks! My main concern is that the only noteworthy game I could find made in CL is Kandria, and even with the new GC (not the realtime one still in development), it seems a non-trivial amount of frame times exceed the target framerate. Doesn't help the game is a 2d sidescroller a lot simpler than what I'm trying to make...
If I'm running GC on auto I'd like to keep GC times under 2-3ms if possible to avoid stutter at higher framerates. Luckily that new GC in development seems to have a worst-case running time of 100 microseconds which sounds fantastic. Wondering if it'll manage to be released within the next couple of years. Not familiar with SBCL development speed but it looks like it's just missing polish, the main work seems to be there.
>>
>>100194334
By the time you finish development of your game, the GC story in SBCL will probably be a lot better. I was comparing SBCL's GC to Chez Schemes's, but am now realizing upon testing that the Chez GC is tuned much better for this kind of use. It seems that Chez doesn't even scan data that hasn't been mutated since the last collection, though mutation speed does suffer for this. This is ideal for a game where a majority of your heap will not be mutated for its entire lifetime.
>>
>>100193401
>it's probably doing vectorization
Just paste it on godbolt and have a look instead of guess what the rust compiler is doing. There's actually no vectorization in sight.

>>100193473
Still "applying it manually" but SB-SIMD is pretty easy to use. Though random number generation will always be slower than creating and setting arrays so if you want a serious speed up you should be looking at a vectorised random integer implementation.
>>
>>100192122
isn't spacemacs even slower than doom emacs?
>>
YOU. Yes, you.
Would you use Common Lisp or Clojure to make a videogame?
>>
>>100195420
common lisp
clojure is not suitable for high performance applications
t. closhart webshitter
>>
>>100195420
if it's a board game: clojure

for something like a 2d platformer or RTS or even an FPS, anything with a lot of movement: CL
>>
>>100194559
Sounds promising, thanks.
>>
>>100195456
Really?
I was thinking:
1) On portability: CL and the JVM are both portable.
2) On performance. CL > Clojure but it wasn't a key differential.
3) Both have hot reloading to enable me to hack around in levels without 6 billion hour compilations.

>>100195509
I see. I wouldn't have imagined it like that since there are indie games made with Java.
>>
>>100195420
I would and do pick Scheme.
>>
>>100195563
Which one?
>>
>>100197695
>>100195563
>Protestantism be like
>>
>>100197768
sir please, protestantism is a trigger word for me
https://youtube.com/watch?v=p2_p_qwIyZ4
>>
emacs is so fucking cool
you can configure it, play tetris, configure it, code, configure it, configure it, play tetris, configure it, and even go on the internet
>>
File: 1713263511922761.jpg (89 KB, 1120x1280)
89 KB
89 KB JPG
>>100198582
Don't forget that you can also configure emacs to do exactly what you want.
>>
>>100198582
>>100198743
also you can configure it
>>
>>100197695
Chez at the moment, but a medium-term goal is to get the runtime ported to Gambit.
>>
>>100194559
Ok after much deliberation I decided I want to give CL a shot for a game with Raylib. What's a good resource to learn CL properly? I don't want an intro to programming book, I just want to learn the lang + how to use the REPL correctly to debug/find bottlenecks.
>>
>>100199297
It depends. What languages do you know well?
>>
>>100199297
There's some YouTube series that seemed good about graphics programming in CL that IIRC only assumed minimal knowledge of the language.
Or are you specifically after a book?
>>
>>100200252
Pushing pixels with lisp
>>
new bread
>>100200472
>>100200472
>>100200472
>>100200472



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.