freenode/lisp - IRC Chatlog
Search
3:01:41
thmprover
I'm actually having some difficulty getting into the hang of literate programming in org-mode.
3:06:04
thmprover
Literate programming (in the Knuth sense) is difficult, but getting org-mode to export the correct HTML is tedious. It feels like I'm fighting against the tide.
3:07:34
thmprover
I take advantage of a lot of custom TeX macros, and they don't play nice with pandoc.
3:08:41
thmprover
I mean, I can see pandoc's appeal to the generic user, but I'm the "crazed TeX survivalist"-type user.
3:08:56
no-defun-allowed
Yes, pandoc doesn't properly run TeX. So I use htlatex and fix up a bit of the nonsense it emits with a script that runs sed.
3:10:05
thmprover
I'm starting to explore htlatex to translate this manuscript I'm writing on theorem provers to HTML, it's a nifty program, but so...niche.
3:10:56
no-defun-allowed
Specifically, we use https://gitlab.com/cal-coop/netfarm/documentation/-/blob/master/make-htlatex.sh and that ends up making https://cal-coop.gitlab.io/netfarm/documentation/ which is...bearable.
3:11:02
lotuseater
a friend of mine also showed me this half a year ago, maybe it's of use for anyone else: https://latex.now.sh/
3:12:41
thmprover
lotuseater: the rendering is, I can't quite put my finger on it, the fonts are slightly mismatched. The CMR is too light compared to the monotype font weight.
3:14:18
lotuseater
how do i in org-mode set globally to tangle all blocks? except the ones with ":tangle no"
3:18:23
thmprover
I'm trying to work with it to write my notes on earth science, but it's...I don't know...
3:19:04
thmprover
I sense I am doing things wrong with org-mode, but I don't know what "doing things right" looks like, and the only talks on it seem to be excited users talking about how great it is.
3:31:34
thmprover
fiddlerwoaroof: I'm doing pretty tricky macro stuff, which takes advantage of the dynamic scoping of TeX (and I think confuses pandoc)
3:40:10
no-defun-allowed
Well, I don't know if pandoc does any macroexpansion. It just ignored my \Defun commands.
3:53:01
fiddlerwoaroof
Yeah, I mostly relied on latex being passed through in md -> latex conversion
3:55:54
fiddlerwoaroof
One thing I find interesting about SLIME, is that it doesn't seem to make much use of generic functions or EIEIO
3:56:28
fiddlerwoaroof
Maybe it's too old, but I've found it pretty useful for managing my emacs configuration
6:27:50
badcfe
in 'on lisp' fig 14.3 there's a aif2 that seems wrong to me. but i see this is not in the errata, and i'm not really a lisper, hence i am guessing i'm wrong
6:30:16
badcfe
on the forth line there, i see (if (or it ,win) ,then ,else)) .. and i am thinking it should be (if ,win ,then ,else)
6:31:05
beach
I guess that depends on how he specified what should happen with the values of the test.
6:32:16
badcfe
yes, and it's not even specified, but there's also a usage example, which makes me think what i mention here
6:43:10
beach
It was a while ago that I read On Lisp, but now I see that AIF2 solves a major problem with the single-value version, namely that, if you respect the advice of Norvig and Pitman of using only Boolean expressions as the test in IF, then the "IT" of AIF will never be a useful value.
6:44:08
badcfe
i see now, that it doesn't matter, because both are null iff we shall branch to ,else -- if we can assume that any function indicating not-found on second return value will always have a null first return value as well, in other words that we have a functional dependency (sorry to use database theory term here). however, i think my variant is more intuitive in addition to be shorter
6:50:31
beach
I try as much as possible to follow the advice of page 13 of the LUV slides by Norvig and Pitman, if that's what you are asking.
6:51:58
beach
I like it very much. It was written by two people with a lot more experience with software development in larger teams than I will ever have.
6:52:44
beach
Many #lisp participants contest their advice, but I think I know for a fact that the people who do contest it have way less experience than these two people have.
8:16:47
fiddlerwoaroof
If these are the notes you're talking about, they're pretty interesting: https://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf
8:21:52
phoe
they very rarely need to be used, given that non-local GO/RETURN-FROM also exist and are slightly safer to use
8:22:20
phoe
...unless they leak out of their dynamic scope, but that is usually not very hard to spot in code
8:22:54
phoe
but THROW doesn't need to lexically match a CATCH form, which is also much more general
8:23:21
phoe
so if you don't feel like passing a closure all the way to your non-local jump site, THROW might be a good option
8:36:44
fiddlerwoaroof
phoe: I needed to figure out a good way to avoid doing extra work with taking here: https://fwoar.co/pastebin/3cf12f4c0037cce4021a1da07bf2da76051bc425.lisp.html
8:37:33
fiddlerwoaroof
Obviously, with the LABELS implementation I can just use a block, but this is just for convenient prototyping
8:38:02
fiddlerwoaroof
The lines beginning with `>>>` show every invocation of the inner function in TAKING
8:38:22
fiddlerwoaroof
TAKING is supposed to only process N elements of the collection being worked on, and ignore the rest
8:39:37
phoe
the only other option is to pass a closure all the way to TAKING, which might or might not be viable in your case
8:40:14
fiddlerwoaroof
Yeah, I thought of conditions but those also just feel semantically wrong for this
8:41:40
phoe
and it's up to the code around this call to handle or ignore it. this includes optionally performing a non-local jump.
8:42:13
phoe
so using HANDLER-CASE over SIGNAL would be equivalent to THROW/CATCH, but also very likely it would be slower because of walking the handler stack and performing runtime type checks.
8:43:10
phoe
so you're good with THROW/CATCH in this case, it seems like the proper primitive for bailing out early in this case.
8:44:37
phoe
well now you did think about it, most likely because you actually found a use case for it
8:45:22
fiddlerwoaroof
This is true in most languages, but I find the variations in CL more interesting
8:56:31
no-defun-allowed
Hypothetically, you at least have a definition of all the dialect-y stuff in a common language, which may not be the case for human languages.
9:31:35
ldb
my spell check program prototype takes very long time to input a dictionary of 10,000 words
9:32:03
phoe
I remember that beach and I collaborated on a spellchecker once; https://github.com/robert-strandh/Spell
9:32:25
beach
ldb: I suggest you save as a Common Lisp data structure so that you can just do a READ.
9:34:36
ldb
it is due to the data structure I use requires a lot of comparison between nodes when build from a list of sorted words
9:35:42
beach
ldb: Build it once from the source data, and save the built data structure using PRINT.
9:36:42
phoe
beach: currently, Spell saves it to a FASL. It has no facilities for printing that data.
9:36:44
Nilby
as you may known, things with lists can unintentionally get O(n^2) or worse very quickly
9:37:23
ldb
it requires 2 minitues on a test input of 10,000 words, but my actual input is 500,000 words, and building from larger dictionary takes extra comparsions
9:38:43
ldb
phoe: https://www.researchgate.net/publication/220355507_Incremental_Construction_of_Minimal_Acyclic_Finite-State_Automata
9:39:47
ldb
beach: yes, I realized every time a new node is added it has to be compared by almost every existed nodes, to minimize the data structure
9:46:42
ldb
ok, instead of a naive list, I can keep a lookup table with a bool and the number of children as index keys to do a pre-filtering
9:49:29
ldb
is there a quick way to compare two assoc lists? the order doesn't matter, then only requirement is that each pair with #'eql keys should be has #'eq values
9:51:53
Nilby
Usually if you have more than about 12 elements in a alist it will be faster with a hash table.
10:28:53
Nilby
Hmm. I have 1gb databse with 10m words that takes about 20 secs to load and full regexp search, and I thought it's way too slow.
10:52:51
Nilby
The raw IO for 1gb only takes about 1.6 secs for me, and that's longer than it should.
13:39:24
Nilby
puchacz: It looks synchronized to me from reading the code, but I haven't tried it. If you want your code to work on other implementations you could wrap in bordeaux-threads:with-lock-held .
13:42:06
Nilby
The problem is it's still a race condition if your code does a (gethash val table) and then later does a (setf (gethash val table) ..) presuming the results of the previous gethash are still valid.
14:32:32
nwoob
I looked how to compile CL program and found C-c C-k to evaluate buffer, but C-c C-k is undefined
14:33:53
nwoob
in there i'm typing CL code and trying to compile the function so that I can use that function in aline-repl
14:34:29
phoe
you should be able to type something in the scratch buffer, like (defun foo (x) (+ x 42)) and then hit C-c C-c on it
14:41:38
nwoob
Turns out I need to save scratch buffer code. I saved code in test.lisp and then did C-c C-k and it is working
14:44:05
hendursaga
Besides SBCL, what other implementations have the disassemble function disassemble to assembly language, not bytecode or C?
14:47:30
Nilby
CCL aslo has no memory limits, and can call C code with structs by value without libffi