libera/#commonlisp - IRC Chatlog
Search
19:36:08
Bike
well, if you make the apl file part of the system, you could just use the asd system reload function and get both the apl and the lisp reloaded.
19:38:59
Bike
https://common-lisp.net/project/cffi/manual/html_node/Groveller-ASDF-Integration.html here's what it looks like for grovel files
19:39:24
Bike
the definitions to make it work are here https://github.com/cffi/cffi/blob/master/grovel/asdf.lisp
19:40:39
Bike
phantomics or someone might be interested in doing the work, since it seems like a useful way to use april
19:45:10
CptKirk
Then I could specify the files, their workspaces, and have all those names aviailable on load
19:46:53
CptKirk
then the solutions would just be like... `(defsol ws.day1)` which would be a macro to call the function day1 in workspace ws using april
19:49:42
CptKirk
how does that file get loaded and definitions available before asdf finishes loading?
19:50:44
Bike
it tells asdf to load the cffi-grovel system before even starting to deal with the example-software system definition
19:55:56
Bike
:defsystem-depends-on ("cffi-grovel") tells asdf to find and load the system named cffi-grovel
19:56:43
Bike
usually packages have about the same names as the system defining them, but that's not required and asdf doesn't care either way
19:57:48
phantomics
Just read the chat here, getting asdf integration for April is something I'll look into
20:17:58
CptKirk
@bike it appears that this works because the output of the files in question are lisp source files
20:18:44
Bike
isn't it? i thought it was an apl-to-lisp compiler. but even if it isn't, i think you can tell asdf to do arbitrary things to "load" a file
20:21:58
Bike
i see asdf itself defines a java-source-file component type, though it doesn't seem to do much
20:38:04
phantomics
Bike: April doesn't produce Lisp files, it directly compiles and evals code. Do you know if asdf extensions can be used to do things that compile Lisp code directly rather than producing Lisp code that is fed to asdf?
20:38:34
Bike
I am reasonably sure that you can tell asdf to do literally anything in as a "load" action.
20:39:20
Bike
so you could for example just have it call this april-load function kirk is using, probably
20:41:57
Bike
https://common-lisp.net/project/asdf/asdf.html#Creating-new-operations i think what you would do is something like (defmethod perform ((op load-op) (component april-file)) ...)
20:58:57
CptKirk
ok I'm getting super peeved. I just created a blank quickpackage:make-package and it can't compile
20:59:56
CptKirk
`(quickproject:make-project #P"/mnt/c/d/aoc/cl" :name "apl-load" :depends-on '(april))
21:00:26
CptKirk
so I made the project, I symlinked to the local-projects folder just as I did before
21:09:31
etimmons
Hmmm, there goes that idea. But I'm surprised ASDF isn't giving you any other information than what you've copied
21:16:05
CptKirk
nice, I got the pattern working for creating a new component and then doing stuff with it
21:49:16
CptKirk
https://common-lisp.net/project/cl-mathstats/documentation/asdf-package/generic-efunction-perform.html
22:01:17
Bike
CptKirk: #1=aoc-15 ... #1# means that the #1# is also aoc-15. like #<ASDF/USER::APRIL-FILE aoc-15 "15.apl">
22:02:27
Bike
what this error means is that asdf expects something to be either a string, a pathname, or a file stream, but you gave it an april-file object instead
22:04:52
CptKirk
https://common-lisp.net/project/cl-mathstats/documentation/asdf-package/class-source--file.html
22:05:24
Bike
okay. so look at this page here. See how, next to name, it says "Accessors: component-name"
22:17:08
CptKirk
I don't know how you're supposed to just know HOW to use something from someone giving you a picture of it
1:15:37
raeda
Is github.com/symbolics on here? I'm doing some statistics work and think Lisp-Stat would be a great way to consolidate existing stats code, but registering a new company with the name Symbolics and requiring a contributor license agreement are worrying signs
1:23:42
hayley
IIRC using the GitHub name Symbolics doesn't really mean you are founding Symbolics 2 (for that see ##symbolics2)
1:26:32
moon-child
they also opened a PR to some random github project purporting to make it work on genera
1:28:09
raeda
I'm sure there aren't any legal problems, it's just weird to see someone setup an account / company with a well known name and then require that open source contributors sign an agreement
1:28:34
raeda
You know, instead of just licensing the project under MIT / BSD / GPL and being done with it
3:05:21
CptKirk
in a macro, how do I define a name which is defined in the macro, but available to users of the macro?
3:06:51
CptKirk
(defmacro my-mac (thing1 thing2 &rest body) `(let ((',@#":available-name ,@body)) ...)
3:06:53
beach
You can introduce any symbol in a macro and it can be used by the caller of the macro. But it is best to avoid that and instead have the caller put a symbol in there, as in WITH-OPEN-FILE for instance.
3:12:16
Bike
this is unrelated, but i wanted to ask before: why (eval '(april:april-load #p"./15.apl")) instead of just (april:april-load #p"./15.apl")
3:13:01
CptKirk
and during development to save double the amount of effort, it is evaluated every time I call into the expression rather than only once at the beginning
3:39:55
Bike
well, for a start you probably want (progn ,@parser), then, because IF doesn't take an indefinitely long sequence of forms
3:42:47
Bike
In the macroexpander you bind the VALUE variable to (if (null parser) sym parser). So if parser is nil, obviously VALUE will be SYM.
3:43:58
Bike
please do multiline pastes in pastebin or something, by the way. i know it's going a bit out of your way, but it clogs up the irc
3:45:07
beach
Yes, I don't think this is the right way to learn a language, but then, learning Common Lisp may not be a goal for CptKirk.
3:46:19
CptKirk
I should clarify, my first exposure to common lisp was 5 years ago now. I've been through a laundry list of books
3:46:46
CptKirk
But all of my time with Common Lisp has been toy problems all done in the repl, using only basic list structures
3:47:30
CptKirk
I'm not claiming expertise or experience, but I wouldn't say I'm starting from the beginning
3:47:53
CptKirk
@beach I know there are a lot of features, but I never did bother with asdf, or importing libraries until this week :/
3:49:19
Bike
i don't mean to sound like an elitist, but repl exercises don't really compare to actually writing programs. I mean, I could probably take a few minutes and write matrix multiplication or something in APL, but i'd hardly say I know it
3:50:05
CptKirk
my use case can maybe elucidate further. I'm professional applicaiton developer in C#/python/angular/react/node with loads of backend tools etc. I was a full time APLer for 2 years, and now host a discord for all array languages. The issue for me is that all the existing FOSS array languages are limited in their library vocabulary, and seeing the
3:50:05
CptKirk
relative maturity of april and the library list of Common Lisp, I'm thinking it would be good to have CL as the driver that talks to the outside world, ffi, libraries, rest, sockets, etc, and APL can do all the pretty logical stuff
3:51:01
CptKirk
which is a very similar pattern to the unix design pattern, using lisp to orchestrate c libraries
3:52:42
CptKirk
from where I'm sitting, I'm not going to learn much more about modern CL reading the classic books. I've learned academic CL, but I have never had an application to build with it, so its all been relatively novice level activities
3:58:23
beach
I really should start my page about Common Lisp book reviews, but I am too busy with other stuff at the moment.
4:03:48
CptKirk
PAIP is much more profesionally written, though the density took me a while to get throught it
4:04:50
dualinverter[m]
I started with Land of Lisp because I had a copy of it lying around; it was a fun read until actual lisp learning started. After a couple of chapters, I found it disorienting.
4:52:23
dieggsy
is there some kind of compilation reader macro shorthand in the style of #+ for if a symbol is unbound
5:23:16
beach
I think what we need is a Common Lisp reference, probably in the form of a web site. I think this could be done by starting with the dpANS and adding more material.
5:28:05
beach
No, that's not good enough. It is a document primarily meant for creators of Common Lisp implementations.
5:29:06
beach
Yes, I saw that. We also have the fantastic work by scymtym to parse the dpANS into various formats.
5:29:22
moon-child
eh, I have no intention of creating a common lisp implementation, and I have always found it adequate. It could perhaps be made more approachable in some respects, but not majorly so
5:30:03
beach
moon-child: OK, example: Read the page on AREF and tell me what happens if you give it an object that is not an array.
5:31:50
specbot
The ``Arguments and Values'' Section of a Dictionary Entry: http://www.lispworks.com/reference/HyperSpec/Body/01_ddc.htm
5:32:27
beach
moon-child: Most newbies, and many experienced Common Lisp programmers don't know that. For example, jmercouris was convinced that an error would be signaled.
6:17:29
moon-child
as far as I know, there is no semantic difference between the way parameters are passed in elisp and cl. This snippet has the same behaviour in both, for instance https://0x0.st/-3ZM.txt
6:55:35
phantomics
Hey moon-child, I figured out what was wrong with {⍵{2÷⍨⍵+⍺÷⍵}⍣≡⍵}12345678 in April
6:56:42
phantomics
Because the 2 is handled as a rational number, the numerator and denominator get huge and the comparison tolerance doesn't work. A consequence of supporting ratios in April
6:58:50
pjb
emacs lisp passes parameters exactly like any other lisp, by value ! Always. CL passes parameters by value too.
6:58:53
moon-child
in raku, rational numbers will get automatically promoted to floats once the numerator/denominator exceed some threshold, unless you explicitly request otherwise. Such behaviour might be worth considering
7:00:20
moon-child
(perhaps the threshold might be when the denominator exceeds ÷⎕ct. That way rational comparisons can always be exact, with no semantic drawbacks)
7:01:32
moon-child
(rather than 'with no semantic drawbacks', I should say 'in a semantically consistent manner'. Except that that is not right...)
7:01:42
beach
moon-child: Also, the "Examples" section of many Common Lisp HyperSpec dictionary entries contains non-conforming code. For a creator of a Common Lisp implementation, it is known that these sections are not normative, but it is embarrassing that newbies are given such examples.
7:05:11
moon-child
beach: fair enough. What you point out about type mismatches I think is the sort of minor augmentation I mentioned would be helpful but not essential. In that it still describes correct usage of the function. But the non-conforming examples are more egregious (and identifying them is far harder to automate!)
7:07:07
beach
Sure, nothing is essential, but I think we can do much better than the Common Lisp HyperSpec in a reference document. For the AREF case, I could see the phrase "If an argument of a type other than an array is given, then the consequences are undefined" explicitly inserted.
7:07:31
beach
And when there is a phrase such as "an error should be signaled", at least making that phrase a link to the meaning of the phrase would be useful.
7:09:08
beach
lisp123: If you read the link you were give, you will see that Common Lisp, just like most modern languages (Haskell excluded) use call by value.
7:10:18
lisp123
beach: the tricky part is this "So, although values are copied before passed to the function, what is copied here is a reference."
7:11:23
beach
lisp123: Call by value just means that arguments are evaluated before a function is called. Nothing else. It says nothing about the nature of those arguments.
7:12:09
moon-child
wiki says 'if [a parameter] is used several times, it is re-evaluated each time it appears'
7:12:13
beach
I am sorry if the C++ people attempt to change established terminology, and I won't grant them that pleasure.
7:12:13
Nilby
The CL spec examples reinforce my belief in thinking for yourself and being skeptical of authority.
7:13:06
hayley
Well, given that evaluation of Haskell code is more or less deterministic, I think avoiding re-evaluation would be an optimization.
7:13:10
beach
lisp123: Again, "pass by value" = "call by value" means that they are evaluated before passed. Nothing else.
7:14:20
beach
lisp123: In all modern languages, when call-by-value is used, a copy of the value is passed, no matter the nature of that value. In certain languages, like C++ and Pascal, and Algol, you can change that by &name, var name, etc.
7:15:42
beach
lisp123: In early implementations of Fortran, this was not the case, so you could say f(1) and f could be defined with parameter x and then x = 2 in the body, and then subsequently, references to 1 would be 2.
7:17:06
lisp123
That link also is very helpful, with a bit more time I should be able to internalise the concepts
7:19:12
moon-child
hayley: no, because if you never evaluate an effectful form, the effect will not happen. For instance, this snippet prints nothing http://ix.io/3z7s
7:20:24
beach
hayley: Call by name, as I recall, is so weird that it was never implemented even in Algol.
7:20:44
hayley
Evaluating an effectful form in Haskell does not cause effects; the effect only occurs if it appears in the value bound to main in Haskell.