earl-ducaine has quit [Quit: No Ping reply in 180 seconds.]
earl-ducaine has joined #commonlisp
n0den1te has joined #commonlisp
earl-ducaine has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 252 seconds]
mingus has joined #commonlisp
earl-ducaine has joined #commonlisp
earl-ducaine has quit [Ping timeout: 255 seconds]
earl-ducaine has joined #commonlisp
waleee has joined #commonlisp
earl-ducaine has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 260 seconds]
brettgilio has joined #commonlisp
chowder has joined #commonlisp
robin has quit [Read error: Connection reset by peer]
<chowder>
Hi, all, I'm new to common lisp. I'm trying to make a memoized version of the fibonacci function (https://plaster.tymoon.eu/view/3662#3662) but I'm running into issues. I'm getting a malformed let-bindings error. I'm trying to bind the list '(0 1 1) to fib-list and then append to it the sum of the last two values. Its simple but there's probably something glaringly wrong that I'm not seeing.
<Bike>
chowder: (let ((fib-list (list 0 1 1))) ...) is the syntax you want
<chowder>
oh my goodness. That would've taken me ages to figure out. Thanks!
<Bike>
your while loop is not going to work either, first off because "while" is not a standard operator
<Bike>
and append doesn't not have side effects
<Bike>
and, the '((sum-last-two fib-list)) is presumably supposed to call the sum-last-two function, but since it's quoted, it won't
<Bike>
What reference are you using to learn the language?
<chowder>
I was using lisp koans but the interpreter hit some kind of error that I couldn't debug on my own
<Bike>
lisp koans has code like this?
<chowder>
lol no I'm just trying to implement something basic
<chowder>
I figured I'd try to learn common lisp on my own since I ran into the issue with lisp-koans but I'm certainly running into some difficulties
<chowder>
I'll read it. Thanks for the help, I appreciate it.
n0den1te has quit [Quit: leaving]
<Bike>
no problem
<chowder>
I do like how free form common lisp is. I'm studying for the AWS developer associate cert. I know like 5 other languages. Lisp is more fun than any of them.
<Bike>
that's good to hear. it is a nice language to improvise in.
<chowder>
I was actually drawn to lisp because there's a capablities-secure language called E. It has a common lisp implementation called E-on-CL. I was amazed at just how flexible the language is. Might have to look at Scheme once I'm comfortable with CL.
waleee has joined #commonlisp
an_origamian has joined #commonlisp
robin has joined #commonlisp
robin has quit [Remote host closed the connection]
tevo has quit [Read error: Connection reset by peer]
robin has joined #commonlisp
an_origamian has quit [Client Quit]
tevo has joined #commonlisp
<bjorkintosh>
chowder, and it's an old language too! so you know by the law of the lindy effect, that it will be around for a while to come.
tyson2 has quit [Remote host closed the connection]
chowder has quit [Quit: Leaving.]
<patrix>
I do like how free form common lisp is. <---- yeah, free-form and unchanging! Don't have to keep churning your code every 6 months to keep up with the language/framework updates...
<beach>
What does it mean for a language to be "free form", and how is Common Lisp more so than other languages?
igemnace has joined #commonlisp
<an_origamian[m]>
Example: I can stick my if statements nearly anywhere. It's inconvenient to do that in some languages.
<beach>
I see. So you are saying that the difference between statements and expressions in other languages makes them less "free form"?
<beach>
an_origamian[m]: By the way, we call them "forms" and not "statements" in Common Lisp.
masinter has quit [Remote host closed the connection]
bitmapper has joined #commonlisp
akoana has quit [Quit: leaving]
<edgar-rft>
if you want to pay me taxes, I'll give you the form for free
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
<patrix>
nah, and I think we're referring to what chowder was writing
<patrix>
my interpretation of chowder's statement was that there's a lot less strict structure and boilerplate to writing CL code
<edgar-rft>
oh, sorry patrix, reading the backlog I see that it was chowder who originally said that
<patrix>
no worries
<patrix>
I got myself involved in this mess by replying/quoting chowder haha
<edgar-rft>
I think "free form" means that code formatting (indentation etc) in Lisp is based on social communication conventions (Lisp style guides etc), but not enforced by the language specification.
<edgar-rft>
Lisp code must be written in lists that are following the syntax rules defined by the specification, but the interpreter/compiler doesn't care whether the code is written in a human-readable style.
<hayley>
For which languages is that not the case?
<jcowan>
hayley: In one sense, none. But it is clear that Python and Fortran are much less free-form than Lisp and C; what is merely formatting in the latter languages has semantic import in the former languages.
<jcowan>
(I should say, older Fortran)
<edgar-rft>
hayley: there are many languages where the code is *not* required to be written as lists to begin with...
<hayley>
edgar-rft: Well, everything other than the lists part. Specifically, that the syntax must follow the specification of the language, but the implementation doesn't care about if the code is written in a readable style.
<edgar-rft>
in many languages line-breaks are significant for example
<patrix>
another example of what I think chowder meant, that makes Lisp languages free-form: no need to worry about operator precedence
<patrix>
... anyway
earl-ducaine has joined #commonlisp
earl-ducaine has quit [Quit: No Ping reply in 180 seconds.]
earl-ducaine has joined #commonlisp
Lumine has joined #commonlisp
earl-ducaine has quit [Ping timeout: 248 seconds]
Demosthenex has quit [Ping timeout: 252 seconds]
Demosthenex has joined #commonlisp
<aeth>
As I've said before: Python makes the wrong whitespace significant. Indentations? I don't care too much. Those can be fixed. "x+y" instead of forcing "x + y" with a whitespace separation? ugh. For one thing, that prevents lisp-style-naming
shka has joined #commonlisp
rgherdt has joined #commonlisp
ttree has quit [Ping timeout: 246 seconds]
Lycurgus has joined #commonlisp
pve has joined #commonlisp
_cymew_ has joined #commonlisp
<jcowan>
I think the point is that everyone indents their code, but if the (not so visible) punctuation doesn't match the (highly visible) indentation, the indentation is ignored. It's as if when writing prose, most people began paragraphs with a pilcrow sign, but if the pilcrow sign appeared in the middle of a line, it was taken as a paragraph break, and regular paragraph breaks were ignored.
<jcowan>
pilcrow = ¶
attila_lendvai has joined #commonlisp
_cymew_ has quit [Ping timeout: 255 seconds]
<edgar-rft>
As beach already poiunted out "statements" in Lsp are called "forms". Lisp gives us these forms for free, or at least I haven't paid for one. I take this as just another argument for Lisp being a "free form" language :-)
igemnace has quit [Remote host closed the connection]
<hayley>
edgar-rft: Can non-local transfer of control be used for tax evasion?
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
<beach>
Actually, in certain situations, a form can be a "statement". I think only in a tagbody (explicit or implicit). But there might be some others I have forgotten about.
<beach>
But the general term is "form".
bitmapper has quit [Quit: Connection closed for inactivity]
attila_lendvai has quit [Ping timeout: 252 seconds]
n0den1te has joined #commonlisp
attila_lendvai has joined #commonlisp
Posterdati has quit [Read error: Connection reset by peer]
attila_lendvai has quit [Ping timeout: 255 seconds]
Posterdati has joined #commonlisp
occ has quit [Ping timeout: 246 seconds]
occ has joined #commonlisp
cage has joined #commonlisp
n0den1te has quit [Quit: leaving]
Prokhor_ has quit [Ping timeout: 246 seconds]
aartaka has joined #commonlisp
earl-ducaine has joined #commonlisp
aartaka has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
szkl has joined #commonlisp
jmdaemon has quit [Ping timeout: 248 seconds]
random-nick has joined #commonlisp
igemnace has joined #commonlisp
_cymew_ has joined #commonlisp
semarie has quit [Quit: WeeChat 3.8]
semarie has joined #commonlisp
pjb has quit [Remote host closed the connection]
semarie has quit [Ping timeout: 260 seconds]
azimut has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
semarie has joined #commonlisp
jrm has quit [Remote host closed the connection]
jrm has joined #commonlisp
jrm has quit [Client Quit]
jrm has joined #commonlisp
jrm has quit [Client Quit]
jrm has joined #commonlisp
Prokhor_ has joined #commonlisp
pjb has joined #commonlisp
random-jellyfish has joined #commonlisp
<random-jellyfish>
in emacs how can I find all the occurrences of a common lisp function or variable in a project?
<hayley>
M-x slime-who-calls (or somesuch, I forgot the name) for functions
<jackdaniel>
if you use slime then you may try your luck with slime-who-*
<random-jellyfish>
slime-who-calls / sly-who-calls does the trick
<random-jellyfish>
thanks!
<pve>
random-jellyfish: sometimes, you may want to use M-x multi-occur-in-matching-buffers
<pve>
for instance, you can easily rename things from there
<random-jellyfish>
are there any Lisp-based EDA tools, like for hardware design, simulation and verification, kind of like a Lisp equivalent of Verilog or VHDL?
<random-jellyfish>
I'm working on a pet project that does that and I'm wondering if I'm not reinventing the wheel
earl-ducaine has quit [Ping timeout: 255 seconds]
<hayley>
I have a crappy HDL on my desktop, for which I can do a lousy timing analysis on, but that's it. Helps that I couldn't build the Google library I ripped off, after installing two copies of LLVM and a JVM from their build system.
<jackdaniel>
I remember talking with someone who was working on a similar tool but that was internal thing; I didn't encounter anything foss in this area
<hayley>
ACL2 has tools for prodding around Verilog, I hear.
<random-jellyfish>
I'm currently working on a discrete event simulation kernel that mimics the one from the SystemVerilog standard
<random-jellyfish>
I'm progressing slowly because I'm still learning how to debug Common Lisp but I'm getting there
<beach>
Good luck. It's not easy with the tools at our disposal.
<random-jellyfish>
yeah, I'm feeling tempted to switch to Julia, but I think a Lisp based tool would much more general and powerful
<random-jellyfish>
plus CLOS is much better than Julia's object system
attila_lendvai has joined #commonlisp
<beach>
Absolutely.
<mfiano>
Well, it doesn't have an object system.
earl-ducaine has joined #commonlisp
<mfiano>
There are user-defined types, similar to structs in CL, but with no inheritance or an equivalent of :INCLUDE. Idiomatic Julia uses composition for everything, and hides it by means of multiple dispatch specialized to arbitrary types, rather than the names of any sort of class name or equality..
<mfiano>
But yes, I do believe the language is too restrictive in how one must organize programs, almost solely due to this lack of an object system.
Lumine has quit [Quit: later]
attila_lendvai has quit [Ping timeout: 255 seconds]
eddof13 has joined #commonlisp
eddof13_ has joined #commonlisp
<pve>
Will package-name return nil only if the package has been deleted? I.e. is it a reliable mechanism for detecting whether a package has been deleted?
random-jellyfish has quit [Quit: Client closed]
rgherdt_ has joined #commonlisp
<beach>
It looks to me like it is.
<pve>
beach: great!
<pve>
thanks
<beach>
Sure.
rgherdt has quit [Ping timeout: 255 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_cymew_ has quit [Ping timeout: 252 seconds]
earl-ducaine has quit [Quit: No Ping reply in 180 seconds.]
earl-ducaine has joined #commonlisp
cage has quit [Remote host closed the connection]
<jcowan>
Can someone explain the rationale for syntax like #A, #P, or #S? It seems that these things could be done using either a macro that accepts unquoted arguments, like (array 2 ((1 2) (3 4))) or a function?
<jcowan>
s/?$/.
<beach>
They would be executed at different times then. The # syntax makes the reader allocate the object. With a macro, it is at compile time at the earliest.
<jcowan>
Quite so. But what's the benefit of read-time vs. compile-time? (I see the benefit of compile-time vs. run-time.)
<jcowan>
We do not, for example, have syntax for constructing has tables at read time, or class instances.
emanuele6 has quit [Ping timeout: 255 seconds]
emanuele6 has joined #commonlisp
earl-ducaine has quit [Ping timeout: 246 seconds]
<beach>
For some class instances, we do.
tyson2 has joined #commonlisp
mjoerg has joined #commonlisp
mjoerg has quit [Remote host closed the connection]
cage has joined #commonlisp
earl-ducaine has joined #commonlisp
kdlv has joined #commonlisp
bjorkint0sh has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 248 seconds]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life_ is now known as Lord_of_Life
glaucon has joined #commonlisp
eddof13_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
chowder has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
earl-ducaine has quit [Ping timeout: 252 seconds]
thoughtron has quit [Ping timeout: 252 seconds]
tane has joined #commonlisp
tane has quit [Changing host]
tane has joined #commonlisp
Oladon has joined #commonlisp
earl-ducaine has joined #commonlisp
_cymew_ has joined #commonlisp
<jcowan>
Very well, for instances of classes whose metaclass is standard-class.
masinter has joined #commonlisp
<jcowan>
But I would still like to know why these things and not others were provided with syntax back in the pre-surnames period.
tyson2 has quit [Remote host closed the connection]
morganw has joined #commonlisp
<jackdaniel>
ability to insert literals into code has a benefit over operators that it does not depend on the position of such literal
_cymew_ has quit [Ping timeout: 260 seconds]
<jackdaniel>
consider (list (make-pathname ...)) and (quote (make-pathname ...)) vs (list #p"...") and (quote #p"...")
<phoe>
you can also add literals into quoted code that way
<phoe>
yes, exactly this
kenran has joined #commonlisp
kenran has quit [Remote host closed the connection]
<jackdaniel>
there is also a requriement for some objects to be possible to be printed readably
<jackdaniel>
while it could be #.(make-something ...) I guess #p"..." looks prettier to the eye
attila_lendvai has joined #commonlisp
aaaa_bbbb has left #commonlisp [ERC 5.4 (IRC client for GNU Emacs 28.2)]
SenFache has quit [Read error: Connection reset by peer]
Sauvin has joined #commonlisp
tyson2 has joined #commonlisp
Oladon has quit [Quit: Leaving.]
Gleefre has joined #commonlisp
Inline has quit [Read error: Connection reset by peer]
Inline has joined #commonlisp
glaucon has quit [Read error: Connection reset by peer]
<aeth>
The lack of something like an #H for hash tables is probably an oversight. It absolutely would have existed had there been a standard 5-10 years newer. I guess they weren't as overwhelmingly popular in dynamically typed languages in the '80s.
<aeth>
It's not too hard to add, but of course that means that 5 different utility libraries have probably added it.
Alfr has quit [Ping timeout: 246 seconds]
chowder has quit [Quit: Leaving.]
eddof13 has joined #commonlisp
<aeth>
There's no macro equivalent, either. You have to (make-hash-table) and then PSETF it in a simple macro to get a macro that can do something like (hash :foo 42 :bar 2) which could then become the target of a #H(:foo 42 :bar 2) if H isn't already taken.
attila_lendvai has quit [Ping timeout: 255 seconds]
earl-ducaine has quit [Ping timeout: 255 seconds]
cage has quit [Quit: rcirc on GNU Emacs 28.2]
earl-ducaine has joined #commonlisp
_cymew_ has joined #commonlisp
chowder has joined #commonlisp
bjorkint0sh has quit [Quit: Leaving]
waleee has joined #commonlisp
<Bike>
since there's no limit on how many times the evaluator expands macros, a macro and read syntax could have different behavior outside of the compiler
<Bike>
but i think the actual reasoning for why CL has syntax is probably more adhoc
<aeth>
The thought was probably to use a plist/alist when small; then if hash tables are only for large collections, then it wouldn't be a priority to provide a printable #H(...) representation for them.
<pve>
would #H(...) use the eql test?
<jackdaniel>
yes, just like #a takes the element-type t
<jackdaniel>
mind that the syntactic sugar is a reason of the code cariosity.
chowder has quit [Quit: Leaving.]
tyson2 has quit [Remote host closed the connection]
_cymew_ has quit [Ping timeout: 248 seconds]
waleee has quit [Ping timeout: 248 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jmdaemon has joined #commonlisp
waleee has joined #commonlisp
tane has quit [Quit: Leaving]
<jcowan>
In short, hash tables are a second class, maybe even third class, datatype.
<aeth>
definitely second class
jeosol has joined #commonlisp
<aeth>
it lacks the macro/reader syntactic sugar (including a useful printable representation) but otherwise is complete
<jcowan>
jackdaniel, phoe: I think I follow what you are saying, but why would you write (quote #p"..."), since #p"..." means the same thing?
<jcowan>
(I read that as "code curiosity" at first and was sorely puzzled)
<jackdaniel>
jcowan: the quote is rather something external, i.e (let ((form '(do-something #p"xxx"))) `(with-blah () ,form))) and such
<jcowan>
Ah, I see. Thanks.
<jackdaniel>
I don't think that having a syntactic sugar is a prerequisite for something being a "first class datatype"
<jcowan>
I guess that makes more sense for #p, which denotes a non-compound (though dissectable) object, than for #a, which is a compound object: you probably don't have literal lists with embedded arrays very often
waleee has quit [Ping timeout: 252 seconds]
<jackdaniel>
literal lists are sometimes useful when you transpile to common lisp code
<jackdaniel>
s/lists/objects/
<jackdaniel>
then you may simply (write (expand-code)) and be done with it
<jcowan>
Still, yoiu can replace them with quasilists: `( 1 2 (make-pathname "..."))
<jackdaniel>
afair magicl does that to compile bindings to lapack etc
<jcowan>
er, insert comma there
<jcowan>
quasiquote is first-class in Scheme and sbcl and I tend to think of it that way in CL in general
<jcowan>
THe main use case that occurs to me for syntax is data files: you do not want data files to contain code, including macro calls
shka has quit [Ping timeout: 248 seconds]
<jcowan>
Arrays are somewhat less second-class: there is no function or macro "array" analogous to "vector", but there is #a
<jackdaniel>
I don't understand what "first class" or "second class" means here
<jackdaniel>
(make-array ...) allows you to construct an array
pkal has left #commonlisp [Killed buffer]
<jackdaniel>
if you rename make-array to array then it will be magically 'first class'?
Demosthenex has quit [Quit: Changing server]
<jcowan>
I mean that there is no (quasi) functional constructor: you have to construct an array and then initialize it, unless it is a simple general vector, in which case you can construct and initialize it in one blow with "vector"
<jcowan>
Of course you can write such a function "array", but it doesn't come in the box
<aeth>
jackdaniel: make-array is a bit awkward and anyone who uses a special kind of array a lot has a (probably inline) helper function to save a lot of typing and potential mistakes.
<aeth>
1.5th class maybe?
<jcowan>
imagine having to construct lists not with "list" but with "make-list" and then a lot of calls on (setf car).
<jackdaniel>
I'm not saying that is a good interface or whatever, but this definition of "class" makes zero sense to me
<aeth>
also, the specific literal syntax beyond the basics isn't portable (might even just be SBCL)
Gleefre has quit [Remote host closed the connection]
<aeth>
I think a good example of "3rd class" but fully built-in would be multiple values.
<jackdaniel>
I can understand that we could say that continuations are not a first-class concept in common lisp - deven if you may emulate these with dynamic extent with catch throw
<jackdaniel>
but if you have a functionality with a clumsy interface it does not make it any less a feature of the language
<aeth>
You can't really heavily use multiple values all over your code without writing a bunch of utility macros/functions
<aeth>
and you still lack some things you might want
<aeth>
the language just gives you the ability to build a useful way to use multiple values, rather than including it
waleee has joined #commonlisp
<aeth>
and M-V-C is so awkward to use syntactically
<jackdaniel>
multiple values are another good example - if the language supports multiple returned values then it is a concept of that language, "first class" of a sort. if you must emulate that by marshalling/demarshalling lists with values then it is not
<jcowan>
jackdaniel: Well, no, ,but it means people will tend to avoid it. In Scheme there are a lot fewer prepackaged functions for (simple general) vectors than there are for lists, and so people tend to use lists because they are handier even if vectors would suit the problem better.
<jcowan>
THat's a narrower sense of "first class" in which something is first-class if it is represented as a value in the language.
<jackdaniel>
since "classes" are not a "first class concept" in the standard you are free to define them anyway you like but this way seems very peculiar to me (bordering nonsensical)
<aeth>
jackdaniel: Only in a Lisp would lack of any meaningful syntactic support at all still be considered first class, though.
<jcowan>
so multiple values are not first class in either CL or Scheme, but continuations are first class in Scheme and closures are first class in both languages
<jackdaniel>
but my wife said that I should go sleep, so I'm hurrying to wash my teeth - good night \o
<jcowan>
I'll say good night till it be morning
<aeth>
multiple values are more of a "here's this cool thing that's built-in (maybe efficiently, maybe not, since it's not a priority of the language; and it's not built into LOOP, where you'd really want them); now write an entire mini-language to make them usable"
<aeth>
good night
<jcowan>
The trouble really is that "multiply valued funcdtion" is a contradiction in terms
igemnace has quit [Remote host closed the connection]
ttree has joined #commonlisp
chowder has joined #commonlisp
waleee has quit [Ping timeout: 252 seconds]
tyson2 has joined #commonlisp
Demosthenex has joined #commonlisp
earl-ducaine has quit [Ping timeout: 260 seconds]
waleee has joined #commonlisp
Alfr has joined #commonlisp
waleee has quit [Ping timeout: 255 seconds]
pve has quit [Quit: leaving]
morganw has quit [Remote host closed the connection]
rgherdt_ has quit [Remote host closed the connection]