freenode/lisp - IRC Chatlog
Search
15:12:47
ptdel
hey guys, I'm just getting into CL, coming from Python. I had a question that might just be a matter of preference. In Python I typically try to make things classes and put all the stuff i work with into those classes to be operated on by class methods. Should I still be trying to use the CLOS with all of my data (say classes that represent JSON objects) to make classes and methods to accomplish things, or
15:12:53
ptdel
should i change my thinking to be centered around getting things done with top-level functions?
15:14:59
ptdel
right now sort of teaching myself by making an api wrapper that signs and sends json over http.
15:15:33
ptdel
I think I've been approaching classes the wrong way, making a defclass and defmethod for each one
15:16:25
beach
You can create a function for constructing a class instance, but it is more common to use MAKE-INSTANCE directly.
15:16:30
Shinmera
ptdel: If you want to look at API wrappers, there's already a bunch out there that can give you an idea on how to go about it.
15:17:00
ptdel
Shinmera: I am looking at turtl and something called cl-amazonproduct which are two CL api's for AWS services. they have been really helpful
15:17:18
beach
ptdel: Think of a class (as viewed by client code) as something abstract that takes a bunch of :INITARGs to create.
15:18:03
Shinmera
ptdel: What I do is map each API endpoint to a function that returns an instance of a class that represents the output of the API call.
15:18:33
Shinmera
I then add generic functions that you can use with these classes to perform the operations the API provides in a more comfortable manner.
15:19:18
ptdel
ah ok, that is sort of what i am trying to do i think. i have some functions for formatting request data and urlencoding things, and then i have classes representing that API calls and their parameters that can be made
15:19:34
ptdel
but i am just making escaped json from the classes right away and passing them to the functions
15:21:12
Shinmera
ptdel: Another approach is to have "raw" API mappers that simply return parsed JSON, and a separate high-level interface that operates on the API with CLOS.
15:21:32
Shinmera
ptdel: That's what I did in Humbler, for example. https://github.com/Shinmera/humbler
15:23:40
Shinmera
ptdel: An example of the former strategy is Chirp https://github.com/Shinmera/chirp
15:25:50
ptdel
that is totally fine. I've done lots of C and Python, so I can pick up most advanced concepts just getting used to the non-algol look of things
15:26:13
ptdel
didn't want to start with things like syntactic sugar, wanted to start with things like asdf and the lisp ecosystem :)
15:27:16
Shinmera
Been a while since I wrote that stuff (2014, jeez) so it'll take me a bit to get back into it, though.
15:30:09
Shinmera
Encouraging comments. :/ https://github.com/Shinmera/humbler/blob/master/deferring.lisp#L28
17:12:13
slark
Bike: he used a crazy example i cant undestand at all something like (defun (setf f) (param) body)
17:13:45
Shinmera
The latter having the effect that if you then use (setf (name ..) bla) it'll invoke that function with bla and .. as arguments.
17:40:24
Grue`
what could that mean? "fatal error encountered in SBCL pid 24554(tid 0x7fffe7daf700): blockables unblocked" happens when calling GraphicsMagick's MagickReadImage through CFFI
17:43:09
Fare
Alastair Bridgewater had some hints on how to fix SBCL signal handling so you can dynamically modify it, but he never implemented it nor did anyone else
17:43:36
Shinmera
Recompiling magick without the signal handlers would probably be easier and work better.
17:44:20
Shinmera
Fare: Sure. I just don't think it's a feasible approach for Grue` at the moment :)
20:39:44
Ainieco
is there a modern replacement for asdf? manually specifiying file dependencies seems a bit odd in 2017
20:42:51
Ainieco
Bike: well, it would be nice for it to autodiscover file dependencies in my project and resolve them automatically, it's a common practice
20:43:51
Shinmera
There's "package inferred systems" if you force yourself to use one package for each file.
20:45:06
Shinmera
Bike: well, each C file is usually already its own compilation unit, so all that's left to figure out is if headers have changed.
20:45:14
Ainieco
Shinmera: yeah, i'm willing to force myself to use one pkg for each file, what are those systems? (:use my-pkg) seems quite explicit
21:44:33
slark
hello, how would you write http://paste.lisp.org/display/351603 without the backquote expression ?
21:45:09
slark
i know it should start as (list 'if (list 'progn ..... not sure for the rest of the expression
21:51:10
slark
what is the way to splice a list ((1 2) (3 4) (5 6)) into successive (1 2) (3 4) (5 6) for feeding progn with these sucessive list ?
21:54:54
White_Flame
oh, if you're talking about a macro body, then mapcar is probably what you mean.
21:55:20
pjb
minion: memo for Ainieco: I have a older replacement for asdf that computes the dependencies automatically, in com.informatimago.tools.make-depends
21:55:45
White_Flame
`(if ,condition (progn ,@(mapcar (lambda (pair) `(do-something ,pair)) '((1 2) (3 4) (5 6)))))
21:56:22
White_Flame
would expand to (if <condition) (progn (do-something (1 2)) (do-something (3 4)) (do-something (5 6))))
21:57:41
White_Flame
mapcar just transforms a list of inputs to a list of outputs, calling a function on each
23:38:47
z3t0
I have a site in jekyll, which I have been planning to change for a while to something else and since I'm learning lisp I thought why not
1:34:52
z3t0
A lot of ready made solutions available on other platforms such as hugo/jekyll just don't exist because there isnt really a community around coleslaw
2:03:00
quad__
can ADJUST-ARRAY from a vector to another one of larger length ever re-use storage in SBCL?
2:12:19
quad__
also, advertisement, if you're interested in some remote lisp dev contracting work (<= 1 month; possible repeats), shoot me a message