freenode/#lisp - IRC Chatlog
Search
21:30:34
_death
so I feel that Gray streams is not part of CL is a good thing, and that also touches on arguments for further standardization...
21:31:00
pjb
Oops, yes, thereis works: (loop thereis (let ((x (random 10))) (if (evenp x) nil x))) #| --> 1 |#
21:31:09
specbot
Termination Test Clauses: http://www.lispworks.com/reference/HyperSpec/Body/06_ad.htm
21:31:25
pjb
I tried it on a boolean, so I thought it only returned nil or t, but it returns the value.
21:33:55
jmercouris
if there is no value, there is no value, I am no magician, I can't fix everything wrong with this database
21:34:45
flip214
jmercouris: why not (OR value (format nil "~36r" (RANDOM (expt 36 10))) to get around that?
21:37:15
jmercouris
and my goodness woocommerce, stores orders as, let me blow your mind, wordpress posts
21:37:34
jmercouris
how do you know the information about the order? obviously that would be in the wordpress post meta table
21:39:02
fiddlerwoaroof
well, the problem with a lot of these things is that the underlying platform isn't an ecommerce platform
21:39:29
fiddlerwoaroof
so the extensions just shoehorn their stuff into the existing data structures.
21:39:57
jmercouris
They have more than enough money to do a clean rewrite and migration for woocommerce..
21:40:50
fiddlerwoaroof
Woocommerce doesn't provide some sort of XML "export all information" functionality?
21:42:12
jmercouris
I'm too deep into this though, and I need stripe data to perform a smooth transition anyway
22:01:52
dxtr
I thought about it multiple times but I figured it simply wasn't worth it. So much stuff that has to be done and has to be done right (e.g. the ability to customize the tax rules in every way imaginable for every jurisdiction and situation)
22:02:24
fiddlerwoaroof
dxtr: yeah, I also worked with Sylius (avoiding Magento) and that was a different sort of nightmare
22:02:29
jmercouris
I am not looking to usurp these platforms, I was thinking about writing a *very simple* ecommerce system
22:03:15
fiddlerwoaroof
I thought about that too, but there are a number of hard-ish boring problems any ecommerce system has to solve
0:06:28
fiddlerwoaroof
comborico1611: I'm not sure I understand the question, it's just a normal function
0:10:00
comborico1611
I figured it didn't need to be defined. I imagined that somehow the stucture would get tagged onto the OP part of op-add-list
0:12:44
fiddlerwoaroof
something like (defstruct op add-list) should give you the function you want implicitly
0:14:06
comborico1611
Hmm. I'm not sure how that works, but I figured that was what was going on. (It's not my code.)
0:14:36
fiddlerwoaroof
the way a defstruct works is that the struct name gets combined with the slot name, separated by a hyphen
0:16:05
comborico1611
How does Lisp know that the OP in op-add-list is to be swapped with OP in lambda list?
0:18:20
comborico1611
I can't think of another way to rephrase it. But at least now I know that the code is correct, that it should be an implicit thing.
0:19:11
fiddlerwoaroof
It would probably be helpful to provide more context, it's hard for me to tell what the problem is and how those two bits of code are related
0:20:05
fiddlerwoaroof
However, without some additional definition like (defun op-add-list (thing) (action-container-add-list thing)), the two snippets of code won't work together.
0:22:50
comborico1611
I see! Yes, that is what I thought. But this code comes from a book. https://pastebin.com/eLkMf1an
0:43:04
edgar-rft
comborico1611: 1) there are a megaton of typos in that file, looks like machine-scanned code with no human error correction 2) the function FIND-ALL is nowhere defined in that file
0:48:19
edgar-rft
comborico1611: It looks like code from Norvig's "Paradigms of Artificial Intelligence Programming". But I can't even compile the code without the missing definition of FIND-ALL.
0:56:57
edgar-rft
comborico1611: this version works for me <https://pastebin.com/iWfbYf7a>, the only real problem were the huge number of typos
0:57:50
comborico1611
Haha! Hey! Thanks for letting me know it works. I now have encouragement to continue trying to figure out teh problem. Thanks.
1:01:09
edgar-rft
comborico1611: PAIP is not an "easy" book but you can really learn a lot out of it :-)
1:02:44
edgar-rft
looks like a special version of IF that was written by somebody else (not contained in the standard)
1:11:03
pjb
It's easy, it presents a nice and rather complete tutorial of CL, it presents famous algorithms in a very clear and modern way.
1:14:44
edgar-rft
pjb wanted to say that PAIP is also an introduction to CL, but for much more advanced programmers, so it always depends on what you expect :-)
2:44:08
fiddlerwoaroof
minion: memo for asarch: EQ checks whether two things are the same object, not whether their values are equal. For strings, your choices are STRING= (possibly faster, but less generic) or EQUAL (possibly slower, but more generic)
3:30:54
edgar-rft
p0a: Practial Common Lisp is available online for free: <http://www.gigamonkeys.com/book/>
4:30:30
fiddlerwoaroof
hmm, maybe I don't understand your question, there is a pathname component that is the version to be opened
4:33:22
fiddlerwoaroof
You might also be able to find some information in the Symbolics user manuals about how versioning worked on the lisp machines
5:01:56
fiddlerwoaroof
The "normal" string representation of a pathname puts version last, I'm not sure how much that depends on the standard
5:02:33
fiddlerwoaroof
that is, I'm not sure if the standard specifies any particular format for the string representation of a pathname
5:59:54
asarch
I have this source code (the first part) and when I evaluate it I get (the second part): http://paste.scsys.co.uk/583325
5:59:54
minion
asarch, memo from fiddlerwoaroof: EQ checks whether two things are the same object, not whether their values are equal. For strings, your choices are STRING= (possibly faster, but less generic) or EQUAL (possibly slower, but more generic)
6:15:08
no-defun-allowed
asarch: (declare (ignore ent)) is how you tell the Lisp compiler you won't use a variable
6:46:32
asarch
One stupid question: how do you measure the speed of a program in Common Lisp? I mean, whether you decide to use (defun ...) or (defmacro ...) for your operations?
7:00:24
Ukari
is it possible to rename a symbol by import-from like this, https://plaster.tymoon.eu/view/1229?
7:21:06
Ukari
I create a method named '(defmethod of (&rest rest))' in a package and want to export it, it's name is short and can't dispatch between the same name functions
7:22:32
Ukari
I won't care about the method (defmethod from ((seq sequence))), because if there is a same named method (defmethod from ((list list))), confilt won't happens because it could be dispatched
7:27:09
beach
The word "dispatch" means choosing between several methods of a generic function, based on the arguments passed to that generic function.
7:27:10
Ukari
If I could rename a symbol when import it, the code will be shorter instead of package-foo:conflict-name
8:22:21
bonz060
I joined this channel to try to see what all the fuss about lisp is. My boss went on this tirade on how lisp and design thinking go hand in hand. I don't quite understand this yet but I'm willing to give it a shot. Totally noob question(which I'm sure has been asked a bunch of times), but why lisp? Even though it's not imo used in alot of places?
8:24:51
emaczen
bonz060: It is a programmable programming language, the minimal syntax of lisp is a tree which you can easily manipulate using the same code you write your programs with.
8:28:24
bonz060
Grue`: Right now I use Python heavily at work. For exploratory things, I've been hacking around Haskell.
8:30:04
Grue`
well if you like messing around in ipython but hate pasting code into it and restarting it all the time then lisp is for you
8:33:10
buffergn0me
There is a lot of very well thought out stuff in Lisp. Macros are great, but even without them it's great
8:34:03
bonz060
buffergn0me: I'm looking into lisp because I've learnt so much from me boss. Dude showed me some literate programming workflow in org-mod and that has been such a helpful thing to how I write software. I'm currently going through http://www.gigamonkeys.com/book/
8:38:13
buffergn0me
One thing that is very different between Lisp and Python and Haskell, that I think is a great advantage, is how easy code editing and refactoring is with a fully delimited syntax
8:38:30
MichaelRaskin
If you want to have a bridge between your Python experience and Lisp concepts, you could start with Julia — it wants to compete with SciPy and MATLAB, but it also borrows a lot from Common Lisp, although changing some details to fit their vision
8:39:39
MichaelRaskin
Lisp syntax is not always and fully simple, but indeed most of the time it is.
8:42:21
buffergn0me
That is an advantage as well - that it is almost always (OPERATOR <maybe-binding-forms> <other forms>), which makes things easy to remember and look up, but what I mean is because everything is like that, and everything is an expression, moving code around is just a few keystrokes and just works
8:44:52
bonz060
MichaelRaskin: I don't think I want a bridge right now. Julia seems to be a language used for data science stuff. Right, I want to commit m'self to learning languages that will have some impact on how I think about "design", not the language implementation "features". That's what I like about Haskell. It forced me to learn some type theory and how type safety can save tonnes of debugging time. That plus I damn right
8:48:28
buffergn0me
Grue`: Weird, nothing comes up on CLiki. I wrote https://oneofus.la/code/radix-tree.lisp a while ago, I don't think it's very good though
8:49:10
MichaelRaskin
Julia is a reasonable purpose language that happens to use Data science as a marketing direction.
8:51:08
MichaelRaskin
With Lisp the problem is that it supports so many paradigms it doesn't really make you change your thinking (but provides a good test polygon if you want to try out some ideas — which are likely already usable there)
8:52:37
buffergn0me
IDK, there is a lot of stuff possible in Common Lisp that definitely changed my thinking, and some of it is still completely unique
8:53:51
buffergn0me
WRT design, Paul Graham's On Lisp and Doug Hoyte's Let Over Lambda are pretty unique when it comes to DSL design
8:54:48
buffergn0me
I do some Common Lisp contracting (last contract was some work for a client with an existing installation last fall)
8:55:47
buffergn0me
I started out my career doing Common Lisp and it made it very easy to get places early on
8:56:57
buffergn0me
You get to learn a ton and it definitely does help design thinking WRT to showing you what is possible
8:59:55
buffergn0me
Learning CLOS is definitely worth it, if for no other reason than it shows you that OO is not BS and that you can avoid the Java pattern-swamp over-architected garbage
9:03:53
bonz060
Why is OO not BS? Can you articulate it further? I've come to appreciate FP and building programs by composing functions(which I know is also possible in lisp since functions are first class citizens)
9:04:33
no-defun-allowed
I've heard it's much more pleasent when you abstract well, and it seems CLOS and Smalltalk encourage that better than most "object-oriented" languages.
9:06:05
bonz060
Tbh, I've never really got the whole premise of OO. It appears that patterns were a way of working around the mess that's created by some OO code that people wrote over the years.
9:06:23
no-defun-allowed
buffergn0me: Alan Kay disowned C++ (and probably Java in meaning?), so it's cool to say they're not OOP.
9:06:59
buffergn0me
Message passing is equivalent to function calls. That's how Scheme got started (it was supposed to be an implementation of the Actors model, now popularized by Erlang)
9:07:13
MichaelRaskin
Patterns are when you cannot express a control structure in code (because the language is too limited, so you write a book about it instead)
9:07:24
beach
bonz060: I think it is a mistake to learn Common Lisp in order to use it as a functional language.
9:07:44
bonz060
I've come to learn not to use niche concepts when writing code for maintainability's sake. In other words, writing really dumb code that other hoomans can read and understand. Java can make it hard to do that... especially when pattern-gallore is at play.
9:10:26
no-defun-allowed
Well, frankly beach opened me up to CLOS, since the other "OOP" languages I had worked with were boilerplate hell and I expected CLOS to be the same.
9:10:28
buffergn0me
CLOS basically generalizes message dispatch into pattern matching on types, which if you know Haskell, you realize makes a lot of things very easy
9:10:34
beach
Because you are then going to miss out on the power of generic functions in Common Lisp.
9:11:58
bonz060
beach: I guess that's why I'm here. To figure out what pitfalls to avoid :) What are generic functions?
9:12:05
buffergn0me
Also all the great low-level stuff like gotos, bit-banging, SHIFTF/ROTATEF, and all of the adjustable/displaceable array stuff
9:12:27
no-defun-allowed
(Haskell has a weak form of generic functions, called "typeclasses", but they are second-class to my knowledge. One cannot make a list of values that implement `show`, for example.)
9:12:59
no-defun-allowed
Generic functions are functions that act differently when given different types (or in some cases, values), basically.
9:13:44
beach
no-defun-allowed: It is important that the different methods are not required to be physically all in the same place.
9:15:54
no-defun-allowed
This means a programmer can create a method for a generic function after the class has been created, and also even after the generic function has been created.
9:17:11
no-defun-allowed
For example, you might wish to create a method for PRINT-OBJECT for an inbuilt type such as HASH-TABLE. In other OOP languages, that wouldn't be possible as you didn't create the HASH-TABLE class.
9:17:46
bonz060
Since lisp is so interactive, is unit testing easy to do? I met a lisper yesterday and he frankly admitted ho doesn't unit test cause he does not need to. There was some cognitive dissonance there for me in m'head. What are your take on this?
9:18:05
no-defun-allowed
(Excuse me for a moment, though, can one portably redefine a method like that? I'm not so sure really.)
9:18:33
buffergn0me
no-defun-allowed: That's a great point. It also makes it explicit that the meaning of a "message" depends on not just the type of object that it is sent to, but the types of the objects that make up the message.
9:18:36
no-defun-allowed
I unit test, but I only do it after I'm reasonably sure my program is correct. While I'm developing, I test it a lot in a REPL.
9:19:43
no-defun-allowed
Another excellent freedom that kind of method definition gives you is that methods can dispatch on any combination of types of inputs, and even some object identities can be tested on.
9:19:46
buffergn0me
Another place where the uniformity of syntax is a great advantage. You can easily copy-paste code from the REPL into a file of tests
9:20:23
no-defun-allowed
For example, a cheeky programmer might define a factorial function as (progn (defmethod factorial ((x (eql 0))) 1) (defmethod factorial ((x unsigned-byte)) (* x (factorial (1- x)))))
9:23:36
buffergn0me
And these generic functions also make unit testing easier because they make mocking easier
9:24:05
buffergn0me
There are a lot less chains of unneeded dependencies between objects in CLOS code
9:25:50
emaczen
bonz060: CLOS is itself defined as an OOP so you can even override the methods that define standard CLOS and have customoized object systems