3

bruh wtf is a lexical variable

Comments
  • 9
    Ur google fu broke?
  • 11
    @lmgtfy lexical variables
  • 1
  • 1
  • 3
    @Demolishun i did search, infact its documentation is on the book im reading, i am just saying that lexical variables are fucking confusing and deserve a better explanation
  • 0
    @frogstair throw a bunch of letters and you have a bot, lemme try yibg
  • 4
    @frogstair "let me google that for you"
  • 2
    @frogstair 🤔 I get this result.

    When a variable is lexically scoped, the system looks to where the function is defined to find the value for a free variable. When a variable is dynamically scoped, the system looks to where the function is called to find the value for the free variable.
  • 0
    Lexical variable: not in my scope, can't see shit. Did you not see the brackets on the way in?
  • 0
    @frogstair yeah i know what it is but lisp has a twist added to it which makes it confusing
  • 0
    @SortOfTested lexical variables are pretty simple in other languages but in common lisp oh boy did i suffer learning them
  • 0
    { var this: Is = "one" }
  • 0
    Oh lisp then something like

    (a [b] [var these are ones] c)
  • 0
    @yellow-dog i think the last example was (defparameter *fn* ( let ((a 1)) (lambda (x) (+ a x))))
    and then (funcall *fn* 6)
    which would i give 7
    i understand what it does but im not really getting the meaning of it, a lexical variable is one binded with the function?
  • 0
    Sorry, this is clojure syntax, havent used lisp in a long time but they are fairly similar. Look up variable shadowing.

    In this case, var1 is a lexical variable of the function scope and the universe scope, with function scope taking precedence.
  • 2
  • 0
    So basicly lexical=local?
  • 1
    @Gregozor2121 yeah but in lisp theres 2 types of local lexicals and some other, lexicals have somekind of twist
Add Comment