[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: wizard.jpg (2.93 MB, 2448x3264)
2.93 MB
2.93 MB JPG
>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)

>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://stumpwm.github.io (CL WM)
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://github.com/franzos/awesome-guix (Awesome Guix)

>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 >>100417851)
>>
>>100504821
(revive-and-run)
>>
File: 1695688646891.png (174 KB, 640x640)
174 KB
174 KB PNG
>>100504821
>>
File: edraw-screenshot.gif (1.28 MB, 710x638)
1.28 MB
1.28 MB GIF
faaking fantastic
https://github.com/misohena/el-easydraw
>>
>>100504946
this is amazing
>>
File: 1569016242284.gif (84 KB, 640x640)
84 KB
84 KB GIF
Scheme!
>>
>>100504946
holy bloat
>>
>>100504946
why are asian windows emacs users the most based computer using demographic?
>>
>>100504946
emacs really is the best operating system
>>
>>100504946
This might be surprisingly useful
>>
File: STAR.gif (841 KB, 675x754)
841 KB
841 KB GIF
>>100504946
ファンタスティック!
https://github.com/misohena/el-easydraw/wiki/Screenshots
>>
>>100429615
If you end up using Julia, use julia-snail for REPL interaction. My favorite feature is its ability to use per-project .dir-locals.el files to make it possible to run multiple Julia REPLs under one Emacs process.
https://github.com/gcv/julia-snail
>>
Guys I had sex two days ago and all the lisp knowledge left my body... what the FUCK do I do? I've already started an emergency regimen of zinc and vitamin d supplements but I worry that my powers may not return in a timely manner, hindering my efforts to save the world.
>>
File: 1700897128379421.png (951 KB, 1440x1080)
951 KB
951 KB PNG
Remember that the IRC Lisp community decided that Lisp is not functional.Therefore, from this moment on, using functional programmino in Lisp shall be treated as a criminal offense,
>>
>>100509740
If they're vaxxed, their opinion doesn't matter.
>>
>>100504946
>circle tool
Gimp bros...
>>
>>100509687
(setq global-celibate-mode t)
>>
>>100509687
ywnbaw (you will never be a wizard)
>>
I want to try functional programming, but every side project idea I have for it, I say "Why don't I just make this in C?"
>>
>>100511359
You can do functional programing in C, you don't have to use every functional principle ever made.
I find just pure functions alone to be a pretty big benefit
>>
>>100509740
Lisp is an imperative language.
Scheme (a completely distinct concept) may be advertised as "functional" (even if it is in reality DYS-functional)
>>
How dr racket, and scheme developers document their code if scheme has no docstrings?
>>
File: スペイン内戦.jpg (1.37 MB, 1500x1059)
1.37 MB
1.37 MB JPG
>>100512190
Very imperative, indeed.
>LISP has a partially justified reputation of being more based on theory than most computer languages, presumably stemming from its FUNCTIONAL form, its use of lambda notation and basing the interpreter on
a universal function.
>5. Composition of functions as a tool for forming more complex functions.
https://www-formal.stanford.edu/jmc/lisp20th.pdf
>>
>>100512448
good mornign sir.
>>
>>100512623
Good afternoon Vinicius Da silva.
>>
>>100512623
also it drives me insane that the retards that make guile added docstrings, but nowhere in the manual they are mentioned.
>>
>>100512677
desu it looks awfully bloat.
>>
>>100512448
Racket has a language for documentation called Scribble. All their official docs are written in this language.
https://docs.racket-lang.org/scribble/index.html
>>
i would like to thank the python ecosystem for becoming such a pile of sloppy diarrhea that i've become tempted to switch to lisp full time
>>
>>100512705
Thanks! I didn't notice it before.
>>
>>100512648
I'm actually Walter Daividison da conceição, but thanks you man.
>>
>>100512756
CL system will never break, but its full of 80% done packages and the web stuff is made by 1 (one) transsexual individual in Switzerland, once she dies its ogre. Scheme has jack shit, save for some really specific things, and you will mostly have to implement them yourself.
>>
>>100512781
>she
>>
File: POWA.png (1.75 MB, 1080x1800)
1.75 MB
1.75 MB PNG
>>100512804
LOL'd
https://odysee.com/@XahLee:b/xah-talk-show-2023-07-31:4?t=3494
>>
>>100512781
>its full of 80% done packages
still not much worse than python these days tbqhwu
data "scientists" were a mistake
>>
>>100509740
>IRC Lisp community
literally who
>>
>>100504821
I'm building a saas in clojure ama
>>
File: prog.jpg (1.66 MB, 3000x3000)
1.66 MB
1.66 MB JPG
>>100516907
Why Clojure?
>>
>>100512594
He meant functional as procedural. Not what modern dysgenics claim to be (dys)functional programming.
>>
>>100517268
I can't build it in c
I can't build it in python
I can't build it in emac lisp
so that leave clojure :D
>>
While chez seems one of the best, how the fuck do you do "stuff" in it? Most others have a way to install srfis and libraries. How do I even look for a "http-client" for chez?
>>
>>100512781
Lisp is too individualistic. Its easy to adapt package. To yourself.
Only thing missing is graphics since it requires retarded abstractions. I hate how I even have to care about the whole graphics pipline to display a square on screen. Its just dumb.
>>
Do I need setq in blocks like this? I'm not sure if modes are special in that they don't need setq.
(add-hook 'pdf-view-mode-hook (lambda ()
(auto-revert-mode 1)
(display-line-numbers-mode -1)
(setq pdf-view-resize-factor 1.1)))
>>
File: 1707627164451767.jpg (132 KB, 782x576)
132 KB
132 KB JPG
>>100518956
>While chez seems one of the best, how the fuck do you do "stuff" in it? Most others have a way to install srfis and libraries. How do I even look for a "http-client" for chez?
For a http client you could use https://akkuscm.org/packages/ocelotl/,
(library-directories)
lists where import searches first which you can modify with --libdirs

Section 2 and 10 of the chez manual cover library usage https://cisco.github.io/ChezScheme/csug9.5/
>>
>>100517268
https://gelbooru.com/index.php?page=post&s=view&id=7002388
>>
>>100520859
>akku
that is really nice thanks
>manual
I've skimmed it over a few times and missed that. Thanks schemer.

Using scheme is like piecing a puzzle with the standards, Racket docks, guile and chez documentation. If only autists could work together.......
>>
>>100521153
There's a mechanism for loading portable libraries where the scheme implementation is appended to the file, for example (import (local library)) loads ./local/library.chez.s or ./local/library.guile.s for chez and guile respectively, but I haven't encountered it much in the wild
>>
File: 1700504605354807.png (579 KB, 1200x1000)
579 KB
579 KB PNG
Today I found out flatmap can just be written (apply append (map f x)), I was using the longer definition from SUSsman's book for the longest time
>>
File: SUS.jpg (487 KB, 1595x2225)
487 KB
487 KB JPG
>>100522126
>SUSsman
>>
emacsars, does eglot support multiple servers at once for a single mode? like ruff and pyright for python
>>
>>100509740
Being a functional-only language or a language that allows the functional style are 2 totally different things.
>>
File: 1712033025855611.jpg (190 KB, 770x600)
190 KB
190 KB JPG
>struggling to get through chapter 1 of SICP
The math/logic is hard, thinking in the way the authors try to make you think is hard, and the scheme syntax is counterintuitive for someone who's used to python, so that doesn't help either.

Should I just drop it and come back to it another time?
I wanted to read a book that would make me a better programmer by teaching me about data structures, algorithms, and making me really understand programming. But it feels like I bit off more than I could chew. Would appreciate some advice.
>>
>>100525563
Its an intro text for CS. It uses math and EE stuff because most students there had classes on that on the previous semester. There is a JS version kek.
>>
Google is failing me.
In org-mode is it possible to refer to values in the text, inside tables? Like take a number being mentioned somewhere and "sync" it with a cell?
>>
>>100525732
I don't know JS
I found this which is supposed to be a Python version https://www.composingprograms.com/ but it's not so much the language I struggle with, it's the exercices and some of the concepts being presented.
>>
I use to be able to highlight things and then overwrite them my typing. Now I can't. What mode have I switched off?

>>100525563
SICP is either the hardest or second hardest book I have ever read. If it filters you too hard, switch to How to Design Programs.
>>
>>100525823
>How to Design Programs.
Is the content the same, just more digestible?
>>
I'm confused. Delete-Selection mode is on, but my highlighted text does not get deleted when I type. What's up?

>>100525846
Pretty much.
>>
File: 2024-05-17_23-55.png (1.32 MB, 1920x1080)
1.32 MB
1.32 MB PNG
>>100524013
怪しい!
>>
>>100525881
>I'm confused. Delete-Selection mode is on, but my highlighted text does not get deleted when I type. What's up?
I have had problems with it too. Try
(customize-set-variable 'delete-selection-mode t)
>>
>>100527063
What font is that?
>>
>>100527063
ゴクン for slurp is kinda funny.
>>
>>100527476
https://www.freekanjifonts.com/japanesefont-nagayama-kai-download/
>>
>Guile
(assoc key alist)
(assoc-ref alist key)

its all so tiresome
>>
>>100527587
forgot my image
>>
File: image.png (224 KB, 960x640)
224 KB
224 KB PNG
>>100527587
>>100527600
(define (swap proc)
(lambda (x y) (proc y x)))

((swap assoc) alist key)
(assoc-ref alist key)
>>
>>100528150
might just do (cdr (assoc ...)) then. This is the kind of retarded mistake that lingers forever because changing it breaks everything done before... Fucking gnutards
>>
>>100504946
Based and 趣味者 pilled.
>>
recur)
>>
>greentext anywhere
(highlight-lines-matching-regexp "^\s*>" 'hi-green-b)
>>
have you read your sicp today?
>>
File: LOL.png (1.12 MB, 1280x720)
1.12 MB
1.12 MB PNG
>>100532664
No, I'm reading LOL today.
http://landoflisp.com/lol.mp3
http://xahlee.info/comp/land_of_lisp.html
>>
>>100525823
>SICP is either the hardest or second hardest book I have ever read
Retard-kun...
>>
File: possessed.png (822 KB, 1438x790)
822 KB
822 KB PNG
>>100532664
HAR!HAR!HAR!
>>
I'm thinking of implementing the 9p protocol in Common Lisp or Clojure.

Is this a project worth undertaking? I know I can do it, it is just I am wondering if anybody is interested in this kind of project.
>>
>>100509740
The "IRC Lisp community" is nothing but a bunch of nocoders who spend more time arguing about pointless shit and arbitrary definitions than actually writing code. Don't take them seriously.

Just look at this genius: https://youtu.be/pkqQq2Hwt5o?si=46RhN55F6FY1cMfy&t=118
>writes and publishes an entire fucking BOOK about the common lisp condition system
>by his own admission, has never even written a full application in lisp
>>
>>100534551
If you have to ask whether it's worth it, the answer is no.
>>
File: 三位一体.jpg (896 KB, 1280x720)
896 KB
896 KB JPG
FAANTASTIC!
https://nlnet.nl/project/Pre-Scheme/
>https://youtu.be/FiVu7Lyfh9g?t=4
>>
>>100536633
what the fuck
>>
>>100536633
;;; btree: an example recursive Pre-Scheme record type

;; NOTE: Records are really pointers to a struct, so the recursive use
;; of btree-node below means the struct contains two pointer fields and
;; an integer. The constructor allocates and returns a pointer.
(define-record-type btree-node :btree-node
(make-btree left right value)
(left btree-node btree-left)
(right btree-node btree-right)
(value integer btree-value))

;; XXX: Records can't be created at top-level; "no evaluator for MAKE-RECORD"
;; (define bnull (make-btree null-pointer null-pointer 0))

(define (btree-equal? a b)
(or (eq? a b)
(and (= (btree-value a) (btree-value b))
(btree-equal? (btree-left a) (btree-left b))
(btree-equal? (btree-right a) (btree-right b)))))

(define (deallocate-btree t)
(if (not (null-pointer? (btree-left t)))
(deallocate-btree (btree-left t)))
(if (not (null-pointer? (btree-right t)))
(deallocate-btree (btree-right t)))
(deallocate t))

(define (main)
(define out (current-output-port))
(define null (null-pointer))

(let* ((a1 (make-btree null null 6))
(b1 (make-btree null null 5))
(c1 (make-btree a1 b1 4))
(a2 (make-btree null null 6))
(b2 (make-btree null null 5))
(c2 (make-btree a2 b2 4)))
(cond ((btree-equal? c1 c2)
(write-string "trees are equal\n" out))
(else
(write-string "trees are not equal\n" out)))
(deallocate-btree c1)
(deallocate-btree c2))

0)

More examples:
https://codeberg.org/flatwhatson/prescheme-demo
>>
File: 1693311518719547.png (481 KB, 842x471)
481 KB
481 KB PNG
>>100536633
>>100538193
>>
File: 2024-05-18.png (882 KB, 1200x900)
882 KB
882 KB PNG
we basic formatted printing now

(define (format pattern . parameters)
(define (format-internal pattern n length parameters)
(cond
[(< n length)
(let ([dispatch (string-ref pattern n)])
(cond
[(eq? dispatch "~")
(let ([type (string-ref pattern (+ n 1))])
(cond
[(eq? type "a")
(display (car parameters))
(format-internal pattern (+ n 2) length (cdr parameters))]
[(eq? type "%")
(newline)
(format-internal pattern (+ n 2) length parameters)]
[t
t]))]
[t
(display dispatch)
(format-internal pattern (+ n 1) length parameters)]))]
[t
t]))
(format-internal pattern 0 (string-length pattern) parameters))


the weird (t t) cond clauses are to fill dangling ifs (which make my lisp segfault atm)
>>
alias e="emacsclient -n"
alias en="emacsclient -nw"
alias ef="emacsclient -n -c"
>>
>>100541103
fish:
abbr -a emac emacsclient -nw -c -a \'\'
>>
File: 51-16.jpg (270 KB, 1300x1035)
270 KB
270 KB JPG
「面白い」
https://lem-project.github.io/modes/guile/
>>
>>100542737
>tetris is ugly
pass
>>
File: !.jpg (102 KB, 500x537)
102 KB
102 KB JPG
>>100542835
FAAAKHEAD
>>
interested in trying out lem, something about having the whole ecosystem in CL sounds pretty badass. does it perform better than emacs? e.g. is it multithreaded?
>>
>>100543281
ok wait this thing starts up instantly, kinda crazy
>>
(list (cons variable-from-program result-from-elsewhere)
(cons "p1" next-page)
(cons "p2" "0")
(cons "p3" classPK)
(cons "pn" n))

Is there a more elegant way to build an alist from a mix of hard-coded values and some amount of stuff from the program? Using scheme, sirs.
>>
File: 1715339446928257.jpg (178 KB, 850x907)
178 KB
178 KB JPG
I can now use elisp and notify-send to change the volume of the current pipewire sink
(defun notify-get-vol ()
"Use notify-send to display a cute picture of reimu and the current volume"
(interactive)
(shell-command "wpctl get-volume @DEFAULT_AUDIO_SINK@")
(with-current-buffer "*Shell Command Output*"
(progn
(replace-regexp "\n" "")
(setq vol (buffer-string)
pic "~/.emacs.d/lisp/pictures/1715339446928257.jpg")))
(shell-command (format "notify-send -i %s \"%s\"" pic vol)))

(defun notify-raise-vol ()
(interactive)
(shell-command "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+")
(notify-get-vol))

(defun notify-lower-vol ()
(interactive)
(shell-command "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-")
(notify-get-vol))

(defun notify-mute-vol ()
(interactive)
(shell-command "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle")
(notify-get-vol))


Now I can use emacsclient to make the functions accessible to my window manager
emacsclient -e "(notify-mute-vol)"
emacsclient -e "(notify-lower-vol)"
emacsclient -e "(notify-raise-vol)"


comf
>>
I'm trying to get general.el and pdf-tools to coexist. I've used general.el to create a SPC menu (like Spacemacs and Doom have). However, pdf-view-mode has a binding for SPC that takes precedence over my own SPC binding.

How do I unbind SPC in pdf-view-mode so that it falls back to the SPC that I setup using general.el?
>>
>>100543595
`((,variable-from-program . result-from-elsewhere)
("p1" . ,next-page)...)
>>
>>100545421
(define-key pdf-view-mode-map (kbd "SPC") nil)
>>
>>100535033
Are you sure? I've always heard that IRC is the best way to get a Clojure job.
>>
>>100543595
Good morning please making the consider
(define (new name)
(let ((count 0))
(lambda ()
(set! count (+ count 1))
(format #f "~a~a" name count))))

(define (values->alist name . values)
(let ((key (new name)))
(map (lambda (v) (cons (key) v)) values)))

(values->alist "p" 1 2 3) => (("p1" . 1) ("p2". 2) ("p3" . 3))
>>
>>100511915
>You can do functional programing in C
How?
>>
>>100547605
Write pure functions and pass by value when possible, fall back to mutable references when necessary.

Here's an article (well, a mirror) from John Carmack about the benefits of using a functional style even in non-functional languages:
http://www.sevangelatos.com/john-carmack-on/
>>
I looked at this image and I was expecting the code to output something like "good morning sir!" After carefully considering the code together with the post you replied to, I no longer think it outputs that
>>
File: cacooldemon.jpg (46 KB, 823x643)
46 KB
46 KB JPG
>>100547847
I see. Thanks, /g/entleman.
>>
>>100545716
>>100546441
thank you kind sirs
>>
File: eshapes.png (84 KB, 675x1076)
84 KB
84 KB PNG
>>100504946
>>100508188
>new release
https://github.com/misohena/el-easydraw/releases/tag/v1.2.0
>>
is there a fully-feature org-mode table library that can approximate calc/excel for basic tasks? my budget is becoming complex and i'm tired of having to look in the manual to remember how vsum works for the 1000000th time.
>>
>>100504946
this is nuts. i wish i had this in my undergrad.
>>
>>100504946
>>100505119 >>100506099 >>100506184 >>100506238 >>100506961 >>100508188 >>100510172 >>100528610 >>100553861 >>100554824
You're supposed to use the DOT language or LaTeX or just fucking edit SVG as XML directly you FAAAKheads.
What is this fascination with WYSIWYG point-and-click shit. This is the emac general now act like it.
>>
>100556697
>no you can't develop emacs extensions or talk about them in emacs, you should things my way jus tbecauseeeeeeeeeeeeeeee
1 x (you)
>>
>>100557064
SIR I merely intended to bring up alternatives that I find preferable in a joking manner. I am sorry if my attempt at humor has not been adequately obvious and perceived as inflammatory.
>>
>>100554656
I don't think there's a way to get Org to feel like an actual spreadsheet.
>>
I am using Guile, in chez I guess I'd use engines for this.

I am requesting stuff from http that might take a while. How can (call-with-timeout (get-stuff-from-http) ...) ? If the timeout is reached then it closes the port and moves on?
>>
File: fdskfjseffd.jpg (159 KB, 1500x1500)
159 KB
159 KB JPG
>>100556697
>edit XML directly
</></></></></></></></></>
>>
>>100557654
>edit lisp directly
))))))))
>>
>>100557644
Maybe one of these? desu I use the timeout flag for guile's curl binding so it's a good question how to do it generically
>select reads writes excepts [secs [usecs]]
>This procedure has a variety of uses: waiting for the ability to provide input, accept output, or the existence of exceptional conditions on a collection of ports or file descriptors, or waiting for a timeout to occur.
https://www.gnu.org/software/guile/manual/html_node/Ports-and-File-Descriptors.html#index-select
>expect is a macro for selecting actions based on the output from a port. The name comes from a tool of similar functionality by Don Libes. Actions can be taken when a particular string is matched, when a timeout occurs, or when end-of-file is seen on the port.
https://www.gnu.org/software/guile/manual/html_node/Expect.html
>>
>>100557825
looks useful. I am using the http-client facilities so I'd have to rewrite it with the port stuff.
>>
File: 1663778783571.gif (184 KB, 320x320)
184 KB
184 KB GIF
>>100543607
Pretty neat, I'm gonna try adding some similar wrapper functions for xsetwacom in emac, which cute pic are you using btw?
>>
I got gifted SICP and i want to learn Clojure. Am I fine just doing the exercises in the book using clojure?
>>
hey, is there some tag in org-mode that prevents from heading from rolling out when pressing shift-tab / org-shifttab?

i only know one tag that has some sort of special use
:noexport: prevents from exporting this section
are there more magic tags>?
>>
>>100525769
Name the table and apply header argument :var table=table-block-name. It comes out as a list of lists, then car, cdr or nth to pick off the value
>>
>>100504821
>Ironclad should not be considered safe against side channel attacks.

>Some algorithms can be safe against side channel attacks on some architectures using some Common Lisp implementations, but in the general case it can’t be guaranteed. This is due to the fact that integers and arithmetic functions of Common Lisp implementations are usually not safe against side channel attacks.

What does this actually mean?
>>
>>100559675
Basically another process running on your computer might be able to break it's encryption by carefully controlling/monitoring it's timing. In other words the functions are 100% rock solid before and after being called, but while they're running something might interfere with them.
>>
>>100559948
>Basically another process running on your computer might be able to break it's encryption by carefully controlling/monitoring it's timing

Isnt this basically always possible? Does a process have to purposely do this?
>>
>>100560047
No, some algorithms are hardened against it.
Also it mainly applies to communication protocols, like in SSL if you use an insecure implementation an adversary can precisely monitor the timing of your messages to reveal your secret key, essentially it's known plaintext but with time instead of text, different messages take different very specific amounts of time to process. Likewise another process can monitor memory allocations to do the same thing.
A hardened algorithm works in constant time and constant memory so there's no revealed information, ironclad can't do that because of the way CL handles memory and compilation. Essentially another process or thread could time your GCs and extrapolate your secret key.
Potentially, usually this isn't an issue and obviously it's not a problem at all if you're either not broadcasting the data or are doing it manually.
>>
I was going to ask /dpt/ but they kinda suck. I am getting the point where I need to interface C with scheme/CL, but I am not knowledgeable in C (just python). Is there a decent C book for people that already program professionally?
>>
>>100560235
>ironclad can't do that because of the way CL handles memory and compilation. Essentially another process or thread could time your GCs and extrapolate your secret key.

What ia a probelm in CLs handling of it?
How could a process time garbage collection?
>>
>>100558083
wait I meant remilia not reimu, fug. the original image I posted was the one I used with notify-send. please accept this cute reimu as a consolation
>>
>>100527587
It makes sense. Assoc is like cons, where assoc-ref is like aref. A subscript goes after where a new element to be added goes before.
>>
>>100561211
greetings sir, assoc GETS an element with matching key and returns the pair.
assoc ref does the same but returns the needful value.
>>
>>100558359
Why do you want this behavior?
>>
>>100561679
Oh shit yeah I always forget this. But tqh it's worse that you even have to use alists for anything to begin with. The fact that lisps have never bothered to implement readable associative data-structures until Clojure is just a massive disappointment really.
>>
File: file.png (6 KB, 254x208)
6 KB
6 KB PNG
Lol, why does this randomly works in eshell?
>>
>>100561901
Common Lisp has hashtables
>>
File: 1701540869568858.jpg (87 KB, 621x1024)
87 KB
87 KB JPG
>>100558122
I don't know anon. It might be fun to try and find out!
>>
>>100561901
It is but its more of a technical problem than a social one.
>>
>>100563756
Notice the word "readable". Most lisps have associative data structures, but they are almost never as easy to use as alists. The fact that everyone opts to use alists over hash tables is a sign that the design of hash tables is massively deficient. In a sane language (Clojure, Python, etc.) no one would bother with alists.

>>100566046
Surely it is a social problem. If everyone decided to write a few macros for making hash tables workable then stopped using alists, the problem would be solved quickly without a technical change, just a social one.
>>
>>100566236
>Surely it is a social problem
If it was then why has no other Lisp implemented support for readable hash tables?
>hash tables are not efficient at small sizes
>readability is not useful for large datastructures
>all other lisps support custom hash functions (though in CL they are entirely implementation defined)
>in Clojure they are useful as a dynamic standin for record types, in CL this is easily handled by CLOS and scheme doesn't really address this niche but would probably just use closures instead so their use cases are entirely different
>>
Good morning sirs
>>
>>100566608
>If it was then why has no other Lisp implemented support for readable hash tables?
Common lisp is ass because it was designed by committee. Scheme is too old. Clojure has them but you won't count it because it's too new. Most of the transpiled lisps have them because non-lisp languages tend to have them (Python, Lua, etc.). Emacs Lisp has them but the syntax isn't very good (doesn't evaluate by default, a lot of extra stuff specified).
>hash tables are not efficient at small sizes
They are perfectly efficient at small sizes. Perhaps a little slower than alists, but if that is really a great concern you can put in a special case for small hash tables that uses a vector. If the map is so small that it needs that, it was probably just a hacky stand-in for a record type just because record types are a pain to define in CL. Most of the time user-defined alists have more than 5 entries (or more than one in Elisp) which makes them less efficient than hash tables, not to mention that half the time you end up quoting them which is can lead to non-portable behaviour by mutating conses from the reader.
>readability is not useful for large datastructures
Why not? Sometimes I want to print out a large hash table.
>all other lisps support custom hash functions (though in CL they are entirely implementation defined)
And? You can easily have a special-case for reading tables with non-default functions.

The only genuine reason to omit this is because you have other easy ways to define hash tables in the prelude. I've seen alists used absolutely everywhere when I use Scheme and Elisp. I wouldn't be shocked if its the same for CL. Most of the time they are larger than 5 elements or just record stand-ins so there is no justification for it. All I'm saying is that hash-tables should be as easy to work with as alists are. It's an objective deficiency that they aren't and it means that everyone just takes the path of least resistance and uses alists for everything.
>>
>>100561862
for example,
I have tasks
* DONE Task1
sutff...
* DONE Task2
sutff...
* Task3
stuff

i dont want to see Task1,2 when i done it already
>>
>>100567651
bro who the fuck cares, all I was talking about was how guile has an annoying thing with function argument order (it happens in the rest of the library too)
>>
>>100567910
>captcha
>4ugay
>>
>>100567910
I just find it annoying, that's all.
>>
>>100558122
https://www.sicpdistilled.com
>>
File: 1705096042335585.png (681 KB, 787x830)
681 KB
681 KB PNG
>>100561901
>>100566236
>Notice the word "readable". Most lisps have associative data structures, but they are almost never as easy to use as alists. The fact that everyone opts to use alists over hash tables is a sign that the design of hash tables is massively deficient.
It's possible to make readable hash tables (that set and print as alists) using records
(define-record-type <hlist>
(%hlist list)
hlist?
(list data))

(set-record-type-printer! <hlist>
(lambda (type port)
(display (hash-fold acons '() (data type)))))

(define (hlist list)
(let ((table (alist->hash-table list)))
(%hlist table)))

(define (hlist-assoc key list)
(hash-ref (data list) key))

;; repl
> (define h (hlist '((a . 1) (b . 2) (c . 3))))
> h
((c . 3) (a . 1) (b . 2))
> (hlist-assoc 'c h)
3

you could imagine with a reader extension writing (hcons <a 4> <a 1, b 2, c 3>) to make ((c . 3) (a . 4) (b . 2)), but this is less an alist and more an unordered set
>>
>>100567651
>I've seen alists used absolutely everywhere when I use Scheme and Elisp
The reason they are used everywhere in elisp is because you can do
(setq-local alist-var (cons key+val alist-var))

without any copying (and because most alists are small enough that there isn't a performance penalty compared to hash tables).
>>
>>100570662
Yes but most people won't do this and you can't re-write all the existing code to use this instead. The problem is that it isn't ergonomic in the language and you can't fix that by defining your own macros.

>>100570693
That is not the reason, nothing in Elisp is done with performance in mind.
>>
>>100570768
https://lisp-docs.github.io/cl-language-reference/chap-22/cc-b-the-lisp-printer
good morning sir check the printer and the docs sir
>>
>>100570768
>you can't re-write all the existing code to use this instead.
If the program doesn't take a reference to an alist pair (since the hash table mutates them) no rewrite is necessary, a function like assoc can be rebound to hassoc without changing the semantics of the program
>>
>>100571041
>before I modify the printer: this library function takes an alist
>after I modify the printer: this library function still takes an alist
You are a retard if you think that is anywhere close to solving the problem I described.

>>100571264
You can't just monkey-patch other people's code. Best case is it works with a bunch of bugs you didn't notice, more likely it doesn't work at all.
>>
>>100571287
>You can't just monkey-patch other people's code. Best case is it works with a bunch of bugs you didn't notice
You could imagine a lisp that implemented alists as tables (if alists were a concrete type), it would be equivalent. If a program uses a set interface to some data, the underlying data representation can change. Do you disagree?
>>
>>100571695
>You could imagine a lisp
I can imagine it sure, but here in the real world alists are alists, which means if anyone has used car or cdr or cons or any other list function on them that code would break when I redefine alists at a language level. They are a fundamentally leaky abstraction because they give you both a map and a list.
>>
>>100571750
Sure, it only applies to programs known to use alists that way. It's possible to have a nicer (and faster) representation in those cases without rewrites or patches, just by rebinding or extending the functions for such a program
>>
>>100572210
>if you put in a lot of effort, you could sometimes solve the problem
Obviously any problem is solvable with enough effort, but this is too much effort. Lisp people are always like this – trying to suggest that you do work to make up for language deficiencies. It's much less work to just live with the problem than it is to solve it, that's why no one else bothers to solve it and hence why the problem exists to begin with.
>>
>>100545866
Clojure is not Lisp.
>>
>>100572564
Lisp is a Clojure.
>>
>>100571695
>>100571750
Not following, what's wrong with hash tables? I'm new to CL but I glossed over the reference and nothing seems that crazy.
>>
I understand recursion, I understand what a stack is, but I don't get what tail recursion is. Can someone explain?
>>
>>100570768
>That is not the reason, nothing in Elisp is done with performance in mind.
all sorts of things have to be done with performance in mind in order to work around the performance limitations of the language.
>>
>>100572741
They are slightly harder to work with than alists, which means a lot of people end up using alists where they shouldn't.
>>
>>100572879
Calling functions normally usually push a new stack frame with the new parameters, some data and a pointer to where it came from.
Tail recursion does not need that, because the previous function is already done. It reuses the stack frame, so there can be no stack overflow.
>>
>>100573200
Does that mean that normal recursion keeps adding stuff on top of the stack because the first function hasn't finished executing, while a tail recursive function calls itself at the very end, so the stack just pops it then adds it back?
>>
>>100572879
to add to >>100573200
Tail recursion is basically just a fancy loop. Not every function can be written as tail recursive, only when you "don't need" the values of previous calls. Tail recursion is also a lot faster because of this.
>>100573304
>Does that mean that normal recursion keeps adding stuff on top of the stack because the first function hasn't finished executing
Yes
>>
>>100573345
>only when you "don't need" the values of previous calls
Ah, because since it's popped from the stack, all the local variables are freed from memory.
So what's the point of tail recursion then, in terms of use cases?
>>
>>100545866
Clojure is a lisp.
>>
>>100573390
>Ah, because since it's popped from the stack, all the local variables are freed from memory.
uh, I guess so, that's a bit above my level
>So what's the point of tail recursion then, in terms of use cases?
Well, the loops can be made more readable sometimes, also It's presumably more functional, since you never mutate any variables, you just get a new call with new values, but that is more in TailRecursion vs loop use case

For recursion vs tail recursion, there's the obvious stack overflow elimination and it can be faster (in extreme cases by a lot, I might post comparison if I need my old work).
>>
Is Daemon Mode recommended? I'm trying to figure out how to get Emacs to not open a new frame whenever I open a file with Emacs from my file explorer.
>>
>>100566236
I remember Rich Hickey complaining that hash tables feel second-class in Common Lisp. Everything in CL is built on top of cons cells and hash tables aren't like cons cells.
>>
>>100574395
I think the cons explanation is a really good one in the sense that common lisp is just a few decades of kludge from various companies scraped into a standard. I mean seriously, why in the Lord's good name do I have to write a small essay to define an object? They basically just said "macros exist, so there's no sense making the language pleasant to write at all". It would have been much better if they'd just defined a lisp virtual machine like the JVM and let every company keep their own dialects. Then maybe it could have evolved like Java has into something much nicer.
>>
>>100574344
It can solve this problem for you.
In an existing emacs, hit M-x server-start .
Then from your shell, try `emacsclient ~/.bashrc` .
That should open up your file in an existing emacs without creating a new frame.

If that works, then you have to figure out how to get your file explorer to run emacsclient instead of emacs.
>>
>>100558122
I did the first chapter in Clojure and didn't really run into problems, but I have a hunch that may change in the later chapters.

I have to say though, writing Scheme again after having gotten used to Clojure is a bit of a pain because Scheme doesn't have argument destructuring. A lot of programs end up being almost twice as long and with way more parens due to all those cars and cdrs.
>>
>>100574344
https://www.emacswiki.org/emacs/EmacsClient
>>
File: 1697403771587144.png (404 KB, 680x661)
404 KB
404 KB PNG
>>100575464
>I have to say though, writing Scheme again after having gotten used to Clojure is a bit of a pain because Scheme doesn't have argument destructuring. A lot of programs end up being almost twice as long and with way more parens due to all those cars and cdrs.
you should be using pattern matching
https://www.gnu.org/software/guile/manual/html_node/Pattern-Matching.html
;; using match-lambda*
(define-match map
[(proc ())
'()]
[(proc (first rest ...))
(cons (proc first) (map rest))]))

(map id '(1 2 3)) => (1 2 3)

(define (add tuple-a tuple-b)
(match-let ([(a b c) tuple-a]
[(x y z) tuple-b])
(list (+ a x) (+ b y) (+ c z))))

(add '(1 2 3) '(4 5 6)) => (5 7 9)
>>
i have to say popper is a very nice package. being able to pop up eshell from anywhere is nice.
>>
>>100576793
lmao fag
>>
>>100567651
>Scheme is too old
What?
>Clojure has them but you won't count it because it's too new.
>no other lisp
Its also not a star citizen as an example because it doesn't have a standard.
>Most of the transpiled lisps have them because non-lisp languages tend to have them (Python, Lua, etc.).
I often forget they exist but they also shouldn't be included in discussions about "lisps should" because they still have the same semantics as their host languages.
>Emacs Lisp has them but the syntax isn't very good
I didn't know this.
>doesn't evaluate by default
That's because you asked for readable hash tables, not syntactic sugar for a constructor.
>They are perfectly efficient at small sizes.
I would be interested in testing this again but IIRC for many CL/Scheme implementations the difference is larger.
>record types are a pain to define in CL
What?
>Why not? Sometimes I want to print out a large hash table.
You are still free to print hash tables, the question is whether the built-in reader and printer should understand them.
>You can easily have a special-case for reading tables with non-default functions.
Making every hash table get printed with an implementation defined hash of both the equality and hash functions is not a complete solution.
>just record stand-ins
I would argue that's bad style and an argument against using alists moreso than an argument for readable hash tables.
>I've seen alists used absolutely everywhere when I use Scheme and Elisp.
I rarely see them in scheme but yes they're very common in elisp but elisp already has readable hash tables as you pointed out.
>>
>>100573390
>Ah, because since it's popped from the stack, all the local variables are freed from memory.
They are not because variable data doesn't live on the call stack.
>>
>>100573304
>so the stack just pops it then adds it back?
No its reused. Typically this means the function call is replaced with some variable binding and a jump instruction to the top of the function.
>>
>>100566236
>>100577608
>>100567651
Serapeum dict(*) solves this
=> (defparameter a (dict :x 1 :y 2))
(dict :x 1 :y 2)
=> (dict* a :y 4 :z 5)
(dict :x 1 :y 4 :z 5)

It's just normal hash tables, but it implements a writer and has some simple macros to create and mutate them. It also has vect(*) which does the same thing for extensible vectors, as well as a whole shitload of other stuff if you're interested.
>>
>>100577608
>What?
For the languages I know, hash table literals didn't really start showing up until after Scheme was designed. It's just too old. I couldn't tell you the reason, it's just something I've noticed.
>That's because you asked for readable hash tables, not syntactic sugar for a constructor
You can have both. See Clojure:
user=> '{a b}
{a b}
user=> {a b}
Unable to resolve symbol: a in this context
user=> '(a b)
(a b)
user=> (a b)
Unable to resolve symbol: a in this context

Lists already work this way, each of the items is evaluated then passed to apply. Having hash tables work the same is hardly odd, and it seems more useful and more consistent than doing it the other way.
>the question is whether the built-in reader and printer should understand them.
It should because sometimes I want to print them out and it's easier if it does. There's no drawback to having this.
>Making every hash table get printed with an implementation defined hash of both the equality and hash functions is not a complete solution.
"Special-case" means that you only do that when someone passes in a non-default value to the equality check. There are also just better ways to print out functions. It wouldn't be unreasonable to expect an implementation to be able to recover the name of a quoted function. Or, better yet, we could truly embrace image-based computing like Smalltalk does, and never need to read or print anything since you can always just look at the values directly. The sad reality we face is a far fling from my dreams.
>I would argue that's bad style and an argument against using alists moreso than an argument for readable hash tables.
I said it to the point across that a lot of other language features are way to hard to use (classes in this case), and the result is people just using alists in replacement.
>elisp already has readable hash tables as you pointed out
But they aren't writable hash-tables. You couldn't type them.
>>
>>100577869
Yeah, was thinking about it and that's basically how I'd do it.
>>
>>100576670
that's neat and all, but that's still a whole lot more to type than
(defn add [[a b c] [x y z]]
[(+ a x) (+ b y) (+ c z)])

(add [1 2 3] [4 5 6])
;; => [5 7 9]


Not to mention that clj can do pattern matching on hash-maps:
(def sell-order {:ticker "TSLA"
:side :sell
:type :limit
:price 500
:qty 100})

(defn volume [{:keys [price qty] :as order}]
(if (and price qty)
(* price qty)
(throw (ex-info "invalid order" order))))

(volume sell-order) => 50000

Fennel has an even nicer/shorter syntax for this.

maybe something similar could be implemented in Scheme with a macro, but unless and until I decide to dig into Scheme's macro system, just using Clojure is the path of least resistance.
>>
>>100577923
>after Scheme was designed
R6/7Rs is vastly different from the original scheme (really only the ideology has been preserved so far) and has reader syntax for a lot of datatypes.
>>
>can't keep code abstract from the data types it operates on in scheme
>even a simple sequence abstraction is totally missing
>no real way to make your own
The only thing that's keeping me from switching to Scheme. No I don't want to rely on a single implementation for the whole codebase.
>>
>>100575363
I've done all of that, but getting Emacs to open on boot has proven difficult. When I set up the daemon, Emacs either doesn't open on boot or opens twice.
>>
File: Daemon config.png (38 KB, 759x377)
38 KB
38 KB PNG
Holy fuck. When I kill Emacs, it resurrects. I must've fucked up the daemon somehow.
>>
>>100580282
>
Restart=on-failure
>>
Emacs daemon kills itself every two minutes. How do I debug that?
>>
>>100580414
Consider it a blessing and move onto a useful language that will get you a job
>>
File: emacschads.png (77 KB, 1470x745)
77 KB
77 KB PNG
>>100580682
emac get u job
https://archive (dot) ph/zDgLF
>>
>>100575901
Thanks, sir.
>>
>>100580734
https://archive.is/zDgLF
>>
>>100578058
Racket has match, I think there are some srfis or just libraries that implement it in other languages, or just copy destructively-bind (terrible fucking name) from CL.

Also you can use let-values in r7rs but that is for multiple values, not unpacking structures.


but yeah I feel bare scheme gets a bit verbose. After the 5th indentation or something I usually get antsy to refactor it into something else.
>>
>>100583100
>destructively-bind
destructuring-bind
>>
>>100584245
yup, my phone corrected it. thanks sir for the needful.
>>
Why learn lisp
>>
File: cacochan.png (47 KB, 288x168)
47 KB
47 KB PNG
wise sages of lisp, I seek thy counsel
I've decided to try and learn lisp because I'm extremely bored
I have no real use case for it and am not very good at maths
the idea of a being a hacker man with a sweet riced system has always been appealing though
I have a copy of SICP gathering dust beside me
am I on the right path?
>I also just like pic related
>>
>>100585441
just build stuff
a hackerman does not give a shit about books beyond consulting sections of them for getting over stumps
>>
>>100578058
with match-lambda (rather than match-let) it's similarly

(define-match add
[((a b c) (x y z))
(list (+ a x) (+ b y) (+ c z))])


in your second example it'd be something like

(define table
'((part . 1)
(unit . 2)
(pieces . 3)))

(define-match total
[(and (= (key 'part) a) (= (key 'pieces) b))
(* a b)]
[_
(raise some-condition)])


where key is a partially applied assq-ref, i think (or (('part . a) rest ...)) would work for matching alist entries (while permitting the key-values to be reordered) but i'm unsure
>>
I use Emacs to view PDFs, so I can't use it as a daemon because terminal Emacs refuses to read images. Does that mean I can't use it as a daemon?

All that I fucked wanted was for files opened by my file explorer to not open a new frame.
>>
>>100585657
What stuff is there left to build?
>>
>>100588497
The daemon can support both graphical and terminal UIs for emacs.

When you want the terminal UI:
emacsclient -t

When you want the graphical UI:
emacsclient -c

One daemon can service both simultaneously. You won't be able to read PDFs in the terminal client, but the graphical client will still be able to do that part.
>>
>>100588775
I use desktop-save-mode, so I think the daemon is ruled out if I have desktops saved.
>>
>>100588864
I don't know how much of your workflow depends on desktop-save-mode, but I ended up ditching it after using it for years.
>>
>>100588959
What's your alternative?
>>
>>100588642
there are a lot of problems in this world.
some of those problems may directly affect you.
surely you can find a problem that might have a technical solution.
>>
>>100589035
>surely you can find a problem that might have a technical solution.

Past experience shows I can't.
>>
>>100588997
My alternative was to change my expectations such that I started to prefer blank slates. I'm OK with emacs not remembering where I was the last time I started it. As long as I can get to the files I'm interested in quickly, I'm satisfied. Using `M-x recentf` and the built-in bookmark system helps a lot on that front as does having short aliases for emacsclient to aid me when I'm using the command line. On the rare occasion I need a complex frame layout to appear, I'll write an interactive elisp function to setup the various window splits I want.
>>
https://github.com/vedang/pdf-tools

QUESTION: When viewing a PDF with pdf-tools, is there a way to know what page in the document you're currently viewing?
>>
>>100536633
>Pre-Scheme only supports data-types which are supported natively by C. There are no lists, no first-class continuations, and only fixed-size numeric types.
>no lists
wat
>>
>>100575363
This isn't good enough. It assumes that I already have Emacs open.
>>
>>100575901
>When the server is running, closing the last Emacs frame will leave the server running.
This has proven false in every test I've done.
>>
>>100589950
If you're running the daemon and opening emacs with the emacsclient, it does.
Are you running the server and then opening emacs without emacsclient? Because if you just use regular emacs command, it will open an emacs instance that isn't connected to the server and won't work the way you intended.
>>
Solved my daemon problems. Turns out that I didn't know how xfce worked and the .desktop file I was changing wasn't changing my "Open With" menu.
>>
I'm getting ready to quit using asdf for personal projects. At this point I'd rather just make a load.lisp that (load)s my files directly
>>
Sell me on using an Emacs distro. Should I stick to Emacs for a year first?
>>
File: odoom.png (1.86 MB, 1080x1483)
1.86 MB
1.86 MB PNG
>>100591669
you can tell emacs via a command-line option which config to use, so there's no penalty to trying out Spacemacs or whatever
>>
>>100504821
What is lisp used for

BTW that spacemacs thing forgot to renew its SSL certificate you should probably tell them
>>
I have been cursed with maintaining a Python 2 django application, it's giant and its critical.

I have already given up on actually debugging properly, I just bash it until it works, but is there a way to make emacs learn the OOP shit of a python codebase?
>>
>>100591800
>Python 2
It's ogre
>>
>guile native on windows
If it builds and works properly why don't they just package binaries on their website?
Also fuck geiser-guile for always changing shell-file-name to "sh" regardless of OS.
>>
>>100591669
I think there's value in exploring the distros, because they can show a beginner what Emacs is capable of. Also, like >>100591738 said, it's become very easy to switch between configurations in recent versions of emacs.

https://emacsredux.com/blog/2024/02/23/changing-the-emacs-configuration-directory/
>>
>>100591669
I used Spacemacs for many years, but I eventually ended up writing a custom config that takes a lot of what I liked and used in Spacemacs and removed a lot of the things that I never really cared for.
>>
>>100580734
No way VSCode is still +10.
>>100573345
> Tail recursion is also a lot faster because of this.
Iff the compiler preforms tail call optimisation (Elisp doesn't).
>>100591669
Do you want to use Emacs or someone's configuration?
>>
>>100514968
I have a huge dilemma. I've been learning Japanese and Chinese intermittently for almost 10 years and I feel like I'm dragging my feet with both (although I'm definitely getting better). I got my HSK 3 (old system) and I have an even higher Japanese level. But I don't think I can keep it up and I don't want to ditch any of them.
Thank you for reading my totally on topic blog.
>>
>>100597459
VSC is probably better than everything else on the list except neovim (though not strictly on the list) and Emacs.
Higher number should correlate with better programmers which typically correlates with age and choice of tools.
>>
File: 1707305781688618.png (387 KB, 580x940)
387 KB
387 KB PNG
>>100585441
Read SICP daily and make stuff with your newfound knowledge.
>>
>>100593942
please if this shit stops working the pope and and anti-pope will both call me
>>
>>100566236
>The fact that everyone opts to use alists over hash tables
How do you know this?
>>
>>100566608
>why has no other Lisp implemented support for readable hash tables?
Because it's literally a non-problem. Write a couple helper macros/functions and you can use any syntax you want.

Yes, this is valid advice, you only have yourself to blame if you won't take advantage of the features available to you.
>>
>>100572478
>Lisp people are always like this – trying to suggest that you do work to make up for language deficiencies.
In nearly every other language, this is not even possible, so it's a net gain.
>>
File: 1714922920973243.jpg (114 KB, 640x480)
114 KB
114 KB JPG
>>100595902
>Also fuck geiser-guile for always changing shell-file-name to "sh" regardless of OS.
(defun geiser-guile--version (_binary)
"Find Guile's version running the configured Guile binary."
(let ((shell-command-switch "-c")
(shell-file-name "sh"))
(shell-command-to-string
(format "%s -c %s 2>/dev/null"
(geiser-guile--binary)
(shell-quote-argument "(display (version))")))))


If this is the misbehaving function maybe shell-file-name can be rebound around shell-command-to-string with:

(defun let-shell-file-name (proc &rest params)
(let ((shell-file-name "/your/shell"))
(apply proc params)))

(advice-add 'shell-command-to-string :around #'let-shell-file-name)

;; which hopefully adds the new let like this
(let ((shell-command-switch "-c")
(shell-file-name "sh"))
(let ((shell-file-name "/your/shell"))
(apply shell-command-to-string
...)))


I dunno if this works tho
>>
>>100572741
nocoders grasping at straws to find excuses to avoid sitting down and actually programming
>>
>>100600874
>I dunno if this works tho
I tested it on wangblows
(defun f ()
(let ((shell-file-name "sh"))
(shell-command-to-string "echo ok")))

> (f)
Debugger entered--Lisp error: (file-missing "Searching for program" "No such file or directory" "sh")

(defun let-shell (proc &rest params)
(let ((shell-file-name (getenv "SHELL")))
(apply proc params)))

(advice-add 'shell-command-to-string :around #'let-shell)

> (f)
"ok
"

(getenv "SHELL") evaluates to "C:/bin/emac/libexec/emacs/29.1/x86_64-w64-mingw32/cmdproxy.exe" so seems to just werk
>>
How would you write an interactive elisp function for double quoting the word at point?
>>
>>100602230
It could be as simple as

(defun double-quote ()
(interactive)
(backward-word)
(insert "\"")
(forward-word)
(insert "\""))


>How
To find out about backward-word I used C-h k followed by M-b, and likewise M-f for forward-word
>>
>>100602671
That's good enough for me. This helps out a lot for a little menial task I'm doing. Thank you.
>>
https://guix.gnu.org/en/blog/2020/gnu-shepherd-user-services/
In this blog post they give an example for how you'd source all shepherd services under ~/.config/shepherd/init.d and I don't understand how it works:
(for-each
(lambda (file)
(load (string-append "init.d/" file)))
(scandir (string-append (dirname (current-filename)) "/init.d")
(lambda (file)
(string-suffix? ".scm" file))))

What's the file argument in the first lambda? How are the files loaded before scandir returns the list of files? I don't really understand the order of operations here.
>>
>>100602956
the first lambda appends the file-name to the path, so it becomes "init.d/file-name"

for-each is the loop

scandir doesn't return the whole list at once, it runs once for-each file if i'm understanding this correctly
>>
>>100600874
I just rebound the function in my init to not change the shell if under NT. They shouldn't have any reason to touch your default shell though, its a single command starting guile with some simple arguments, nothing you would expect any sane shell to have a problem with.
>>
>>100603019
>the first lambda appends the file-name to the path
But what's the filename? Is the first lambda supposed to be evaluated after scandir?
>>
>>100602956
for-each is standard R6Rs scheme. The first argument is a function to apply to each element the second is a list to apply it to. It is similar to map except it has an unspecified return value (i.e. you use it for side-effects, in this case loading files).
>>
>>100603091
The lambda is evaluated first but the resulting function isn't applied until after the scandir.
>>
>>100603112
>>100603128
Ok, thanks.
>>
File: 1709230590705376.gif (103 KB, 500x281)
103 KB
103 KB GIF
>>100602956
>>100603091
If I don't understand something I might break it down like this (might help seeing an interactive repl session)
;; load module containing scandir (found from https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html)
* (import (ice-9 ftw))

;; scandir's signature
* scandir
#<procedure scandir (name #:optional select? entry<?)>

;; print scandir's docstring
* ,d scandir
Return the list of the names of files contained in directory NAME
that match predicate SELECT? (by default, all files.) The returned list
of file names is sorted according to ENTRY<?, which defaults to
`string-locale<?'. Return #f when NAME is unreadable or is not a
directory.

;; run scandir on current directory
* (scandir ".")
("." ".." "booru" "cache" "doc" "lisp" "micro" "www")

;; run scandir on current directory, using the optional select? parameter
* (scandir "." (lambda (name) (string-contains name "c")))
("cache" "doc" "micro")

;; mapping a function over the previous list
* (map (lambda (x) (string-append x "!")) (scandir ...))
("cache!" "doc!" "micro!")

;; for-each is just map, except it doesn't return a list (if we're using a function just for side effects like loading or printing, we don't need it)
* (for-each (lambda (x) (display x) (newline)) (scandir ...))
cache
doc
micro
>>
>>100602671
That probably isn't going to do what you expect it to do if the point is at the beginning of a word. This handles the case where the point is at the beginning of the word
(defun double-quote ()
(interactive)
(pcase (bounds-of-thing-at-point 'word)
(`(,beg . ,end)
(goto-char end)
(insert "\"")
(save-excursion
(goto-char beg)
(insert "\"")))
(_ (user-error "No word at point"))))
>>
>>100604107
Seems to work as expected. Thank you.
>>
>>100604107
This is my first time seeing pcase. That's really cool.
https://emacsdocs.org/docs/elisp/pcase-Macro
>>
>>100603112
>scheme rediscovering looping constructs
>>
>>100604869
there are several other pcase macros too (pcase-dolist, pcase-lambda, pcase-let, pcase-setq)
>>
>>100604869
Nice, isn't it? See how easy things become when you embrace macros instead of REEEEing nonstop about them?

Reminder that there are still """lispers""" who think macros are not important and spend all day apologizing about Lisp not being 1:1 like Smalltalk.
>>
>(((LISP)))
people don't unironically use this language do they?
>>
>>100605284
lispers are god's chosen people
>>
Now that I've started reading PDFs in Emacs using pdf-tool + org-noter, I can't ever go back to anything else. Being able to take notes in org while reading a book is a game changer.
https://github.com/vedang/pdf-tools
https://github.com/org-noter/org-noter
https://github.com/fuxialexander/org-pdftools

Do yourself a favor, and get your emacs setup to read PDFs if you haven't already.
>>
Have any of you CL people tried CIEL?
https://github.com/ciel-lang/CIEL/
(dict :a 1 :b 2 :c 3)

;; versus

(let ((ht (make-hash-table :test 'equal)))
(setf (gethash :a ht) 1)
(setf (gethash :b ht) 2)
(setf (gethash :c ht) 3)
ht)
>>
>>100606155
thanks anon i might try this out

i currently read my PDFs in zathura, but open them using the nyxt browser

i actually don't like the pdf format too much and really prefer straight html when its available
>>
>>100607236
I use this setup mostly when I'm reading ebooks that come in PDF format.
>>
>>100606553
>
CIEL-USER> (dict :a 1 :b 2 :c 3)

>which prints:
>
(dict
> :A 1
> :B 2
> :C 3
>)
>

Not really a readable version of a non-list data structure. Do they even know CL?
>You can of course do all this without CIEL, but then you have to install the library manager first and load these libraries into your Lisp image every time you start it. Now, you have them at your fingertips whenever you start CIEL.
Because
(ql:quickload ...)
is so hard? Loading libraries has never been easier. Also
>(((SBCL))) only
>>
>readable hash table this
>readable hash table that
Was this even a popular notion before Clojure?
>>
Should I switch back to ido /λ/ros?
Helm is treating me nicely but theres something about seeing others using ido... Also thinking of removing code completions entirely.
>>
Has anyone here tried going full emacs
Guix
Stumpwm
Emacs for editing, mail (rmail), file management (dired), web browsing (EWW) and communication (ERC)
>>
>>100613930
No, I actively avoid using Emacs for more than text editing because I have strong doubts about its security
>>
>>100613930
i've actually used all of them for an year and it was fairly usable:

>guix
the package manager was not as fast as pacman or apt was
also because it requires bootstrapability, several js packages (required in some popular programs) were missing and many programs were outdated
you had to rebuild guix everytime you modified system configuration so it was kind of a pain in the ass

>stumpwm
didn't allow much customization and i didn't know much cl either
i had to switch to dwm in a few months

>emacs mail
using notmuch as my email client till date and i had no issues with it

>web browsing
can't comment since i used lynx instead

>irc
i did not switch to erc from weechat since the latter had built in support for irc bouncers
>>
>>100614643
you could trust emacs for writing and reading mail
both the functions are handled by external programs
as for web browsing, it doesn't support running javascript so it is not functional but secure at the same timee
>>
Is Forth a lisp? Because I'm pretty sure Forth is a lisp
>>
>>100613930
I did but with EXWM instead of StumpWM. I had to give up on GUIX, as I need to write in .NET core for school because everyone is a microsoft slut around here and I don't feel like building that thing from source.

But the rest pretty much stuck, Mu4E for emails, I use dired a lot but not exclusively. EWW not much, I prefer Links. I don't use IRC much but if I do, it's from Emacs.
>>
>>100613930
i have a setup somewhat like this, but use nyxt for browsing and irssi for irc still its whats running on my server
>>
>>100616303
No, Forth is just stupid. The idea of lisp is that you write out the AST without a special syntax. Forth goes a step further and says you should just write out the token stream of the program without the AST. The difference is that an AST represented literally is the same as one represented with a syntax, so you are just making it easier to work with. A token stream is not the same as an AST, so in Forth you are losing out on the benefits of an AST and not getting much in return since a bunch of hacky macros will have to put the AST back together from the tokens of your input. The result is a process which is more complicated than writing the AST out directly.
>>
>>100616976
you absolute fucking retard.
Forth's AST is a flat list read ONLY left to right and has a 1:1 mapping to its textual representation. there is no representation of arguments within its AST because it necessitates the existence of a stack for those.
retard ass motherfucker.
>>
What's a game engine written in Lisp?
>>
File: GEM.png (121 KB, 770x526)
121 KB
121 KB PNG
>>100618522
https://opengoal.dev
https://github.com/open-goal/jak-project
You don't need more.
>>
>>100598039
> Higher number should correlate with better programmers which typically correlates with age
Not my experience, a lot of new programmers use VSCode if for no other reason than that it is the first result if you you "programming editor" into Google. It is not a preference, it is taken to be a default.
>>100604869
Avoid linking to that site. The documentation is outdated because they just translated the HTML output of the official TeXinfo manual into different HTML.
>>
>>100618149
>has a 1:1 mapping to its textual representation
So does lisp.
>AST is a flat list
Lisp code can also be represented as a flat list, see PRINT. Binary heaps are a special case of binary tree, yet they are represented as flat lists. Graphs are often represented as adjacency matrices. What matters here is semantics. Both forth and lisp have constructs such as IF and WHILE which operate on code in a nested, tree-like way. A file of Forth code contains many opening and closing delimiters which must be matched, just as they must be in lisp. The only way to avoid this tree-like representation is to give up all means of control flow and use GOTO for everything.

A tree is something you want because it's the only way to avoid GOTO style programming. Either your language is tree-like in some way, or it sucks to program in. The reason I look down on anyone who reveres Forth is because none of them have realised that. I've yet to see a single person convincingly advocate Forth.
>>
>>100616976
So it's like lisp but more advanced?
>>
keyboard macros are so convenient sirs
>>
>>100620755
Not really. I would say advanced things are hard to use, but powerful. Something like Perl. Forth is hard to use but isn't powerful. In fact it is less powerful than many easier languages.

As for "like lisp", forth is not similar to lisp in any meaningful way. I suppose they are both often misunderstood by a small group of kooky fanatics, but that is more the community than the language. My best guess would be that it comes as a result of the relative unpopularity of the languages meaning people won't have had to use them for serious or corporate shit.
>>
>>100620243
yes, trees are ever-present in programming, but that has more to do with the callstack than anything. any language that supports literal lists will involve nesting of lists within the AST.
Lisps with variadic numbers of arguments require each keywork/function invocation to entail a list containing arguments in the AST. Forth supports variadic arguments too, requiring only context of already-seen information.
or maybe traditional Lisp could act more similarly to Forth, idek anymore.
>I've yet to see a single person convincingly advocate Forth.
Forth beats the absolute shit out of Lisp when it comes to sitting at a REPL. other than that specific usecase, I agree that Lisp is probably better.
>>
>>100621240
>Forth beats the absolute shit out of Lisp when it comes to sitting at a REPL.
The Forth REPLs I've used often don't even let you enter anything control flow related like loops and ifs. Forth is maybe easier to type, but that's easily fixed by about 2 key binds. Are there some REPL features I'm missing or is that it?
>>
>>100614755
>both the functions are handled by external programs
Emacs displays pictures. What if there's a bug in one of the libraries for that, like we saw with the big webp security a few months ago? Wouldn't that give the malicious program access to everything Emacs has access to?
>>
>>100621739
Lisp REPLs require naming of data you want to precalculate prior to use in another expression. This results in excessive mental overhead when you just want to try out what intermediate operations are going to do.
>>
>>100616303
Forth and Lisp are diametrical opposites and could not be any more different. Anybody claiming they are similar in any way is LARPing or trolling.
>>
>>100610839
No because nobody was scared of macros back then.
>>
>>100622310
Not true. See
https://www.lispworks.com/documentation/HyperSpec/Body/v__stst_.htm
https://www.lispworks.com/documentation/HyperSpec/Body/v_pl_plp.htm#PLPLPL
>>
File: repl results.jpg (126 KB, 1012x318)
126 KB
126 KB JPG
>>100622310
>>
File: paredit_assert.webm (107 KB, 648x364)
107 KB
107 KB WEBM
>>100622310
Also CIDER stores the last evaluation result in a register, so you can just paste the contents of that into the buffer. Very handy for various macros.
>>
>>100622310
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (+ 1 2)
$1 = 3
scheme@(guile-user)> (+ $1 2)
$2 = 5
scheme@(guile-user)>

Most REPLs give you some way to access previous results.
>>
>>100622425
>>100622494
>>100622575
>>100622737
very good points
I haven't ever really used shells other than my own to do things with, and I'll be implementing this
>>
>>100618522
Trial is used in a commercial steam release (2D platformer) and the dev has expressed intention in using it for a 3D game. The engine is slightly documented and the dev has a solid reputatation (he's released dozens of libraries)
>>
>>100623601
>he's released dozens of libraries
she*
>>
Forth is often compared to lisp because they are both languages that allow for syntactic abstraction and encourage a bottom up DSL-driven approach.

That being said, forth is very, very low level, which is the opposite of lisp. Given a bare metal processor without lisps or forths on it, it will be quicker to get to high level programming using forth. In most over situations lisp is quite a bit better, especially considering there are no free performant forth implementations.
>>
>>100623664
Whoops, typo, sorry yukari
>>
https://madhadron.com/programming/seven_ur_languages.html

I don't know enough of all these languages (and all the others) to say I agree 100% with this article, but I think it makes a lot of sense. algol, lisp, forth, APL and prolog are clearly five distinct lineages. you could say the ML family descends from lisp, and the self/javascript/etc family descends from algol, but the other five are unambiguously different and each of them unique
>>
>>100623753
I'm not entirely sure about that whole DSL thing. I know lisp has macros, but it's usually better to avoid them. Likewise, I can't imagine macros being that useful or easy in Forth.
>>
>>100623960
>I know lisp has macros, but it's usually better to avoid them.
no it isn't. I mean it's up to you if you want to mutilate lisp into something else, but if your macros adhere to a certain style and don't subvert expectations too much, using macros is the same as using functions
>>
>>100624595
You say this, but most of the people who use lisp often seem to disagree. The nature of macros is that they should be as general as possible, and hence you need very few of them. Using github.com/Shirakumo/trial as an example, there are 3100 function definitions, and only 110 macros. This is across 32K LoC. The very nature of macros means that most of the useful ones are provided by either the language, or some common library.
>>
>>100623960
>>100625099
thanks captain obvious.
base language > new function > new macro >>>>>>>>>>>>>> reader macros (what are you even doing with your life man)
>>
>>100623753
I don't know about that, you can implement lisp in raw machine code in under 300 bytes. Can Forth do that?
Granted that lisp is interpreted and an actual compiler would be larger, but not MUCH larger assuming the instruction set isn't retarded.
>>
>>100625213
>I don't know about that, you can implement lisp in raw machine code in under 300 bytes. Can Forth do that?
I don't know if there is an implementation like that, but... you probably can. let's hope justine makes one
>>
>>100623870
Those ur languages can be reduced into their true form: the basic forms of programs:
>Mutation
Direct manipulation of data with single commands
>Iteration
Use of commands to generate more commands
>Recursion
Passing program control between functions
>Interpretation
Dynamically controlling recursion with input data
>Compilation
Partial interpretation of commands

Not depicted are type manipulation and logic programming, because both are simply compilation in disguise. Potentially you could break down compilation into sub components to recover them.
>>
>>100625370
Yeah I thought about it and forth is basically just bare machine code + a stack, that's nothing. You'd have to use a shitload of gotos though, and reformatting it to support function scope would basically turn it back into lisp, but backwards.
>>
how do i replace DOOM emacs' splash screen with strings that use ANSI escape characters?
>>
>>100625204
Well okay, you say it's obvious, but you also don't seem to know it. Earlier, you were saying these languages encourage a macro-based "DSL-driven approach". That's hardly true if macros are rarely used. The high level approach to programming is broadly the same between lisp and these other languages. Macros make fundamentally local changes to programs and hence don't change your general approach to programming very much.

>>100625402
The article is categorising the kinds of programming languages used in practice. Your list seems muddled and unclear. The top three are present in all programming languages in some form and the bottom two are just methods of running a program, not related to the language itself.
>>
>If you’re using CIDER alongside clojure-lsp you might prefer to use clojure-lsp for ElDoc.
is there any particular reason why you'd prefer lsp's eldoc?
>>
>>100625579
I am not the person you were talking to. I do not like DSL thing because none one seems to bring forth "a dsl" that isn't just "a library" of function definitions.
>>
>>100626126
That's exactly what I was saying to this dude before you told me how stupid I was for saying it.
>"a dsl" that isn't just "a library" of function definitions
From a certain perspective, a library of functions is a DSL, but it's nothing specific to lisp. Heck, I'd say you get more DSL-like libraries out of C++ than lisp (not that you'd want to use them).
>>
Why does Clojure always take so long to start?
>muh compile classes
Surely they would be cached. Right?
>>
>>100626343
jeetvm needs to shit in the streets before it can get to work
>>
>>100626343
good morning sir do the needful
>>100626377
hello sir
>>
>>100504821
wait, maybe an /sqg/, I don't know much about lisp.
Anyways is programming in lisp directly writing an ast that gets evaluated? Considering that you can traverse parentheses as trees. Is the interpreter directly traversing the parentheses tree structures made in a lisp program without parsing?
>>
>>100626481
Or rather early and simple lisp implementation, considering something like clojure must use a parser and a bunch of other intermediate steps right?
>>
>>100626343
https://clojure.org/guides/dev_startup_time

if you're just dicking around in a REPL, consider using Babashka
>>
>>100625579
I'm saying language doesn't matter, different languages are just better at one or more of the basic programming paradigms.
>interpretation and compilation aren't related to prgamming styles
No, they are. Your focus on languages instead of programming itself has blinded you. Many common programs can/are implemented as interpreters, and in fact Prolog's logic programming and SQL's database queries are just compilation.
>>
>>100626481
Yes, it's the eval-apply loop.
Eval takes a tree and an environment and recursively walks the tree evaluating the symbols, and apply calls the functions with the evaluated arguments, passing the result back to eval.
>>
>>100627140
Naisu. Thenks.
>>
new bread
>>100630571
>>100630571
>>100630571
>>100630571



[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.