freenode/#lisp - IRC Chatlog
Search
5:38:39
gilberth
As in: I have a double --- that are 64 bits --- here and there is the exponent and there is the sign?
5:43:59
gilberth
And then the IEEE format is nuts anyway, I hope we replace it by something more reasonable.
5:48:31
PuercoPope
gilberth: yeah, like single-float had only one representation. But if it is like chars, it is a good idea to not leak the concrete encoding into the rest of the language
5:49:40
gilberth
PuercoPope: Correct. That way to extend the character datatype to 29-bit code points didn't hurt.
5:51:48
gilberth
So, when we make contact to aliens, which have their own 40-bit character set, we could easily extend the character data type with no damage done. :-)
5:54:08
gilberth
Actually I love that. We run code, which is 30 years old or older. And it'll still run in 30 years.
6:00:03
PuercoPope
One problem with old code is loading it. Not all old code used mkdefsystem which translates more or less to ASDF. For example loading op5 in SBCL is not straighforward. But I agree its nice for code not to bitrot
6:01:31
gilberth
Well, that is loading "only". Look at CXML for example. I started to write that some 20 years ago and people still use that. Though I have no idea who maintains it right now.
6:05:59
gilberth
There is still older code out there. I still use lalr.lisp from 1988, initially written by Mark Johnson.
6:07:37
gilberth
Point is: I love that Common Lisp is machine independent. In C an "int" is something different everywhere.
6:10:39
gilberth
That once was a straight 72 hour session to convert from some strange typesetting system to SGML and generating HTML.
6:13:50
PuercoPope
I haven't bothered to learn texinfo and now that you can generate info manuals from Org mode I don't think I'll ever will. Its a pitty because modern documentation tools pays little attention to things like indexes
6:16:36
PuercoPope
It helps w/ autocomplete at the very least. But having indexes is a prerequiste to having proper search
6:17:56
gilberth
What I find more important is the term/concept idea. We have that in the CLIM spec. It says, say, "The argument x must be a foo."
10:01:26
feynhat
I am trying to use this library called "kenzo", which I have installed via quicklisp.
10:03:10
White_Flame
in the SLIME repl, kenzo:<TAB> to see what autocompletes is a good starting point to read
10:10:39
feynhat
phoe, was it really necessary though? I am sure people who are familiar with lisp would have figured this out quickly.
10:39:24
MichaelRaskin
The expectation is that either you defvar/defparameter the variable in advance, or create a local binding with let
11:03:43
jackdaniel
but if we assume that we ask about "potential" function, then question is meaningless
11:04:48
jackdaniel
asdf_asdf_asdf: defvar may be put as part of function body, but it is rarely what you want
11:05:27
jackdaniel
so if you use this variable elsewhere, then compilation will either fail or warn you about undefined symbol usage
11:07:55
jackdaniel
I think that you would benefit from reading some introductory material for programming (and if you have some experience, reading practical common lisp obok)
11:08:01
minion
asdf_asdf_asdf: please see pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
11:22:03
Grue`
minion: memo for didi: you can avoid that with (funcall 'square ,y) because then you're only calling standard functions which cannot be redefined with flet, and 'square takes the global definition of square
14:47:07
dtw
dlowe: Here is my own quick hack that may need further polishing and thinking (function UNESCAPE-C-STRING): http://paste.debian.net/1074448/
14:57:16
vms14
https://stackoverflow.com/questions/48932481/lisp-macros-quotation-implementation-in-javascript
15:02:20
makomo
vms14: what you linked is an implementation of lisp (scheme) in javascript (not an actual feature of js)
15:02:23
vms14
also I want to check if it's true that when you learn Lisp, you'll change as a programmer
15:03:34
beach
vms14: I think your time will be better spent aiming to program sooner in Common Lisp.
15:04:49
vms14
Just need to focus on PAIP and I will, but I'm learning webdevelopment because I'm on a course
15:05:19
makomo
vms14: well, it's an implementation of the backquote mechanism but all of it is at the level of the implemented language (scheme), not js
15:06:39
makomo
it's a cl package/program that takes common lisp code as input and compiles it into js
15:09:13
dtw
pjb: Thank you. Those don't _seem_ to handle \\u and \\U codes but are most likely better than my quick hack.
15:16:11
makomo
pjb: as i learned myself the other day, you should probably handle the case of *READ-SUPPRESS* being bound to T within your reader macros
15:23:26
pjb
Because you're mutating the variable place1, which has nothing in common with the variable x in (let ((x '())) (push2 1 x) x)
15:26:33
beach
asdf_asdf_asdf: So if you understand that C code (you didn't say either way), then you know that add2(234, x) does not alter x.
15:27:19
beach
asdf_asdf_asdf: Similarly, in Common Lisp, if you call push2 with a variable as a second argument, that variable is not altered by the call to push2.
15:28:11
pjb
Instead, use: (defun push3 (item1 place1) (cons item1 place1)) (let ((x '())) (setf x (push3 42 x)) x)
15:29:18
pjb
(setf (aref (gethash :v *h*) (round (* 10 (sin theta)))) 42) this evalautes (gethash :v *h*) and (round (* 10 (sin theta))), but not (aref (gethash :v *h*) (round (* 10 (sin theta)))).
15:30:38
beach
Aruseus: But SETF itself does not evaluate to anything. It is not in a position to be evaluated.
15:32:46
beach
Common Lisp terminology is not very "fault tolerant", so it is important to use precise terminology.
15:38:47
_death
results---the multiple values[2] returned by the storing form for the last place, or nil if there are no pairs.
16:08:09
asdf_asdf_asdf
How change global variable inside function? (defvar *x* 5) (defun aaa (a) (setf a 6)) I want: *x* => 6. How it do? Thanks.
16:09:04
beach
asdf_asdf_asdf: You ask many questions, but you don't like to answer the ones that you are asked do you?
16:09:57
pjb
asdf_asdf_asdf: but actually, have a look at: https://www.informatimago.com/articles/usenet.html#C-like-pointers-in-Lisp
16:10:51
beach
asdf_asdf_asdf: OK, so if you do int x = 5; then void set_global_binding (int a) {a = 6;}
16:12:33
beach
asdf_asdf_asdf: Like C and most other languages, Common Lisp uses "call by value", meaning that argument expressions are evaluated before the function is applied to those values.
16:20:04
beach
asdf_asdf_asdf: pjb's examples are often too sophisticated for someone at your level.
16:22:17
asdf_asdf_asdf
(defun aaa (&treat_as_original a) (setf a 100)) => AAA. (defvar *x* 0) (aaa *x*) => 100 *x* => 100.
16:25:56
beach
asdf_asdf_asdf: Common Lisp has something called "macros" that can be used exceptionally for situations like that.
16:30:02
beach
asdf_asdf_asdf: As a first-order approximation, it is generally a bad idea to have variables in the caller be modified by a function call.
16:38:16
beach
asdf_asdf_asdf: If you tell me your native language, I will check and see if there is an equivalent page.
16:42:26
beach
asdf_asdf_asdf: Why not, there are plenty of smart Polish people here that could help you in your native language.
17:09:01
pjb
asdf_asdf_asdf: you need to quote the argument, since SET works on symbols. Didn't you read clhs set?
17:09:35
pjb
(defun set-dynamic-binding (var val) (set var val)) (defvar *x* 0) (set-dynamic-binding '*x* 42) *x* #| --> 42 |#
17:10:39
pjb
asdf_asdf_asdf: so it is possible. But you should not do that! First, you should not use global variables!
17:12:05
pjb
Then since arguments are passed by value, the language doesn't help you. Mutating the symbol-value slot, which is what SET does, the modern way to write (set var val) is (setf (symbol-value var) val), is just that. It's not a general solution. See the articles linked above for a general solution using closure. Which is sophisticated, and demonstrate again that you don't want to do that!
17:12:38
pjb
There's no point in reproducing the bad things of C in CL! Use CL to write BETTER programs! Don't try to mutate your arguments.
17:12:55
pjb
Instead, if you insist on using mutation, you can mutate the objects, the _values_ of your parameters.
17:13:52
pjb
(defun my-mutating-fun (v) (incf (aref v 0))) (defvar *vals* (make-array 3 :initial-element 0)) (my-mutating-fun *vals*) *vals* #| --> #(1 0 0) |#
17:22:51
c0mrade
I've made an IRC bot that prints to a dot matrix Star printer on its serial port at ##robot, everything you type there is printed to it and it's on Live Stream on YouTube at https://youtu.be/zwRL5V0XWQY
17:32:51
jcowan
Is it normal for interactive restart handling of USE-VALUE, STORE-VALUE, etc. to evaluate the expression read from the user that specifies the new value?