freenode/lisp - IRC Chatlog
Search
14:52:46
beach
That's stupid. Here in Europe, the machine switches to the official language of the country where the card was issued.
14:53:18
beach
Well, maybe not ATMs. I don't know that. But when you pay in a store with a card for instance.
14:53:44
Bike
the US doesn't have an official language and we have many people who would prefer languages other than english. melting pot and all.
14:54:17
Bike
of course it's pretty annoying when the ATM says it will remember your preference and then asks you the exact same question next time
16:32:22
flip214
well, depending on the card format any user could use unused space for their own files...
16:38:05
p_l
when you put the card in, the ATM will query it for list of applications, then select from it the few that it supports (for example, Mastercard or Visa), then talk to that specific application
17:00:36
fiddlerwoaroof
https://github.com/slime/slime/blob/master/contrib/slime-fontifying-fu.el#L9-L13
18:29:23
jeosol
Does cl-mop:deep-copy of an object creates a complete new copy even for slots that are class objects?
18:30:11
jeosol
I am trying to create a new fresh object and modify one of the slot objects. Or what is a better way to do this.
18:31:31
jeosol
I have used cl-mop:deep-copy, I changed the inner slot object and when printed, they have the same value, so I am not doing something right
18:36:35
Bike
it looks like it copies values of class slots, but that just means changing the value of the class slot, which is after all shared
18:38:09
jeosol
Bike: I apologize for the lack of clarity. I mean have another object that is a slot in the outer one.
18:42:59
Bike
i mean, deep-copy calls copy-tree, but that won't copy the elements in the tree, just the conses
18:50:33
jeosol
I see. I was able to get it fixed by still performing a separate copy of the slots. I have used this approach (two step copy) in the past to get the objects to be different and not sure if there is a better way.
18:53:38
jeosol
I am trying to do sensitivity analyses by changing some slots (2 or more) in the parent object and can do by a function and submit in parallel
18:54:11
jeosol
Once I change the objects, I use it to create a deck for another black box function (external physics simulator)
18:55:19
jeosol
each one writes a different input deck when evaluated. I could do it sequentially on the same object, but trying to get the results faster by doing parallel calls.
20:05:15
thijso
Ah, ok. Yeah, then you're out of luck. Only way I see is to copy into a newly created hashtable with the correct test, but that is probably quite expensive...
20:10:43
aeth
I think the general expectation is to work with symbols/keywords if possible, where string= hash tables would mostly be for keys for things based on user input... so, yes, it's inconvenient, but not as commonly needed as it is in many other languages
20:11:47
aeth
Depending on what you'd need, you could make a make-hash-table* that defaults to string= (or equal or whatever), or a copy-hash-table... but alexandria has the latter.
20:12:06
pjb
seok17: (defun change-hash-table-test (old new-test) (let ((new (make-hash-table :test new-test :size (hash-table-count old)))) (maphash (lambda (k v) (setf (gethash k new) v)) old) new))
20:12:52
aeth
It looks like alexandria:copy-hash-table takes a keyword argument called test where if it's defined it will change what the test is (and if it isn't, it keeps the old test). So you could turn default hash-tables into #'equal hash tables that will also work on strings
20:14:10
aeth
You could also test for EQUAL or STRING= or EQUALP or STRING-EQUAL being used in the HASH-TABLE-TEST first to save a copy.
20:14:21
pjb
(let ((old (make-hash-table))) (setf (gethash "foo" old) 42 (gethash (copy-seq "foo") old) 1) (hash-table-keys (change-hash-table-test old 'equal))) #| --> ("foo") |#
22:27:09
mrcode_
what's the right way to specialize a method on an array of unsigned-byte vs a string ?
22:29:12
Xach
mrcode_: STRING is a system class, so that will get you a method that acts only on strings. but there isn't anything specific for an unsigned-byte array.
22:30:52
mrcode_
Xach: does this mean it's impossible to specialize a method for a (simple-array character *) vs (simple-array (unsigned-byte 8) *) ?
22:47:39
mrcode_
hmm, I guess a quick followup to that, how does one specialize a method on an array in general ?
22:51:14
pjb
mrcode_: the right way to do that is to define two custom classes, one that wraps the array of unsigned-byte and the other a string, and to specialize on those classes.
22:53:15
pjb
Of course, you can also specialize on the classes returned there, or rather, one of their superclasses, since the result is somewhat implementation dependent or too restrictive: (values (class-name (class-of (make-array 3 :element-type 'unsigned-byte))) (class-name (class-of (make-string 3 :element-type 'character)))) #| --> simple-vector ; simple-base-string |#
22:54:03
pjb
mrcode_: array is definitely a system class, you can specialize on it. (find-class 'array) #| --> #<built-in-class array> |#
22:54:57
pjb
mrcode_: defining wrapping classes would have to be done, assuming you don't want your method to dispatch for arrays of signed-byte or arrays of (unsigned-byte 8), say…
23:11:25
no-defun-allowed
I think the "self" column is how many samples have called that function last, and "total" is how many have that function anywhere on the stack.
23:17:47
no-defun-allowed
But then that would mean my interpreter is in the dispatch loop (as opposed to running some code) 53% of the time, which I don't believe.
23:27:30
no-defun-allowed
Could try that. My opcodes are lambda functions and thus I can't name them to trace, but I'm interested to see if that 53% number is anything near realistic.
23:29:42
no-defun-allowed
Or that could be possible, since the loop does quite a few checks to limit conses and cycles and establishes a restart too.
23:32:27
no-defun-allowed
Yep, it was that restart all along. I guess I will have to split up this loop into a setup part, then a run part, so that it's possible to continue running the interpreter when we raise a signal for some external data.
1:02:28
DrDuck
Can I expect Winston and Horn's code from their 'Lisp' book to compile even though the book was published in '89?
1:09:00
Bike
no, the garbage collector is not standard. also, if you can refer to an object and pass it to such a function, it's not garbage
1:09:02
no-defun-allowed
Well, if there was some function for it, calling it would create a reference to that object, so no.
1:09:31
no-defun-allowed
But (trivial-garbage:gc :full t) will do a full garbage collection (if you load the trivial-garbage system).
1:12:41
no-defun-allowed
It would be terribly inefficient to garbage collect only one object, when a significant proportion of the heap is scanned.
1:14:39
DrDuck
i want to force the garbage collector to clear up some memory explicitly when i tell it to
1:15:14
Bike
well, as ddefun said, the implementation usually has a hook to run the collector manually
1:16:27
Bike
in a garbage collected system memory is not really a concern directly, so you should only need to worry about it if you need to tune performance or the like
1:16:59
Bike
especially, you can't do something like (free x) (print x) like you can in C (i mean, it's invalid, but you can write it)