freenode/#lisp - IRC Chatlog
Search
20:13:14
aeth
In practice, though, if you care about your numerical type, you're going to statically type or check-type your code there... so your integer becoming a float because one float was passed in won't really be an issue.
20:14:44
user51
has anyone done any emulation in lisp? i'm specifically talking about intel 8080, i figured it would be a decent first project.
20:16:55
aeth
user51: to be efficient on this sort of thing... (1) use SBCL, (2) use structs whose slots have a :type or use arrays with an :element-type that can be optimized (mostly just various simple numerical types; test with upgraded-array-element-type first) or some combination of these
20:18:18
aeth
rustisafungus: I bet you that SBCL will beat its performance because it has had decades of work put into it, even though it's neither statically typed (although it is gradually typed) nor aimed at RT programming.
20:18:49
aeth
It is possible, though a bit hard, to avoid GC during the runtime by preallocating everything. SBCL gives you enough profiling information to do this.
20:20:47
aeth
Well, actually SBCL is statically typed, I'm underselling it. CL itself is just dynamically typed (values hold type information), but SBCL is doubly statically typed, with parallel declared-type and inferred-type information at compile time associated with variables (although it's often just T, since most CL code is ultra-dynamic)
20:21:58
rustisafungus
so i guess in contrast to haskell, mutation in lisp is very common/idiomatic etc?
20:22:33
|3b|
yeah, CL likes to mix lots of styles of programming, 'pure functional', 'mutate everything', OOP, whatever :)
20:22:49
aeth
The least painful style is probably a "mostly functional" style, where pure functions feed into mutable data structures, since CL is a very expression-heavy language.
20:23:52
aeth
If you're writing an emulator in CL, it'd probably look a lot like writing an emulator in C, though.
20:23:53
rustisafungus
i think part of my curiousity about lisp is the realization that type systems are just code which executes at compile time
20:24:24
user51
aeth: thanks. and yes, c is the language i wrote the emulator in originally, although since it's my first it had a bunch of iterations for improvements.
20:24:41
aeth
As far as low-level programming goes, you have structs of arrays available to you in CL, but you dn't have arrays of structs, since there's no way to make an array with that sort of memory layout... you'd just get arrays of pointers to structs.
20:25:15
rustisafungus
user51: do you understand the NES (all those opcodes etc) or do you copypasta them from some documentation?
20:36:09
rustisafungus
i just came across this, possibly nsfw https://ncatlab.org/nlab/show/Oberwolfach+HoTT-Coq+tutorial
20:37:59
rustisafungus
i like the idea that time is a side effect btw, this is a much neglected idea
20:55:47
PuercoPop
aeth: manardb is similar to an array of structs (a mmap'ed back collection of classes). The only thing it doesn't do is allow random-access iirc, instead it forces you to iterate through all the instances at once
22:11:50
sveit
hello. i have seen online the statement that SBCL runs on Android, but I haven't found a guide to compile it either on-device (through termux) or cross-compile. is anyone familiar with this? a naive attempt to compile on-device ran into problems with undefined C functions.
22:13:59
rustisafungus
i've made rustc compile and then compile a rust program on termux once, but it was very, very slow
22:15:56
rustisafungus
yeah but repl.it will run your code in a vm for free, if you are just playing around
22:16:53
rustisafungus
i don't see sbcl, but there's clojure https://repl.it/languages/clojure and whatever emacs lisp is: https://repl.it/languages/elisp
22:18:34
Nilby
I have sbcl running on my phone, but it's not android. I compiled ECL first then compiled sbcl with it.
22:21:09
no-defun-allowed
There is an Android app with ECL and an acceptable editor, but I couldn't get Quicklisp working with it IIRC
22:23:59
sveit
i tried to use i to bootstrap in the SBCL compile, but ran into the undefined C functions
22:24:34
sveit
the reason for doing this is not to run it on a phone, but a somewhat powerful tablet.
22:25:32
sveit
I can let you know in a second. if i remember the spelling right it was getdtablesize
22:26:04
sveit
commits like this one (there are others) seem to suggest this should be possible: https://sourceforge.net/p/sbcl/sbcl/ci/e84400d65cfd88483d901199b482bcb892a0ac28/
22:26:48
rustisafungus
i have no idea if this will photograph you while you are on the john and post the picture on the front page of a newspaper, but lisps are available on android,... https://play.google.com/store/apps/details?id=org.eql5.android.repl&hl=en_US
22:26:50
sveit
actually i have not just quicklisp, but SLY/SLIME working with ECL on termux. it's actually quite nice
22:27:03
no-defun-allowed
https://github.com/pocoproject/poco/issues/1204 suggests you should replace that with sysconf(_SC_OPEN_MAX)
22:28:50
sveit
no-defun-allowed: the first build i did had some error with sockets, so quicklisp didn't work, but it was from not including the argument --build=aarch64-linux-android to configure
22:29:53
sveit
i am happy to start patching, but i was hoping there was some cross-compile or other process i could do without modifying the source based on some of the mysterious statements on the internet :)
22:31:57
sm2n
sveit, if it's actually libc, you could maybe try compiling against musl statically instead
22:33:20
sveit
sm2n: thanks! long shot, but do you know what to pass to the SBCL make to do this static linking?
22:35:43
sveit
Nilby: only clang is officially supported, i think getting GCC will run into more problems than SBCL :)
22:36:59
sm2n
but it looks like threading is disabled on aarch64, so I think that means slime etc won't work
22:37:21
sm2n
here is the build script: https://git.alpinelinux.org/aports/tree/community/sbcl/APKBUILD
22:38:20
Nilby
searching reports this: https://github.com/its-pointless/gcc_termux . It looks pretty kludgy though.
22:38:53
no-defun-allowed
Well, threading on AArch64 does work, so it could be enabled. (I think you pass --fancy and you get all the good stuff including threading.)
1:10:24
drl
OK, I'm back. I deleted the old code in ~/.sbclrc. I also deleted ~/.cache/common-lisp/ and ~/.slime/fasl/. I closed and restarted emacs. But alexandria still can't load. The first line of the backtrace is: 0: (SB-IMPL::UPDATE-PACKAGE-WITH-VARIANCE #<PACKAGE "ALEXANDRIA.1.0.0"> "ALEXANDRIA" ("ALEXANDRIA.1.0.0" "ALEXANDRIA-1") #S(SB-C:DEFINITION-SOURCE-LOCATION :NAMESTRING "/home/l/quicklisp/dists/quicklisp/..
1:31:41
drl
|3b|, the file ~/.swank.lisp does not exist, but /home/l/quicklisp/dists/quicklisp/software/slime-v2.24/swank.lisp does exist.
2:03:29
drl
|3b|, if sbcl is started like this: sbcl --no-sysinit --no-userinit, and then * (load "alexandria") I get "Couldn't load "alexandria": file does not exist."
2:14:43
Alfr
And --no-userinit will also skip the bits that quicklisp set up for, not sure you want this, unless you've manually set up alexandria somewhere.
2:16:55
drl
Alfr, alexandria has been downloaded by quicklisp, but can't load. I just ran "sbcl --no-sysinit --no-userinit" because |3b| asked me to. Usually I use slime.
2:19:36
drl
(ql:quickload "alexandria") give this error message: ALEXANDRIA is a nickname for the package ALEXANDRIA.1.0.0
2:25:32
Alfr
drl, w/ --no-sysinit --no-userinit; did you try loading the setup.lisp file in the quicklisp directory and then quickloading alexandria?
2:35:51
drl
Alfr, Is this the correct way to load it?: (load '/home/l/quicklisp/quicklisp/setup.lisp)
3:02:10
drl
If sbcl is started without those options, then (ql:quickload "alexandria") loads without error.
3:04:23
Alfr_
So sbcl finds its contibs. Move your ~/.sbclrc somewhere safe and install quicklisp again with sbcl --no-sysinit .