libera/#commonlisp - IRC Chatlog
Search
10:09:17
lisp123
2) I've been doing a thought experiment to add metadata to lists .. e.g. let "x" be of type car, then undertaking a series of transforms that maintains type, e.g. (f (g (h (i (j x))))) should have type car
10:09:59
lisp123
however its annoying to recurse down every time, so I've been modelling such data as CLOS with 2-slots - 1 the transformation (above) and 2 the type of the transformation (car)
10:10:17
lisp123
Has anyone done something similar / thought about something similar & has recommendations
10:13:40
jackdaniel
I think that "of type car" is quite ambiguous in the context of list, I had to read whole thing twice before I've realized that you mean a vehicle, not the first element of the list
10:16:54
jackdaniel
if you model a function then why not make it a funcallable (and not a standard class)?
10:18:30
jackdaniel
then you could (setf (fdefinition f) #<the-funcallable>) and (f x); what's more, (reader #'f)
10:20:05
flip214
if #'j takes a type C and F returns a type C, and the argument/return types inbetween are compatible, that's what you expect?
10:21:52
flip214
well, SBCLs type derivation has improved recently... perhaps with sb-ext:*derive-function-types* and sb-introspect:function-type you can derive the output type of that chain already
10:24:35
lisp123
Stepping back a bit, the key thing I want to hone in on is the concept of adding "metadata to lists". Lists as recursive structure provide a lot of benefits, but at the same time cannot hold as much information as other structures
10:26:09
lisp123
For example, if I look at the rope data structure, which I'm not close to at all and could be completely mistaken, it holds metadata about the underlying string by having each leaf hold a string and a length
10:29:14
lisp123
So I guess one of the questions is do people somewhat commonly look to add metadata to lists and anything of note in this topic area. It seems sensible to me to add in type information whilst constructing lists, so that later when they are reused, that information is already there
10:57:30
phantomics
Has anyone used cl-flamegraph lately? It seems its dependencies have been deprecated for a while, at least for SBCL. Trying to load it I get an error saying 'Symbol "MAP-TRACE-SAMPLES" not found in the SB-SPROF package.' and upon review I found that that symbol was removed from sb-sprof several versions of SBCL ago
11:53:52
mxben
Author of blog pretends to be someone else to promote himself: https://hn.algolia.com/?query=singaporecode%20ashok%20khanna&type=all
11:53:56
mxben
Thanks to this author (who is present in this channel too) sending personal insults to me, I am leaving IRC forever. No thanks for this disappointing experience from the author after I joined with IRC eagerness and for expressing eagerness in the author's work.
12:04:02
jackdaniel
I believe that these are two different people; but I don't care enough to pursue the topic. if the accusation of harassment is true - whomever you are please don't do that
12:05:17
lisp123
no the guy has some strange stalkerish vibes to me (found out what industry I'm in, for a newcomer, strangely focused on my name, etc.)
12:06:34
lisp123
Guess I will have to be careful nothing more comes from it. I created a few HN accounts over the years as I kept forgetting my password, and there's a tinge of self promotion, but its hardly much
12:09:25
hayley
dang's response on HN suggested you used both signaporecode and Lisp-Stat in a short period of time. And if you did forget your password in that time, it's not great to complement yourself that way (though I don't know if you did, so please don't interpret it as me saying you did).
12:10:03
lisp123
I tend to upvote all CL posts and compliment them regardless......lol at getting banned at over that
12:11:12
jackdaniel
I've talked with both Steven and lisp123 and they both give very distinct impression, that's why I've said the above
12:11:25
_death
maybe it's about your first comment.. "I should sponsor the guide's author" (where that author is yourself)
12:16:44
lisp123
well i hope that lisp-stat guy didn't get banned lol, his charts were actually quite good
12:17:55
gin
singaporecode looks fishy to me. the first few comments were complimenting this ashok guy's articles. more comments like that later too. pretending to promote your own work as someone else would be frowned upon in any community, I guess. losing passwords makes sense but losing your identity along with the password and becoming someone else to complement your own work is weird!
12:18:46
jackdaniel
I think that most people share your sentiment gin; either way let's focus on the channel topic
12:19:22
gin
lisp-stat guy seems fine. looks like dang just picked singaporecode's latest comment to warn about their past behavior. there is no direct-messaging facility on hacker news, so that must be a workaround dang chose.
12:20:03
gin
jackdaniel: oops! sorry. for a moment, i thought this was #lispcafe. but offtopic here and possibly offtopic in #lispcafe too. irc drama after a long time. my apologies
12:27:12
hayley
pjb: I'll have you know the SBCL GC is written in C, so my rambling is on-topic, thanks.
12:27:58
pjb
drakonis: writing lisp code. The more lisp code you write, the more of a lisper you are.
12:28:29
gin
i have sadly been away from Lisp for sometime, so #lispcafe is perfect for me. :D the problem is that nobody in our company works on Lisp and no new hobby projects too right now. so I don't get much of a chance to work on Lisp.
12:28:38
pjb
There's an alternate path, which is writing lisp implementation (any language goes), but if you don't write some lisp code, you may still be a stranger.
12:29:13
pjb
gin: one trick is to use emacs, and write some personnal extensions in emacs lisp code.
12:30:21
gin
I use emacs. which lisper does not. i should get into the habit of writing my own extensions. great idea that is.
12:31:10
pjb
gin: sometimes, you can write a lot of (emacs) lisp code on the job, eg. if you generate code for your job project from emacs lisp.
12:31:56
White_Flame
eg, if starting with a car (vehicular), concatenate them into a train etc would be possible
12:33:00
White_Flame
but still the type of annotation in his idea seems affixed to values in the same way that units libraries affix their unit
12:33:28
_death
personally I associated it with the Layered Data chapter in Software Design for Flexibility
12:38:39
pjb
Just define a class for magnitudes with units and define arithmetic operators on them. Have a look at this example (for monetary amounts in a given currency, but it's the same principle): https://gitlab.com/com-informatimago/com-informatimago/-/blob/master/common-lisp/invoice/invoice.lisp#L177
12:52:18
lisp123
Is there a way to specialise a defgeneric, similar to the following: (defgeneric (item1 item2)) then defmethod where item1 and item2 are of the same class?
12:52:55
pjb
lisp123: indeed, each operation checks the units of the arguments for consistency, and compute the unit of the result and the magnitude of the result.
12:56:33
pve
Hi, in playing around some more with my compute-with-arrows macro, I decided to add operations for accessing properties of objects.
12:56:54
pve
One operation uses the "of" symbol which allows for typing .. name of person <- "Peter" ...
12:57:14
pve
The other operation uses the form "'s", which allows for typing .. person's name <- "Peter" ...
12:57:51
pve
However, it occurs to me that forms inside the "compute" forms might also use the "of" symbol.
13:01:01
pjb
pve: otherwise, you can use a macrolet: (compute-with-arrows (loop for person in persons collect (with-arrows name of person)))
13:02:17
pve
but I was thinking of the case (compute ... (loop for x being each hash-key of my-table ...))
13:06:12
pve
The new stuff is after the line ';; Accessing using "of"' in case anyone wants to have look :)
13:08:26
pve
_death: sure, I can't bind the "keywords" inside the compute form. I use M-x highlight-regexp to remind myself of this.
13:12:06
pjb
just see: (macroexpand '(loop with of = (make-hash-table) for of being each hash-key of of collect of))
13:15:18
pve
pjb: my macro will look for binop patterns like "a op b", so in the case of loop I should be alright?
14:15:15
pve
Actually, since the forms can macroexpand into basically anything, doesn't it make sense to *not* macroexpand, so the programmer (i.e. me) can visually inspect the code for potential interference with other macros?
14:37:46
pjb
pve: if you use a macrolet, then you can avoid macroexpanding, and only process "toplevel" forms.
14:41:51
pjb
pve: something like: https://termbin.com/uqz9 ; you can explicitely pass the env when the defmacro augments the environment (if you need to pass data from with-foo to foo, you can do it thru the environment by declaring local macros, or local symbol-macros.
19:18:34
dbotton
If I am passed a function is there a way to determine the number of parameters needed to call that function?
19:21:13
pjb
dbotton: function-lambda-expression, but it may return nil, so nothing standard. Look in swank for implementation specific functions and portability layer.
19:21:41
edgar-rft
dbotton: you an try to analyze the return value of FUNCTION-LAMBDA-EXPRESSION but it's allowed to return NIL
19:23:43
yitzi
dbotton: https://github.com/yitzchak/common-lisp-jupyter/blob/master/src/cl-jupyter/utils.lisp#L7-L20
19:24:00
pjb
(swank:operator-arglist "OPERATOR-ARGLIST" "SWANK") #| --> "(OPERATOR-ARGLIST name package)" |#
19:41:30
yitzi
Why would you not just parse the lambda list? There are plenty of lambda list parsers out there.