freenode/#lisp - IRC Chatlog
Search
21:30:01
jeosol
rumbler31: I am trying to create some blog post using markdown and export everything to html. I would like to capture output of my program that's dumped to the repl. I do that manually, but wondering if there are automated techniques like using org-model + babel (not an expert in this but seen a few videos)
21:32:30
jeosol
rumbler31: not what I mean. I mean like certain outputs just go to certain sections of the markdown documents. The example I cited (some YT tutorial) captures shell or python output from code blocks or something.
21:39:20
pjb
jeosol: yes, I'm using the CL library to do literate programming. The CL library contains the operator #| that introduces text, and |# that introduces code.
21:40:50
pjb
#| for example, let's define a function named square: |# (defun square #| that takes one argument: |# (x) #| and compute the square: |# (* x x)) #| note how code is brackeded with |# #| ! |#
21:41:11
p_l
mooch2: wish I could help you out, but I'm too busy with work at the moment to even write a line of code for my Ivory emulator (right now more of a dissector)
21:41:37
pjb
jeosol: also, notice how emacs knows that it should fontify only the code between |# … #| and not the text.
21:41:55
jeosol
That is the link. I have no affliation with the author and watched that video after it was posted on the emacs reddit link
21:42:16
pjb
jeosol: notice how compile-file, load and read are literate-programming ready: they only process the code!
21:42:37
jeosol
pjb: Thanks for your info. I am not an expert in this at all, but noticed it will allow me to organize my files together with the examples.
21:45:14
pjb
To invoke the literate programming library, you just start the file with #| and end it with |#.
21:46:48
p_l
*if* you do some creative work with readtable you can get it to output the text and push it through some other formatter
21:47:01
pjb
#| for example, let's define a function named square: |# (defun square #| that takes one argument: |# (x) #| and compute the square: |# (* x x)) #| note how code is brackeded with |# #| ! |#
21:47:34
p_l
not sure how well it would work for manipulating both code and text for purposes of generating printed document that had both
21:48:08
jeosol
@p_l: that sounds like what I am looking for like the linked YT video. Not sure it's possible though, I wanted to see what people are using
21:49:02
jeosol
I want to type markdown, and somewhere in the document, I can have lisp code (and comments) to help me remember what cases or functions I called ( I don't have to show the lisp code), but the output gets generated into the document
21:50:45
pjb
https://www.offerzen.com/blog/literate-programming-empower-your-writing-with-emacs-org-mode
21:53:23
PuercoPope
jeosol: There is a erudite for literate programming although its more for writing and finding your way about the code that presenting it https://bitbucket.org/mmontone/erudite/src/master/
21:58:22
PuercoPope
Not for documentation but to provide a superstructure to the code, outlines in this case. You can check mariano's fork of scenic to see how erudite is used.
22:03:57
jeosol
pjb: Checked the link and I think there is CL support and that org-mode route should work.
22:11:41
Josh_2
Using the python one from this site http://urlregex.com/ works with two escape characters
22:17:35
aeth
jeosol: The reason #| ... |# works for literate programming is because you can just write a second parser and effectively you parse the file twice, once as a document and once as a program. Parsing it as a program is, well, it's just using the default reader and it will run, no magic required since it's just the comment syntax. Parsing it as a document means you read it as an extended Markdown or LaTeX or whatever.
22:19:16
aeth
Essentially, you can just preprocess it for an existing Markdown->HTML generator and invert the comments in that preprocessed step. So "|# ... #|" would become "`...`" if it's "inline" and if it's multiline it becomes "```common-lisp\n...\n```"
22:20:50
aeth
You could probably do this with regular expressions if you're careful about the edge cases (like the first comment where there's either a "#|" that needs to be removed if it starts with a comment or a "... #|" that needs to be turned into lisp followed by markdown without having a first |#)
23:37:09
saturn2
where can i find examples of some of the CLtL2 features (macroexpand-all, compiler-let, variable-information, parse-macro, enclose, etc.) being used?
23:54:03
saturn2
yes i can come up with some ideas myself, but surely people smarter than me have thought about this before
23:54:57
Bike
https://github.com/guicho271828/inlined-generic-function is the only library i can think of using them
0:58:22
vms14
I ended using a lot this one (defun make-text-buffer () (make-array 0 :adjustable t :fill-pointer t :element-type 'character)) and the html functions I've made with a bad implementation that return html code
1:42:25
White_Flame
recurses through all CARs of nested lists, as well as the last element of an improper list
1:46:37
Colleen
Unknown command. Possible matches: 8, help, set, say, mop, get, time, tell, roll, deny,
1:48:19
vms14
https://stackoverflow.com/questions/43989257/how-to-export-all-definition-symbols-in-a-file-in-common-lisp
3:23:51
oni-on-ion
https://quickref.common-lisp.net/alexandria.html#go-to-the-ALEXANDRIA_003cdot_003e1_003cdot_003e0_003cdot_003e0_003ccolon_003e_003ccolon_003eNCONCF-macro
4:11:01
equwal
""The GENERIC-CL-USER package is also provided, which contains all the symbols in the CL-USER package" -- don't do that.
4:11:32
equwal
"This package is intended to be used only at the REPL" -- now I really don't see the utility.
4:12:21
oni-on-ion
hmm i don't see the purpose of these comments. it just sounds like its not for you
4:13:43
equwal
I was hoping for something like "it is useful for this use case where..." or similar. But it seems like it is for...no one?
4:14:31
oni-on-ion
rather than to suggest it for this purpose or that developer, i think its cool to have available. i personally happend upon it by someone looking for Lazy Sequences.
4:15:20
oni-on-ion
saturn2, huh; funny -- thats exactly what the first paragraph of that URL describes it as. perhaps we are too accustomed to scrolling and scrolling and scrolling our social feeds =)
4:16:54
saturn2
equwal: the relationship between GENERIC-CL and GENERIC-CL-USER is the same as between COMMON-LISP and CL-USER
5:38:04
beach
p_l: Yes, thanks. Monday mornings are always chaotic around here. This one a bit more than usual. But it is all planned and under control. You?
5:40:52
p_l
patrixl: I don't believe it will happen to me before retirement, and I expect retirement to come maybe ~20 years after I'm dead
6:20:09
aeth
From HN 2 weeks ago... "Is Death Reversible?" https://news.ycombinator.com/item?id=21409744
6:20:21
aeth
That means that in the future, your employer will revive you from death so you can keep working!
7:01:50
p_l
patrixl: *after* my death. what isn't clear is whether I'd be still working, certainly I won't get to enjoy retirement
7:26:11
flip214
p_l: obviously you need to enjoy working, then it doesn't matter whether you retire or not
7:28:01
flip214
well, in 18 years you'll be one of the long-sought experts for the 2038 unix date migration, perhaps that's sufficient to let you retire
7:32:37
White_Flame
or dig into the hashtable internals of your implementation, and you'll likely find arrays to index into randomly