freenode/#lisp - IRC Chatlog
Search
22:19:20
phoe
stacksmith: I think you can direct your question towards SBCL as it's reasonably fast and has a separate u-a-e-t for uint4
23:58:59
|3b|
unsigned-byte 7,15,31,etc u-a-e-t are probably from the combination of upgrading rules and type lattice, like NIL arrays being strings, since unsigned-byte 7 overlaps signed-byte 8
1:02:08
cranix
i would like to make many declaration of global variables in a loop using defparameter
1:06:06
stylewarning
cranix: (macrolet ((f (n) `(progn ,@(loop for k below n collect `(defparameter ,(intern (format nil "r~D" k)) nil)))) (f 32))
1:09:41
learning
been coding a project in python. it's crazy how differently i think about programming after doing only lisp for a long time.
1:09:42
cranix
this macro calls function that uses intern with format in similar fasion to what You wrote
1:13:01
learning
like i used to think about objects like some sort of abstract idea. now they just look like variables that have their own namespace that you can add variables on to. to be more concrete, i had a problem that required that i "override" (not sure what it's called in python when you define a function that's already been defined). the example solution created a new class in order to override. i wanted to do it in a more st
1:13:02
learning
raight forward way. so i looked up how to just redefine the function. it's actually a really bad way to do it because of a memory issue, but it was just about doing it for the learning experience. i would have never done that before lisp.
1:15:16
learning
instead of just seeing the solution to my problem and not understanding how it works, i not only understand how the solution works but i actually have this driving curiosity to figure out how to code it in a different way
1:16:14
learning
of course i learned recursion from doing lisp and that's prolly the biggest game changer
1:16:54
learning
and getting away from "solve everything by making more types" i think helped me a lot
1:20:43
learning
i laughed when i learned that python doesn't have multiline anonymous functions. so you have to name functions even if they're only going to be called once. that's something i wouldn't even have thought about before. anonymous functions have become my bread and butter.
1:22:06
learning
you can see the difference in mentalities just from the design of the programming languages. like clearly the person who invented python wasn't using lambdas when he created the language.
1:25:02
learning
when i started learning lisp it was definitely on the promises that "it makes you a better programmer even if you never use lisp again" and i'm glad that i can come back to this irc channel and say that i'm now one of those people who got better from learning lisp
1:25:17
GreaseMonkey
if `from __future__ import braces` is anything to go by i think it would be really, really hard to actually get multiline anonymous functions working
1:27:06
GreaseMonkey
it'd have to be a "python 4" where guido somehow reneges and adds braces... which is a shame because python's possibly the most popular programming language that has the machinery required for you to provide a macro transformer (AST parser and compiler + lets you hijack the import machinery)
1:30:43
learning
i mean i dont think it's important to have unnamed functions. it's more about having the mentality to write those functions in the first place. having to name something isn't that big of a deal to me.
2:58:31
stacksmith
learning: just in case you are for real - it is extremely important to have unnamed functions. Otherwise it requires a human to name functions. Lambdas can be generated programmatically. It would be a tragedy if you had to name them - pollution of the package, avoiding duplication, not to mention - why name things that need no name?
3:05:40
whoman
naming stuff is probably the main problem in all of linguistics, speech, communication, programming ...
3:15:01
whoman
dmh, ugh! and my scrollwheel is broken !! so many many many sites these days, have dynamic content, where the scroll nub jumps around and changes size. its a terrible situation
3:15:26
whoman
although to be fair, keyboard or mouse is NO MATCH for touch screen for scroll and zoom
3:16:25
mfiano
I mean how would you implement the ONCE-ONLY macro otherwise, or most correct macros that don't unintentionally capture?
3:18:13
whoman
mfiano, i know =( special cases. is there a clean way to provide prefix on gensym? instead of say (gensym (concat ...)) ?
3:19:30
learning
gensym is fine, it's just you need something on top of it so that you don't have to do it by hand
3:25:23
learning
it's not some complicated thing right. gensym's are just used to avoid two things being named the same thing, yeah?
3:29:01
learning
i wonder how bad it would be to just define a function that creates multiline anonymous functions from a string lol
3:36:24
stacksmith
learning: All lisp function are lambdas. The Lisp implementation creates 'anonymous functions' from a string, and if needed, attaches them to symbols. may I suggest #clnoobs?
3:39:34
learning
may i suggest passing the irc environment to your typing function, because you're missing some context
3:43:44
mason
stacksmith: If either of you is making the channel less pleasant, it's you. Please realize that whatever is bothering you has nothing to do with learning's rambling comparison.
3:47:06
mason
learning: For context, stacksmith feels like he's an old hand, having come in with his desperately important beginners questions in 2014, from what I can see.
3:49:15
mfiano
May I suggest to you all to use this forum for proper questions and discussions regarding Common Lisp instead of putting people down. Thank you.
5:03:19
Naergon
Hi. I dont know anything about lisp yet, but im looking for a language with this property: i can read a value from a file and use this value as an operation such as + * < etc? Without writing a hundred if-else, simply storing the value of whatever lisp considers a + ?
5:08:15
whoman
especially with Lisp, with the 'read' function =) its a common thing to do stuff like that
5:16:45
learning
you won't have to worry about replacing shit like 1 + 2 + 5. it'll just be (+ 1 2 5) and you can use a variable like (my-var 1 2 5) where my-var will be set to + after reading the file
5:18:48
Naergon
and the same but with more stuff like branches, cycles, jumps in code are also possible the same way, being read from a file?
5:21:30
Naergon
and one more thing, what is expected 'build' time for a new code being read from a file and to the execution? seconds?
5:22:06
stacksmith
Naergon: Lisp is a great language for metaprogramming - Lisp is designed to operate on code or data using Lisp.
5:23:00
smokeink
Naergon: while developing, you don't have to recompile your whole application, you can just recompile the functions you modified.
5:23:01
learning
lisp was made to be ran on really shitty computers. so it's really fast on modern ones.
5:24:51
beach
Java execution is very fast, because a lot of effort has been put into optimizing the compiler. Python, on the other hand, is not that great.
5:28:44
Naergon
What about REPL (read-execute-print-loop) type of usage, where i want my code to be updated in text editor often, can it work at about 1 second for this task for small project? (so i start a script, it reads the code, executes programm, prints it output, and returns to text editor)
5:29:37
learning
you should develop in real time if you are capable of building or using the tools to do so imo
5:30:52
beach
Naergon: We don't use the term "script". You are constantly in communication with your Common Lisp system, and you can incrementally modify the code in that system, by hitting a few keys in your text editor or by loading a file containing definitions.
5:31:00
White_Flame
the only thing you need to concern yourself about hot edits is make sure your functions actually exit or call each other; any "main loop" function will still keep running old code even if you replace the implementation with a new version
5:32:27
White_Flame
yes, that would be a specific case of "make sure your functions call each other" instead of being monolithic in a single function that doesn't return
5:32:31
beach
Naergon: Also notice that modern Common Lisp systems compile on the fly, so that a function definition that you type at the REPL or that you load from a file will be compiled to native code automatically.
5:33:34
whoman
White_Flame: ohh, right. the fun itself which doesnt return, not the symbols to which it refers. (ocaml was terrible for this, but great in all the other repl-like ways)
5:33:58
learning
otherwise it doesn't give you the compiled verison back. it gives you this slower function
5:34:30
White_Flame
the standard allows for implementations to distinguish "compiled" and "not compiled" functions, but most implementations don't bother
5:35:07
learning
im pretty sure ive played around with this like a year or two ago and there was a difference between when i explicity compiled and when i didn't
5:42:09
Naergon
And evolving turing machines, genetic algorithms and simikar concepts are bedt in lisp too, right?
5:43:43
beach
Naergon: Common Lisp is a general-purpose programming language that is capable of most things that other languages allow, so it is usually better independently of the application domain. But yeah, if you are going to transform code, then Common Lisp is a good choice.
5:44:23
White_Flame
learning: again, most implementations only bother having 1 form of executable function
5:44:53
White_Flame
especially if compiled-function-p returns true, that's a reasonable hint that it's going to run the same
5:45:20
beach
Naergon: Oh, it's a common situation. I hope you have plenty of time to make up for the lost years. :)
5:45:23
learning
white_flame: that would make the most sense to me. maybe im just remembering something else.
5:45:25
White_Flame
people tend to use COMPILE to avoid having EVAL, even though for defining functions, it's generally equivalent
5:47:06
learning
ugh. i think im just tired. can't even remember the file to find the source im trying to remember
5:48:04
White_Flame
but still, you don't need to specify it. Just load/read your code and it's in & compiled for popular implementations
5:48:24
learning
or maybe it was for some esoteric thing i was doing at the time and now i dont remember the context
8:34:23
smokeink
https://steve-yegge.blogspot.com/2010/12/haskell-researchers-announce-discovery.html
8:44:44
phoe
(clack:clackup (make-instance '<clack-app-directory> :root (truename ".")) :port 8080 :server :woo)
8:45:08
phoe
if anything, throw issues at fukamachi for writing no sensible documentation for his code whatsoever.
8:59:37
phoe
he writes efficient code that probably only he knows how to appropriately read and debug.
9:16:58
smokeink
don't bother with issues, he'll most probably tell you "You're not using the code properly - you should use clack's plugin for that" or something similar, with no additional details. After I encountered bugs with one of his programs I stopped using fukamachiware
9:20:16
Murii
If I have a function and I pass to it some arguments how can I change the global value of these arguments whitin the function itself witout telling to modify directly the global variables but the arguments which will reflect on the global variables?
9:21:57
beach
Murii: There are very few modern programming languages, if any, that would allow that.
9:23:03
beach
Here, call-by-value, means that the argument is evaluated, and then the VALUE of the argument is passed to the function.
9:24:39
Murii
I'm asking because I have a main function,lets call it 'a' and another function,'b',. 'a' holds 'b' but in 'b' I modify some values and in 'a' I new the newly modified values to work with
9:24:52
beach
shrdlu68: The variable would still have to be explicitly mentioned in the function then.
9:26:10
beach
You can make your functions return multiple values and make one of them the new value of the variable.
9:26:36
phoe
if you bind a dynamic variable in A and modify it in B, then you will be able to use the new value afterwards in A.
9:26:53
Murii
Well, I was thinking in doing that but the only way will be by returning a list() and then use nth to bind,right?
9:30:48
phoe
by default, non-primary values are discarded in most functions. you need to explicitly use them.
9:33:23
aeth
You can also use multiple-value-call, e.g. (multiple-value-call #'format t "~A ~A ~A~%" (foo))
9:38:05
pjb
Murii: so how you do it: you return the new value, and you mutate the state outside of the function!
9:39:28
pjb
Murii: notice that there's a define-modify-macro macro so that you can write: (define-modify-macro foof () foo) (let ((v 42)) (foof v) v) #| --> 44 |#
9:41:51
pjb
Murii: notice that this promote the functional style: write your functions so that it doesn't mutate external state. Therefore they become easy to test and debug. Therefore there's fewer bugs in your programs. All nice.