freenode/#lisp - IRC Chatlog
Search
7:54:17
flip214
White_Flame: you can always just touch the .asd file, this causes recompilation - and will give you all the warnings anew
8:07:40
White_Flame
flip214: the main thing was what :verbose t gave me, not actually triggering the recompile
10:47:02
TheWild
#' just gives a reference to function/macro instead of executing it or using as variable. Can the #' itself be referenced?
10:58:23
phoe
but they don't expand into code like macros - in a way, they are the implementation's primitives
10:58:57
phoe
(it is permitted for an implementation to define a special operator as a macro, but it's not common to see an implementation that does this - I am not even aware of one)
11:09:50
makomo
but iirc it just expands into a non-standard special operator %HANDLER-BIND or something
11:11:11
makomo
TheWild: every comma has to have its matching backquote. you can't have a "lonely comma". further, the backquote is just a reader macro that expands into an *implementation-defined* form which upon evaluation constructs the list according to the template
11:15:42
Bike
i think clisp has a special operator of some kind for handler-bind, or maybe handler-case
11:17:10
Bike
https://clisp.sourceforge.io/impnotes/instr-set.html#instr-handler this is what i'm thinking of
11:18:10
no-defun-allowed
TheWild: by the way, you have the character comma in your list, not a quasiquoting comma
11:20:35
TheWild
I want (eval x) to evaluate into list (+ 1 5), but the part (+ 2 3) shouldn't be evaluated when in a list. Only when put into eval.
11:26:47
makomo
Bike's (list '+ 1 (+ 2 3) evaluates to the same thing that `(+ 1 ,(+ 2 3)) evaluates to
11:30:10
makomo
since the backquote syntax (reader macro) just stands for (expands to) some implementation-defined form, it is a Lisp form like any other, and can be quoted
11:45:05
TheWild
I wanted to ask how to convert a string into a symbol, put pointed out that it's (make-symbol "string")
11:45:09
didi
Where can I read about the effect of the built-in method combination types (+, and, max, progn, etc) on HyperSpec?
11:53:55
no-defun-allowed
TheWild: MAKE-SYMBOL makes an uninterned symbol, which means it has no package and is printed with a #: prefix
11:54:28
no-defun-allowed
also, 'FOO will use the package used at read time, INTERN will return a symbol in the current package
13:09:00
TheWild
darn, I tried to construct an evaluable list like there was no syntactic sugar in Lisp
13:09:07
TheWild
(LIST (INTERN "LET") (LIST (LIST (INTERN "X") 5)) (LIST (INTERN "*") (INTERN "X") (INTERN "X")))
13:23:11
phoe
quote is the most basic Lisp operator ever if you ever want to use raw literal data in Lisp
13:27:33
TheWild
I keep forgetting that when a list is quoted like here: '(((1 2) (3 4)) ((5 6) (7 8))) all the sublists are automaticallly quoted too
13:51:30
pjb
TheWild: the thing is that lisp syntax is not lisp. backquote and comma, but also parentheses, spaces, double-quotes, etc, are not lisp things.
13:51:48
pjb
TheWild: for example, (first '(a b c)) #| --> a |# shows that there's no parenthesis here!
13:52:39
pjb
TheWild: similarly, backquotes and comma don't exist in lisp. They're characters that are used by the lisp reader to build a lisp sexp, ie. a tree of conscells and atoms.
13:53:18
pjb
TheWild: the characters are in the source text; the conses and atoms are in lisp, they're lisp objects. The readers creates the lisp objects from the characters.
13:55:48
pjb
TheWild: now, this may be a little confusing, because some reader macro and translated to some specific lisp expressions. For example 'x is read as (CL:QUOTE x) #'x is read as (CL:FUNCTION x) But ' is not CL:QUOTE. ' is actually the character #\' in the source text; CL:QUOTE is a symbol in the lisp image.
13:56:34
pjb
TheWild: you cannot have a comma alone in the source text, because it will signal an error when read outside of the context of a backquote.
13:56:51
pjb
TheWild: You could override the reader macro for the comma, and make it read as something.
13:57:31
pjb
TheWild: or you can read a comma character #\, a comma string ",", or a symbol named ",": \, or |,|.
13:58:59
TeMPOraL
a question: is there a portable-ish CL way to ensure an array of data has items contiguously in memory (as opposed to getting an array of pointers to objects)?
13:59:31
TeMPOraL
i.e. I'm looking for CL equivalent of C: struct foobar { some stuff }; foobar array[123];
13:59:33
Xach
TeMPOraL: i don't think anything is specified about memory layout of arrays in that way
14:01:11
TeMPOraL
Xach: a portability layer over specific implementations (SBCL and CCL) would work too; I wonder if anything like this exists
14:01:38
TeMPOraL
I see that in SBCL one could abuse the "alien" interface to do that, but I worry that bookkeeping will kill performance gains if I wanted processing of the data to happen on Lisp side
14:11:18
_death
if the items are octets/words/floats, it's possible that a specialized simple-array would work
14:16:26
beach
TheWild: Common Lisp was designed so that it could be compiled to fast native code, unlike some modern so called "scripting languages" designed by people who don't have a clue about language design or compilation techniques.
14:16:56
beach
TheWild: If EVAL could make use of lexical variables that way, there would be very little a compiler could do to optimize the code.
14:52:32
beach
TheWild: So "is" is ambiguous. Do you mean "as typed" "as read", or "as evaluated after being read".
15:05:09
TeMPOraL
p_l: I figure that, knowing the expected lengths of arrays of structs, I could make my own "defstruct" and "with-slots" equivalents that paper over the whole thing being expanded into a set of arrays, one per each structure slot...
15:06:59
TheWild
discovered (describe ...). Now I don't have to ask what monster I just have spawned ;)
15:19:56
TheWild
beach, so tell me if I'm wrong. READ traverses the whole tree and evaluates the nodes, unless it hits the QUOTE - if so, strips QUOTE but leaves all subnodes untouched.
15:22:19
pjb
It's important to know it. For example #P calls PATHNAME at read-time, but #' doesn't call FUNCTION at read-time.
15:36:26
beach
It is impossible to teach someone Common Lisp if the requirement is that the person must know everything from the start. For example, you can say "unless #. is used", but then you have to say that #. can be redefined as well, and you have to tell the person about readtables as well.
15:37:35
beach
And of course, '<mumble> only return (quote <mumble>) when ' has not been redefined, and <mumble> does not contain any spaces, etc, etc, etc. It never stops.
15:40:42
ludston
Does anyone have a suggestion on which graph library to use? I think I must have used 4 or 5 of the different libs from quicklisp. Most seem optimised for space (in that they store edges and vertices in lists) rather than speed.
15:42:07
vms14
In the land of lisp book they show how to use graphviz and lisp only creates the files graphviz needs
15:42:18
beach
ludston: "graph" is one of the toughest data structures around, because the representation will vary a lot according to the operations you need.
15:43:19
vms14
maybe graphviz it's fine for what you want and you could let lisp create the file and execute that program
15:45:07
ludston
Generally when I am using graphs it is for some dynamic programming problem, and I'm looking for O(1) on "does this edge exist"
15:52:40
vms14
It tells things that make me understand why lisp gives you that "enlightenment" everyone hears lisp will give you
15:54:59
ludston
vms14: Use evil mode and have both. Vim is worth the investment imho, because you can get a vim mode plugin in pretty much any IDE worth using and therefor avoid re-learning shortcuts.
15:57:10
vms14
I really trust this book, so I'll forget vi and go for emacs, I didn't want to learn emacs, because it requires time
16:04:23
loke`
The horrific parenthesis rendering in climaxima annoyed me greatly but the thought of fixing it just took all my inspiration away. It's kinda like design work, and I hate design work :-)
16:04:50
TheWild
beach: some time ago I said "I choose Lisp because it seems to be the most easily parseable higher-than-assembly programming language if one had to write parser entirely from scratch, but seems that I will likely end up with my own dialect.", so really what I want to do is to know the inner workings of Lisp, what decisions were made and why and by chance learn some Lisp.
16:06:31
loke`
Anyway, I finally decided to add some capabilities to the output records so that they can carry rendering hints (something along the lines of: "this part here should not be considered part of the bounding rectangle when computing the size of surrounding parenthesis
16:07:01
beach
TheWild: But if you are programming from scratch, there is no particular reason to use a static programming language at all.
16:08:27
loke`
beach: Yeah, it works. The dimensions still don't come out right, but that's a matter of tuning the dimensions :-)
16:19:34
TheWild
a couple of year ago I wanted to write assembler for ARM processors which could offer a bunch of higher level constructs. I didn't have experience in compiler design though so I eventually gave up. Bah, I still don't have an experience, but writing a parser and evaluator for limited dialect of Lisp seems a good attempt to build something that works.
16:22:40
p_l
(with VAX-oriented MACRO-32 turned into a compiler that generated Alpha code from VAX assembly)
16:22:56
vms14
I would recommend common lisp (mostly sbcl) since it has support for more things, like backend with hunchentoot
16:24:06
p_l
TheWild: well, KA-10 and KI-10 as well as PDP-6 I think all required writing the early bootstrap code into memory by hand, but that was in limited cases AFAIK
16:24:24
p_l
TheWild: the code was essentially few instructions that would loop over reading from paper tape
16:26:28
vms14
It's likely that you'll end writing more stuff with lisp that what you intended when you "entered" to the lisp world
16:27:05
beach
vms14: I think TheWild has decided that it is fun to design a programming language. This is my conclusion because no advice about existing languages or other techniques seem to get across.
16:27:26
p_l
loke`: though I will have to hunt down how exactly certain people made it so that programs built with early MIDAS worked while MACRO-1 didn't
16:30:53
vms14
I cannot say that really, but I guess if I use scheme would be as an embedded language rather than a standalone
16:36:13
neeasade
hi all -- what is the mechanism by which asdf finds ffi .so files? -- I ask because i'm on nixos where a dynamic ld wrapper gets set that just adds many rpath params and I'm trying to connect some things in a non-nix way probably.
16:38:42
jackdaniel
cffi looks at the standard locations, I don't know anything about asdf looking for so files (nor having anything to do with ffi)
16:39:01
liambrown[m]1
Sorry if this question comes across as noise. I've just started picking up LISP to work better with Emacs, and I've realized I probably want to do a lot more with it than that. Question is this: Node has NPM, PHP has Composer, Python has Pip, etc.; do equivalent facilities exist for LISP where I can write a program with dependencies and have them imported? From my searches since yesterday, it looks like Quicklisp might
16:41:38
neeasade
jackdaniel: thanks -- I think I was thinking asd gets in the mix because the reference is coming from the 'components' part of a definition -- https://github.com/swaywm/cl-wlroots/blob/master/cl-wlroots.asd#L21 -- so the issue is the .so can't be found while building that component
16:42:35
liambrown[m]1
I just read that LISP is used for AI, as well as a lot of other things. Not the silly little scripting language I've been led to believe it was, I guess.
16:42:40
jackdaniel
I don't know much about it, but I'd guess it also looks exactly where cffi does look
16:44:04
liambrown[m]1
@jackdaniel sorry, I'm conflating names. I take it CL is a good place to start for professional use?
16:44:35
jackdaniel
yes, Common Lisp is a result of standarization of various dialects being LISP descendants
16:45:07
pjb
Loading the boot code by hand made for computers you could trust. Nowadays, you don't know what code boots your computers!
16:45:19
vms14
one of their students was reading a paper from his teacher and thought he could write the eval function in asm
16:45:46
jackdaniel
then, for ones delight, read PAIP, which is a profound lecture with case studies of Common Lisp code
16:45:58
p_l
to be honest, a lot of very early foundational work in Computing Science can be divided into "numerical processing" and "AI" with growing side of "programming language theory"
16:47:20
liambrown[m]1
It's an interesting experience, coming from years of JS, PHP, and Python. I decided to go back to extreme basics this time around; that's been a helpful approach for me before.
16:47:56
vms14
and this is why prolog and lisp have some relation, just because they're known to be used for ai
16:48:29
p_l
well, Lisp arguably makes it quite easy to write the kind of object oriented code common in symbolic AI
16:48:30
beach
liambrown[m]1: I think you will find that Common Lisp is an extremely powerful language, and that there are some excellent implementations out there, capable of generating fast native code.
16:49:10
liambrown[m]1
Some of the ML/AI folks harp on the importance of GPUs for app performance. Any good starting points for that in CL, or should I even worry about it?
16:49:38
p_l
liambrown[m]1: don't worry about GPUs unless you're into statistics or similar pure numerics
16:50:49
p_l
and with TensorFlow and the like you're mostly stringing together abstract commands in a pipeline
17:00:37
pjb
beach: you don't mean "AI", you mean stockastic machine learning ;-) Hofstadter wouldn't call that AI…
17:21:00
flip214
Is there a function to convert a 2-dimensional array to 1-dimensional, like ROW-MAJOR-AREF then addresses it?
17:39:31
flip214
when given a function like #'=, is there a way to get back to the symbol? (doesn't work for anonymous functions or closures, of course)
17:51:47
flip214
TheWild: '(1) potentially gives you an immutable list - it could be stored in ROM, for example. So changing the CDR of that CONS is not allowed.