freenode/#lisp - IRC Chatlog
Search
11:56:52
jmercouris
So, I'm trying to write a survey collection programmer, trying to think of how to persist the data
12:06:09
jmercouris
at least not without using a central table called like "survey" and it has some ID then another table related to it which has responsees
12:43:43
jmercouris
schweers: data fits in ram yes, but it is part of a webapp, so I don't want to keep things in memory / connect to a repl
12:46:24
jmercouris
it would be, if I could just email the survey out to people, but I would like a website for them to be able to anonymously respond
12:48:52
schweers
one of the reasons I like lisp and its modern implementations so much: you can program at really high levels, but also muck about with stuff like that :)
12:50:17
pierpal
looks like a good case for a prevalence db. there's at least one implementation in cl, which I never tried, though
12:51:24
schweers
but they are broken in some ways: getting the size of the store is not implemented, for instance
12:55:41
jmercouris
here is what makes neo4j great: https://neo4j.com/developer/cypher-query-language/
13:01:33
jmercouris
you do most of your logic in Cypher rather than handling it piecemeal and processing it in another language
13:02:07
jmercouris
so that reduces the overhead of information flow between the database and the program
13:11:26
schweers
jmercouris: I guess you’re right, if you use that part of it. I was concerned about using it as a plain old key/value store.
13:12:09
schweers
And if the only thing you do is put values in and retrieve them and do that alot, you may run into performance issues. The question is of course: are you using the right tool for the job, if that is all you need?
13:15:04
beach
Great, when I am not on #lisp all the time, this is also when the tunes.org logs seem to be having problems.
13:22:10
beach
Murii: But you can use Flexichain, a library that implements a version of editable sequences.
13:44:07
beach
Well, if it doesn't matter whether it is a sequence, you can do it in constant time, at least amortized. You can copy the last element to the place you want to delete, and then "shorten" the vector by moving the fill pointer.
13:46:24
beach
That's what I meant by it not being a sequence. Something that Murii seemed to suggest by asking about the hash map.
14:49:25
jmercouris
schweers: probably is an abuse of that tool, that's true, but I already use it in a lot of other places, so the barrier to using it is less for me
14:49:28
jmercouris
schweers: probably is an abuse of that tool, that's true, but I already use it in a lot of other places, so the barrier to using it is less for me
15:08:02
pjb
Murii: you can do: (let ((v (vector 1 2 3 4 5)) (i 2)) (vector-delete (aref v i) v :start i :end (1+ i))) #| --> #(1 2 4 5) |#
15:38:07
jmercouris
So, I had this issue I was fighting for about 10 minutes, apparently capitalized system names cause all sorts of issues
15:41:21
jmercouris
It seemed to work with System.asd containing a definition like `(defsystem :system` but not `(defsystem :System`
15:41:31
pjb
The problem might come from quicklisp. Since it accepts both :foo and "foo" as system name, it's better to avoid capitalized system names.
15:42:21
pjb
and if not, then remember that most people actively write code that breaks when the readtable-case is not :upcase.
15:43:11
sjl
Note that the canonical name of a system is a string, conventionally lowercase. A system name can also be specified as a symbol (including a keyword), in which case its symbol-name is taken and lowercased. The name must be a suitable value for the :name initarg to make-pathname in whatever filesystem the system is to be found.
15:43:42
jmercouris
Right, seems like it should give at least a warning when an uppercase system name is used
15:43:56
pjb
So the short answer is don't name the file with mixed case. Rename it System.asd. Also, note how funny Apple developers are: you cannot mv System.asd system.asd because there's already a file named system.asd (it's System.asd).
15:44:17
sjl
jmercouris: ASDF can't know whether you uppercase the symbol by the time the reader gets done with it
15:45:14
jmercouris
are there any linter tools in lisp? as standalone tools to statitically inspect lisp?
15:45:44
jmercouris
without necessarily loading the code into a lisp image, but just studying it as an intermediate representation, an AST or something
15:46:28
sjl
jmercouris: basically: ASDF gets a system name of :SYSTEM, says "this is a symbol, but system names are strings, so I'll (string-downcase (symbol-name ...)) it, and look up `system.asd`"
15:48:02
phoe
jmercouris: the best linter for Common Lisp code is your compiler. Read all the warnings and notes it produces for you.
15:53:07
phoe
jmercouris: yes, but you mean static analysis. It isn't really something done often in Lisp except for debugging purposes (when you have code walkers and such).
15:53:58
phoe
The most advanced Common Lisp code analysis tool that is able to produce the most useful information about your code is your compiler. No other CL tool will be as complete as it is.
15:55:54
phoe
Generally, you can't static-analyze Lisp code without doing all the work that a compiler does, because we have a Turing-complete reader, a Turing-complete macroexpander, and a Turing-complete compiler.
15:56:41
phoe
And once your static analysis tool does all of that work, it's not a static analysis tool anymore. It's a compiler.
15:57:03
knobo
One thing that is frustrating with local-time, is day-of-week starts from 0 which means sunday.
15:58:59
flip214
knobo: but that's okay, because day 1 is monday - and day 7 would be sunday again....
16:03:44
knobo
if you (adjust-timestamp some-tuesday (offset :day-of-week) day) where day is :monday or :sunday, then you get two different week numbers.
16:11:21
flip214
knobo: see also the week-number confusion. http://rachelbythebay.com/w/2018/04/20/iso/
16:21:59
_death
flip214: the point (alphabetical order instead of likelihood-of-use order) is ok, but the consequence seems a bit theoretical.. I don't remember ever seeing use of %G in the wild
16:27:04
_death
and of course alphabetical order is useful for reference and when the manpage comes in print..
16:43:48
sjl
_death: %G instead of %Y took down twitter's API a while back https://twitter.com/mattklein123/status/984587432833069056
19:31:42
jmercouris
I just always accepted the functionality without thinking too hard about the name
19:33:28
Bike
'(mathematics, transitive, followed by a "to" phrase) To act as a function on something, taking it to something else.'
19:33:45
jmercouris
map does have the other meaning as well, yes: https://en.wikipedia.org/wiki/Associative_array
19:37:03
jmercouris
comborico1611: when pfdietz said "Those names are largely historical", they were referring to car, cdr, caar, cadr etc
19:44:09
pjb
comborico1611: the other names are more interesting: mapc mapcar mapcan mapl maplist mapcon; mapc and mapl are like mapcar and maplist, but they return the first list argument, not consing a new list. mapcan and mapcon concatenate resulting lists (using nconc, thus mutating those result lists, stitching them together). Of course, the difference between the first set and the second set is that the first set works on the elements
19:46:08
pjb
comborico1611: of course, the mere MAP function is also nice, since it can work on sequences in general: (map 'vector (function list) '(a b c) #(1 2 3) "!:.") #| --> #((a 1 #\!) (b 2 #\:) (c 3 #\.)) |#
19:48:00
pjb
(map 'vector (lambda (&rest chars) (format nil "~{~C~}" chars)) "hello" "world" "keybd" "avian") #| --> #("hwka" "eoev" "lryi" "llba" "oddn") |#