freenode/#lisp - IRC Chatlog
Search
3:58:46
aeth
What do people use for Lisp testing? I've seen two. Roswell. And now this lisp-devel Docker. https://lispcookbook.github.io/cl-cookbook/testing.html#gitlab-ci https://hub.docker.com/r/daewok/lisp-devel/
4:09:40
edgar-rft
aeth: there's an ANSI test suite for testing Lisp, but I assume that you're not looking what you're asking for.
5:03:34
low_brain_cache
I haven't registered a nick but I've been on here as beginner_supreme, cl0s, Common_Lisp (I think), etc.
5:06:37
low_brain_cache
I figure that since nicks are temporary assuming low activity, and registering a nick doesn't necessarily disallow others from using it, there's no reason to register
5:13:32
LdBeth
I believe freenode also allow to register several different nick under one mail address for bot or something
5:14:47
low_brain_cache
Is there a freenode manual of commands? /help lists a table but /help <command> doesn't do anything. <- Sorry for the non-lisp question but since we're on the topic of IRC... ;)
5:19:47
LdBeth
low_brain_cache: many commands are IRC client specific, so you should find your own manual
7:40:07
kuribas
Hi, I've set inferior-lisp-program with customize to sbcl, however everytime I restart emacs, it gets reset to lisp. Any idea why?
7:42:59
hajovonta
kuribas: I think this is an #emacs question, but I think you should set the state to "Save for future sessions"
8:23:33
jdz
I have no idea. Defining questions in terms of what Haskell does in #lisp seems... wrong.
8:30:34
jdz
Lisp is not Haskell, so this most likely is not the best way to solve whatever problem it is you're solving.
8:38:09
loke
No one will every convince me that reverse drop reverse is simple or beautiful. With a magic compiler is may be efficient. Maybe.
8:39:50
lieven
the standard prelude has some awkward stuff in it. for real work, you should use Text for strings
8:43:43
kuribas
I was reading this, and I found the lisp code quite ugly: https://markkarpov.com/post/lisp-and-haskell.html
8:47:38
kuribas
in haskell: addPadding str pad newline = intercalate ('\n' : replicate pad ' ') $ lines $ if newline then "\n" ++ str else str
8:49:08
hajovonta
Common Lisp is not a functional language, but it supports functional style programming.
8:50:52
jdz
I wonder why people who have no real experience with a programming language immediately have an urge to write articles titled "Why XXX is not my favourite programming language and why you should use YYY."?
8:53:42
hajovonta
loke I think (judging by the name) it takes a string and extends it with dummy characters or something like that
8:53:46
loke
shrdlu68: Did you see the add-text-padding fuction? Wtf... w-o-t-s with a map 'string inside followed by a return that is never used?
8:54:41
loke
Oh wait. he maps over the characters. And he seems to believe that 'string refers to the type of the thing he's mapping over
9:01:35
jdz
Never mind that the original code has parameter named STR that is shadowed by LET binding.
9:03:09
jdz
OK, that's intended. Making a copy of input for no apparent reason. I wonder if the guy has tested his code?
9:03:11
loke
I like his argument that QL doesn't use tests. But tests are required. Therefore QL is broken.
9:03:27
loke
Instead of: QL doesn't need tests, and still works. Perhaps I'm wrong and tests are not the end-all-be-all?
9:03:54
jdz
This function seems so convoluted it triggers all the possible wrong signals in my brain.
9:04:19
loke
jdz: It probably _has_ tests, and therefore it's perfect. No matter hopw convoluted. The tests pass!
9:04:55
kuribas
ok, so I have this, with the cl-string library: (join ((concat (string #\Newline) (repeat padding " "))) (lines str))
9:12:40
jdz
I have real trouble wrapping my head around what it's supposed to do and in what circumstances one would use such a function.
9:20:11
jdz
Elegance is subjective. I personally find my version straight-forward and directly matching the problem statement, and also not particularly inefficient.
9:25:37
varjag
kuribas: idiomatic lisp solution is to use an existing library, implementing this efficiently
9:43:43
jdz
Also, my version is easy to change so that it writes straight to a stream, without accumulating all the strings which most likely go to a stream afterwards, anyway.
9:44:08
jdz
kuribas: I recently heard that in Haskell it's also OK to mutate things if they don't escape a function?
9:45:31
shrdlu68
Called with exactly the same set of arguments, the result with always be the same, regardless of any changes outside the function.
9:46:50
jdz
shrdlu68: No, bragging about one's favourite compiler is the whole point of immutability.
10:02:19
LdBeth
shka: monads are not Haskell specific thing. Any languages with proper lambda support can have that
10:08:04
LdBeth
A CLOS question, now I have a class which has slots shared across all instances by :allocation :class, but how can I access these slots given I only have name of that class with no instance
10:20:24
flip214
Can anybody remember seeing a high-level interface to the Ethereum Blockchain RPC in CL?
10:37:18
Ukari
i found that in some project's file structure, test module are put into /t instead of /test, is it a tradition? for example, https://tinyurl.com/ya7f5w95
10:55:58
kuribas
since we were talking about efficiency... I am disassembling a simple function: (defun f (x y) (+ x (* y 2))) in sbcl. The resulting code doesn't have any add instruction...
10:56:25
kuribas
I tried adding a declaration: (defun f (x y) (declare (type fixnum x y)) (+ x (* y 2)))
11:00:58
kuribas
I would think it does a check first on the type, then generates efficient assembly to add the two numbers.
11:02:24
scymtym_
kuribas: (* <fixnum> 2) is not a fixnum. try e.g. (declare (type (unsigned-byte 32) x y))
11:08:11
scymtym_
if you want modular arithmetic instead of restricting the argument types, you can do (defun f (x y) (declare (type fixnum x y)) (ldb (byte 32 0) (+ x (* y 2)))) (in SBCL)
11:12:47
scymtym_
TMA: it would produce the correct result. efficiency would depend on whether the untagged representation was used for the arithmetic, i think
11:14:08
lieven
if you want to assure the compiler that that wont happen you can do (the fixnum (* <fixnum> 2))
11:17:52
lieven
kuribas: in optimising settings, a CL compiler will not check your type declarations but will take your word for it. If you lie to the compiler, it will have its revenge.
11:23:25
jmercouris
I'm just trying to dispel the myth ath CPU cycles are ALWAYS cheap, there is of course times when they are cheap, like during one-off tasks
11:25:11
kuribas
you can count the cost of requiring more computers - the cost of the programmer optimizing it.
11:26:54
jackdaniel
can I buy 20 CPU cycles from aws? that's really fine-grained :) what if I have a program which is composed only of operations where each takes 3 cycles?
11:27:23
kuribas
having to choose between safety and efficiency is also something you get when you bargain for using a dynamic language
11:28:48
jackdaniel
I don't think the major efficiency and safety gain comes from the language you write in – you can create unsafe and inefficient algorithms in a safe and efficient language
11:30:08
jackdaniel
kuribas: you simply write safe and efficient code ;-) what lisp gives you is a decent optimizing compiler and runtime safety guarantees
11:31:50
jdz
kuribas: make sure you use the takeWhile, etc. version (i.e., tho generic programmer-cycles saving one).
11:35:16
jdz
_death: c'mon bruh, we only care about toy examples, not practical real world scenarios.
11:44:28
jackdaniel
if the type is inferred, then redundant type checks may be safely removed (unless there is a bug in type inference algorithm)
11:45:26
White_Flame
in other words, type checks internal to a function body migh tbe elided. Those at the interface should remain intact
11:48:29
kuribas
what I mean, is that if you have a function using fixnum, calling another function with fixnum, the typecheck is redundant
11:51:49
jdz
It looks like you're wasting programmer-cycles with unimportant details instead of concentrating on a task at hand.
11:53:10
jdz
I trust my programs to be efficient enough if I don't write intentionally inefficient code.
11:53:22
_death
think about program evolution.. starting a lisp brings up a world at a particular stage of evolution, and you further evolve it by evaluating code.. static languages result in a dead world that's incapable of evolution
11:55:23
kuribas
so the lisp code took 0.069 (with no optimizations as recommended), the haskell code 0.009sec
11:55:32
_death
jmercouris: perhaps a better way to distinguish is system thinking vs. language thinking
11:56:19
jackdaniel
kuribas: then stick to haskell if you plan to write these kind of programs and you really care about efficiency on such level, lisp clearly fails to meet your standards
11:58:53
_death
jmercouris: http://dreamsongs.com/Files/Incommensurability.pdf contains some good discussion about systems vs. languages.. it takes a while to get there though, because the author wrote one essay where he should've written two
11:59:07
jdz
Right, and write another article titled "Why Common Lisp is not my favourite programming language and why I'm sticking with Haskell".
12:01:27
jackdaniel
protip: you may put x as a third argument in dotimes, it will be returned by that block
12:03:54
jackdaniel
kuribas: may I ask a question: do you plan to learn lisp, or your goal is to compare it to haskell?
12:04:42
jmercouris
jackdaniel: may I ask a question: why do people preface questions with questions in this manner?
12:05:13
jackdaniel
imo you can't do both *at the same time*, because these are two different languages with different promises
12:05:38
jdz
kuribas: you might as well think what you're doing. Why not set -O0 -g for haskell version?
12:05:38
jackdaniel
for instance (I don't know haskell, so I may be wrong here) – if haskell is functional, then it can memoize function call results
12:05:55
jackdaniel
in Common Lisp you'd have to create your own defmemo macro for that to achieve similar result
12:06:40
jackdaniel
jmercouris: how can I answer? that's how I speak sometimes? should I really explain myself on this matter?
12:07:14
jmercouris
jackdaniel: I was making an observation that I thought you might be interested in reflecting on
12:08:23
kuribas
jdz: I am getting the same performance with speed 3, but maybe i am doing something wrong.
12:09:04
jmercouris
jackdaniel: https://en.wikipedia.org/wiki/Socratic_questioning - last post on the matter, as it is off,topic
12:12:00
shrdlu68
kuribas: The biggest optimization, in my experience, is usually in type declarations.
12:15:18
jdz
Also, this exercise is really silly, nothing to do with the ADD-TEXT-PADDING we discussed earlier.
12:19:38
jdz
I thought the point of the exercise was not to try and optimize a trivial piece of code, but to compare the speed of idiomatically written code...
12:23:52
jdz
Considering you've translated the code correctly, and Int in Haskell is 32-bit signed integer.
12:29:12
jdz
Next step of the exercise is to measure the time it takes to compute a value that exceeds Haskells Int type.
12:37:49
jdz
kuribas: I'd still like to know what the result with my proposed change for the Haskell version is.
12:39:19
shrdlu68
kuribas: Indeed. But you don't have to, until speed really matters. It won't get in your way screaming for declarations and types.
12:39:58
kuribas
shrdlu68: I am going to work on a codebase involving lots of data, were performance does matter.
12:40:49
shrdlu68
kuribas: Good, write the code as you would naturally, with optimal data structures and algorithms, _then_ add declarations.